Link to home
Start Free TrialLog in
Avatar of Indinanmack
Indinanmack

asked on

Linux Bridging Problem Newbie

Hi All,
I am a Linux newbie with a problem that is driving me crazy! I have a wireless Netgear USB adapter setup as eth0 that is using my wireless router as its gateway.  I have a second NIC that is setup as eth1.  I want to be able to bridge (I am guessing) the two cards so I can put a cable from the Non-wireless card (eth1) into the Uplink of a HUB to connect other devices that uses eth0 as its gateway.  I tried to used bridge-utils and it says that eth1 and eth0 are forwarding, however the link light does not light up unless it is switched to normal. I truly am a newbie that needs detailed info.  I am using Red Hat 8.0.  Thanks a lot for any help.
-Bobby
Avatar of jeremynd01
jeremynd01

test
Heh!  Sorry about that last one... I've had some probs with posting to Ex-ex today!

Ok, I don't know how your router works, but I can get the two cards bridged for you np.  From your description, bridging is exactly what you want.  (Note, su and login as root, and make all your changes as such).

First, let's get some information:
#ifconfig eth0

Take note of the IP address of eth0 (write it down - you'll need it later).  Now if your router has built-in DHCP services, and you can set it to give eth0 a static IP by assigning the MAC address, that would be best.  (It sounded like you're not using PPP over a DSL line or anything, so I'll proceed under that assumption).


Let's modify the network configuration files for bridge use.  Open up /etc/sysconfig/network-scripts/ifcfg-eth0 in your favorite editor.  Make these changes:
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.1
(these really don't need and IP to function as a bridge, so you could omit the IPADDR= line, but I like to leave em in so I can ping them).  Do the same for eth1 (its file is called ifcfg-eth1), only give it a new IP (like 192.168.1.2).


Now take the devices down and bring 'em up to give them their new IPs:
#ifdown eth0
#ifdown eth1
#ifup eth0
#ifup eth1

(if for some reason the network wasn't started at boot, do a 'service network restart' instead of these four lines).  A quick ifconfig should show you if the changes worked.

Now create the bridge named br0 (brctl is part of the bridge-utils package)
#brctl addbr br0

Add the two ethernet devices to it:
#brctl addif br0 eth0
#brctl addif br0 eth1

Now turn the bridge on:
#ifconfig br0 insert_eth0_IP_you_wrote_down_here up

(for instance: #ifconfig br0 123.321.1.99 up)
That should be it, your bridge should work dandy now.  If you want to make these changes permanent, then you can add them a to a script (perhaps a comment for another day...), and reference it in /etc/init.d/rc.local

Ok, I should take note for the sake of completeness: I assume that your DHCP server gives you an important address.  For instance, it could be a static IP from your ISP or something.  That's why I use the eth0 device to get the ip, manually change it to 192.168.1.1, and assign it for use by the bridge.  Now I suppose that there may be some way for the bridge br0 to get its IP from a DHCP server (which would be the sophisticated way of setting this up), but I don't know how to do it.
Avatar of Indinanmack

ASKER

Hi,
I did exactly what you had told me, however the uplink light on the HUB is still now illuminating.  When you told me to write down the IP address after I typed in ifconfig it was the static IP I wrote in originally of 192.168.0.4  And when I try to bring eth1 up by doing ifup eth1 it says RNETLINK saya: File Exists
Thanks Again,
Bobby
Also I wanted to mention that as soon as I put the bridge up I am no longer able to ping or navigate external websites.  More so when I addif eth0, which I was able to before the bridge.  Also if I do a ifconfig after the bridge I see br0 and its an exact copy of eth0.  Thanks again. Bobby
Bobby,

Ok, let's try and iron some stuff out.

When you say the IP address for eth0 was "the static IP I wrote in originally..." I'm going to assume that you mean during RH 8.0 installation.  See, some routers have the ability to assign addresses, but this assumption means your router will accept all traffic originating on your LAN, which is fine.

Now about the ifup commands - forget them, for now.  If the two files ifcfg-eth0 and ifcfg-eth1 were modified per my instructions (specifically, ONBOOT=yes and BOOTPROTO=none), all you need to do is

#service network restart

You should see the two ethernet devices and the loopback all come up with green [OK]s.  Now a quick ifconfig should show you that all of the devices are operating, and have the IPs designated.  If eth1 doesn't come up, then there's something wrong with the configuration (and I don't know what the RNETLINK error means... but 'file exists' may refer to some lock file or something...)  What kind of card are you using for the eth1 device?

(Side note - I forgot this before, but you may want to turn on promiscuous mode on eth1, so it listens for all packets that reach it and not only packets destined for it.  Do this by
#ifdown eth1
#ifconfig eth1 --promisc up
You can probably add this to the network ifcfg scripts)

Now there's a reason why you can't ping after you do the #brctl addif eth0 command, but before you bring up the bridge.  The bridge basically replaces eth0 as the interface used to contact the outside world.  Since you defined the IP address for eth0 (that is, it's not assigned by your router or ISP), when you do the
#ifconfig br0 192.168.x.x up
the IP you supply needs to be one that your router will accept, translate, and forward for you.  Again, this gets into how your router is configured.

I know there isn't much info in this message.  Let me know what kind of card eth1 is, and give me a dump from ifconfig after you go through all of the instructions.
(Newbie trick: #ifconfig > ~/ifdump
this'll create a file 'ifdump' in your home directory, so you can copy-paste it into the ex-ex box).

-Jeremy
Hey Jeremy,
Here is the dump AFTER I SETUP UP THE BRIDGE...
By the way eth1 has 192.168.0.4 as its gateway



r0       Link encap:Ethernet  HWaddr 00:04:5A:75:34:33
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0      Link encap:Ethernet  HWaddr 00:09:5B:36:F7:1E
          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1678 errors:73129 dropped:4101 overruns:6 frame:150500
          TX packets:675 errors:73129 dropped:4096 overruns:74760 carrier:149698
          collisions:73728 txqueuelen:100
          RX bytes:282265 (275.6 Kb)  TX bytes:106281 (103.7 Kb)

eth1      Link encap:Ethernet  HWaddr 00:04:5A:75:34:33
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:238 dropped:0 overruns:0 carrier:476
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:10 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16729 (16.3 Kb)  TX bytes:16729 (16.3 Kb)

____________________________________

And here is the one before the bridge:
[root@BOBBY root]# ifconfig |more
eth0      Link encap:Ethernet  HWaddr 00:09:5B:36:F7:1E
          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1925 errors:73129 dropped:4101 overruns:6 frame:150500
          TX packets:905 errors:73129 dropped:4096 overruns:74760 carrier:149698
          collisions:73728 txqueuelen:100
          RX bytes:302111 (295.0 Kb)  TX bytes:145011 (141.6 Kb)

eth1      Link encap:Ethernet  HWaddr 00:04:5A:75:34:33
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:380 dropped:0 overruns:0 carrier:760
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:10 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16729 (16.3 Kb)  TX bytes:16729 (16.3 Kb)



Thanks for everything,
Bobby
ASKER CERTIFIED SOLUTION
Avatar of jeremynd01
jeremynd01

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Indinanmack:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.