Skip to main content

Bridging Ethernet Connections - Ubuntu/Fedora

Installing bridge-utils

Adept

Search for bridge-utils and choose the drop-down arrow on the left. Choose "request install".

Konsole:

Enter this into Konsole:
sudo apt-get update
sudo apt-get install bridge-utils
If you use sudo -i and enter your password, then you will not have to use sudo before each command. It may also save you some typing in the future.

Setting up the Bridge

Ensure that both (or all) of your interfaces are installed and enabled. If they are then you may proceed at this point. For a few moments, if your computer is connected to the internet then it will be disconnected until a certain point is reached.
Open Konsole and use the following commands. Note that when interfaces are referenced, they refer to device names assigned by linux such as "eth0" and "eth1". Also note that myBridge is the name of the bridge that you wish to have. This can be anything, but a simple name like bridge0 or bridge1 is suggested.
ip addr flush dev <interface 1>
ip addr flush dev <interface 2>
brctl addbr <bridge name>
brctl addif <bridge name> <interface 1> <interface 2>
ip link set dev <bridge name> up
In lines 1-2 we simply prepared the devices to be bridged. In line 3, we added a new bridge named myBridge (whatever you named your bridge). In lines 4-5, we added interface1 and interface2 to myBridge. In line 6, we made the bridge operational. For more information on commands: use the Konsole command brctl

Create the Bridge at Start-up

The above setup demonstrated how to create a bridge using the command line, however when you restart your computer you will lose it. To prevent this from happening, we need to edit the /etc/network/interfaces file. This file shows an example of a bridge configure via dhcp.
Sample /etc/network/interfaces file
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Bridge between eth0 and eth1
auto br0
iface br0 inet dhcp
# For static configuration delete or comment out the above line and uncomment the following:
# iface br0 inet static
#  address 192.168.1.10
#  netmask 255.255.255.0
#  network 192.168.1.0
#  gateway 192.168.1.1
#  dns-nameservers 192.168.1.5
#  dns-search example.com
  pre-up ip link set eth0 down
  pre-up ip link set eth1 down
  pre-up brctl addbr br0
  pre-up brctl addif br0 eth0 eth1
  pre-up ip addr flush dev eth0
  pre-up ip addr flush dev eth1
  post-down ip link set eth0 down
  post-down ip link set eth1 down
  post-down ip link set br0 down
  post-down brctl delif br0 eth0 eth1
  post-down brctl delbr br0
Restart networking
sudo /etc/init.d/networking restart 

Notes about the setup

You have successfully completed an invisible bridge between your interfaces. If computer doing the bridging's purpose is simply to act as a switch and nothing more, then you are done. However, most users will still want to be able access the internet (and the rest of the network for that matter from the computer). Please read below to see how to do this.

Enabling Internet Use on the Bridging Computer

It is very simple to setup the internet on the bridging computer.

Finding the Default Gateway

These directions below attempt to locate your default gateway. They are not foolproof and if you are not sure what your default gateway is then contact your Network Administrator or see the Kubuntu IRC channel if the Administrator is you. If you know your default gateway, then skip to the
1. If the internet worked on your computer before, then open the KDE Panel and choose system settings. 2. Open System Settings and next click Network Settings. 3. Click the "Administrator Mode..." button at the bottom of the window and enter your password. 4. Choose the "Route" tab and remember, write down, or copy the address inside the Default Gateway group box and the "IP Address" text box.
You now have your default gateway IP address. It is now possible to setup your computer to access the internet through the bridge.

Konsole Commands

Once you have your default gateway then enter these commands below.
ip route add default via <default gateway ip address>
dhclient <bridge name>
If you get a message back from the first command, such as
SIOCADDRT: File exists
or
SIOCADDRT: Network is unreachable
Then skip to the second command.


To ensure that you are connected to the internet, ping the IP address with the command below.
ping 66.94.234.13

Comments

Popular posts from this blog

Microsoft Active Directory

> What Intrasite and Intersite Replication? Intrasite is the replication within the same site & intersite the replication between sites. > What is lost & found folder in ADS? It’s the folder where you can find the objects missed due to conflict. Ex: you created a user in OU which is deleted in other DC & when replication happed ADS didn’t find the OU then it will put that in Lost & Found Folder. > What is Garbage collection? Garbage collection is the process of the online defragmentation of active directory. It happens every 12 Hours. > What System State data contains? Contains Startup files, Registry Com + Registration Database Memory Page file System files AD information Cluster Service information SYSVOL Folder >What is the difference between Windows 2000 Active Directory and Windows 2003 Active Directory? Is there any difference in 2000 Group Polices and 2003 Group Polices? What is meant by ADS and ADS ser...

What are the few major differences between 2003,2008 & 2012

2003-IIS 6.0 2008- IIS 7.0 2008R2- IIS-7.5 2012-IIS 8 ---------------------- 2003-32 AND 64 BIT AVAILABLE 2008-32AND 64BIT AVAILABLE 2008R2- ONLY 64BIT AVAILABLE 2012 - ONLY 64 BIT AVAILABLE ------------------------------------------ 2003 KERNAL VER. -5.2 2008 KERNEL-6.0 2008 R2-6.1 2012-6.2 ------------------------------------------ 2003- IE VERSION 6.0 2008- IE VERSION 7.0 2008 R2 IE VERSION 8.0 2012 IE VERSION 10.0 2012 R2 IE VERSION 11.0 ----------------------- 2003- AD ADMINISTRATIVE CENTER NOT AVAILABLE 2008- NOT AVAILABLE 2008 R2- AVAILABLE 2012- AVAILABLE -------------------------------------