Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:  Bcast:  Mask:
          inet6 addr: fe80::203:47ff:fecf:a008/64 Scope:Link
          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:  Mask:
          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

share|improve this question

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.

share|improve this answer

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.

share|improve this answer

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


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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.