0

I have been banging my head against the wall with trying to configuring bridge on my Ubuntu. I am a novice user on Linux but an IT professional of 10 years experience on windows. So I would understand the concepts but just cannot get the steps mention on internet working for me.

What I need is to be able to bridge my eth1 to eth0. My Ubuintu 10.4 LTS box has two adapters eth0 and eth1 and I want to use it to connect my Windows 7 PC to the internet (and external network). eth0 is connected to the external network and has DHCP. eth1 is connected to windows 7 using a Cross cable.

Here is my output for ifconfig:

eth0      Link encap:Ethernet  HWaddr ~~~~~~~~~~~
          inet addr:10.128.4.250  Bcast:10.128.255.255  Mask:255.255.0.0
          inet6 addr: fe80::203:47ff:fecf:a008/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13936 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3277 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1953127 (1.9 MB)  TX bytes:3887075 (3.8 MB)

eth1      Link encap:Ethernet  HWaddr ~~~~~~~~~~~~~~ 
          UP BROADCAST 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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:480 (480.0 B)  TX bytes:480 (480.0 B)

And this is my /etc/network/interface (what it looks now after reverting back to what it was since i tried numerous things but did not work):

auto lo
iface lo inet loopback

I have already installed bridge-utils by downloading and then installing it and I can use brctl. So I know that I need to define br0 and I have done that but it never worked.

Can you please tell me what steps I need to do to get it working?

Thanks in advance Ali

Aliostad
  • 101
  • 1
  • 4

3 Answers3

1

Make your Ubuntu's /etc/network/interfaces look like this:

# Interfaces to bring up automatically
auto lo br0

# Loopback
iface lo inet loopback

# Physical interfaces
iface eth0 inet manual
iface eth1 inet manual

# Bridge
iface br0 inet dhcp
    bridge_ports eth0 eth1

Then reboot.

Your Ubuntu box is now directly connected to the internet via interface br0, with its networking configuration assigned to it via DHCP (I assume your ISP is running DHCP). Your Windows 7 PC is also directly connected to the internet, since it is plugged into the bridge. You will need to be certain to have appropriate firewalls configured and running on both machines.

Steven Monday
  • 13,599
  • 4
  • 36
  • 45
0

The standard solution to share an internet connection is NAT, not bridging.

That said, it is usually a good idea to use some higher level tools to configure this kind of networing. The standard Ubuntu tool is ufw. It has some good documentation. My favorite is Shorewall.

Guillaume
  • 1,063
  • 5
  • 12
  • 24
0

All depends on what you want to learn, iptables is the most used firewall software in Linux, but Ubuntu uses ufw that's simpler.

Using iptables, you should do a script with at least:

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

iptables --append FORWARD --in-interface eth1 -j ACCEPT

Also it's very important to activate the forward bit:

echo 1 > /proc/sys/net/ipv4/ip_forward

Source: http://www.yolinux.com/TUTORIALS/LinuxTutorialIptablesNetworkGateway.html

Using ufw (uncomplicated firewall) is more simple I think, though I never used it:

https://help.ubuntu.com/8.04/serverguide/C/firewall.html

anders
  • 235
  • 2
  • 10