Setting up Bridge/Firewall on Ubuntu

5,226

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:
5,226

Related videos on Youtube

Aliostad
Author by

Aliostad

Updated on September 17, 2022

Comments

  • Aliostad
    Aliostad almost 2 years

    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