1

I have two NICs on a fresh install of Ubuntu 10.04 LTS. Both are config'd be dhcp. Both cards are on the same lan with same gateway. everything about the cards is the same except the IPs they get, which is what I want.

What I'm trying to achieve is having both NICs operational at the same time.

Currently when the server boots, it activates both NICs, but the server can't resolve any domains. If I ifdown one of them and bring it back up, the server is able to resolve domains, but the NIC I bring up won't respond to any traffic.

Any ideas?

SOLVED

So basically both NICs should be on different subnets. The kernel will drop packets otherwise in the scenario I outlined.

A stopgap solution is to disable the dropping of packets with

# for i in /proc/sys/net/ipv4/conf/*/rp_filter ; do echo 0 > $i done

More info here: http://lartc.org/howto/lartc.kernel.html

6
  • 1
    Are you trying to achieve ethernet bonding ? (i,e one logical interface using both cards) or two interfaces (in which case put each on a different subnet).
    – Sirex
    Jan 12, 2011 at 11:03
  • Two interfaces. Is it possible to achieve this setup without moving a card to a different subnet?
    – kobrien
    Jan 12, 2011 at 11:07
  • Is there a reason why you want two DHCP-enabled NICs on the same subnet? The reason I ask is that it's an unusual request and likely not necessary.
    – gravyface
    Jan 12, 2011 at 11:21
  • I think it's much better to have static IP on server.
    – Ency
    Jan 12, 2011 at 11:26
  • Ok, to reply to all of you: Sirex: Bonding won't work cause I have two services which need to listen on the same port. gravyface: I'm changing to static IP, this solves the problem. Ency: dhcp is just how we assign our addresses by MAC address. They're effectively static.
    – kobrien
    Jan 12, 2011 at 11:45

3 Answers 3

2

I've just recently had something quite alike. Please read http://lartc.org/howto/lartc.kernel.html.

Ubuntu 10.04 LTS by default filters packets that could have reached the host more directly. This makes networking dysfunctional on hosts with multiple paths to a network unless the kernel parameter is changed.

3
  • log_martians is showing a lot of packet dropping. How do I stop this. Which number to echo to which file?
    – kobrien
    Jan 12, 2011 at 11:29
  • rp_filter is currently set to 1 for all interfaces
    – kobrien
    Jan 12, 2011 at 11:31
  • ok, set them to 0 as in the script in my edit to the question
    – kobrien
    Jan 12, 2011 at 11:55
1

It's a similar setup to a multi-homed router. I think it's a routing issue. Local processes receiving packets won't automatically send the response packets back out over the same adaptor.

You can check this with tshark. Run tshark -i eth0 and tshark -i eth1 (If those are your adaptors) on separate shells, then watch the flow of packets as you connect to each IP from an external source. If you see all return traffic going back out of eth0 for instance, then you'll need a couple of routing rules to sort that out, which is where iproute2 comes in. The HOWTOs (1) (2) are enormous , but I've found a useful blog post that should cover what you need, here:

http://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/

(You can probabaly skip the kernel compilation stage.)

1

If you have two NICs on the one LAN you almost certainly want to create a bonded interface (sometimes called teamed). They will share a single IP and can be configured to load-balance.

1
  • This would be a good approach if I didn't need two services listening on the same port.
    – kobrien
    Jan 12, 2011 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .