0

I have two physical NICs (eth2 & eth3) with eth2 connecting to the home router/dhcp server and eth3 connecting to another machine which needs access to the internet.

I'm trying to create a bridge so that the second machine on eth3 can be connected on the lan. I've tried the following, however it hangs when attempting to get an IP address from the router. Likewise, attempting to give it a static route doesn't seem to work either.

$ sudo aptitude install bridge-utils
$ sudo ifconfig eth2 down
$ sudo ifconfig eth3 down
$ sudo brctl addbr br0
$ sudo brctl addif br0 eth2 eth3
$ sudo dhclient br0 # this hangs and fails to get a dhcp address

I've tried to ensure my routing table mimics what it looks like when using eth2 normally, I cannot hit the gateway at all.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0      0.0.0.0         255.255.255.0   U     2      0        0 br0
0.0.0.0         192.168.0.1      0.0.0.0         UG    0      0        0 br0

I attempted an 'arping' to the MAC address of the router while I had eth2/3 bridged, but it failed to obtain it's IP address as well.

One interesting thing I noticed was that attempting to bring down the bridge & reactivate my internet on eth2, I was having trouble pinging the gateway. It turned out 'ipmasq' had been installed and was running causing odd problems. When I stopped the ipmasq service, my internet started working properly again. I removed the 'ipmasq' package entirely and tried bridging the NICs again thinking it may have been causing problems, but it still failed.

Any suggestions as to how to resolve this?? Any fool-proof method to get this to work??

6
  • Why not just connect the other computer to the router?
    – Keltari
    Commented Aug 14, 2011 at 23:21
  • Was the bridge interface running at the time? Try: ifconfig br0 up Commented Aug 15, 2011 at 0:01
  • @Keltari - The router is out of reach. Yes, there are numerous other ways of reaching the end goal, however this is the specific problem I'd like to resolve.
    – uzzi09
    Commented Aug 15, 2011 at 3:45
  • @David - Yes, the bridge interface seems to be brought up on its own by dhclient. ifconfig would show it listed, but not have an IP address assigned.
    – uzzi09
    Commented Aug 15, 2011 at 3:47
  • Dd you bring eth2 and eth3 up as well and make sure they're in PROMISC mode? (I think the bridge does the PROMISC part automatically, but you manually downed them,) Commented Aug 15, 2011 at 5:16

1 Answer 1

1

After configuring the bridge interfaces, bring up both the bridge interface and its members:

for i in br0 eth2 eth3; do
 sudo ifconfig $i up # or sudo ip link set dev $i up
done

After that, depending on your STP settings for the bridge, it might take less or more seconds until the bridge actually enters forwarding mode. If you don't need spanning tree, execute the following commands after adding the member interfaces to make it enter forwarding state faster:

sudo brctl stp br0 off  # disable spanning tree protocol
sudo brctl setfd br0 0 # configure forwarding delay to 0

Let us know if it works.

1
  • I hadn't brought eth2/3 up as none of the tutorials said anything about bringing them up. I'll certainly try this and follow up. Thanks for the suggestion.
    – uzzi09
    Commented Aug 18, 2011 at 2:26

You must log in to answer this question.

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