Network Bridging in an Ubuntu desktop/server

Summary

Requirement is have two or more network cards on a server that do the same job as a network switch.

1000base switches are more expensive than a few NICs and spare PCI slots (although the bus may not be up to all that traffic). The Desktop is running LTSP so Gigabit Ethernet is a much better experience for the clients.

Summary of hardware

Tower PC with one onboard NIC (1000BaseT) and 2x additional 1000BaseT PCI NICs. The Onboard NIC is the connection to the main network (and internet), and the other two should share the same IP address, (acting like a transparent network switch) and are used for LTSP clients.

some links on bridging
http://www.adamsinfo.com/brctl-creating-a-network-bridge/
http://ubuntuforums.org/archive/index.php/t-132515.html
https://help.ubuntu.com/10.04/serverguide/C/network-configuration.html
http://ubuntuforums.org/showthread.php?t=31632
bridge stuff – near end of page
https://help.ubuntu.com/10.04/serverguide/C/network-configuration.html
section “4.4.3. Both Wired and Wireless”
https://help.ubuntu.com/community/Route
http://aaronwball.blogspot.com/2010/05/ubuntu-bridging-network-interfaces.html

Result
Pretty simple really, just install bridge-utils

 aptitude install bridge-utils

added an auto br0 to /etc/network/interfaces

sudo nano /etc/network/interfaces 

Modify the interfaces configuration:

/etc/network/interfaces                                    

# 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

# The primary network interface
# In my case eth0 is managed by Ubuntu's network manager so no need
# to give it any other parameters
auto eth0
#iface eth0 inet dhcp

# Don't need to do anything yet with eth1 as the bridge will bring this up
# This is the configuration before the bridge was set up (now commented)
#auto eth1
#iface eth1 inet static    * LTSPServerSetup

#    address 192.168.0.254
#    netmask 255.255.255.0
#    network 192.168.0.0
#    broadcast 192.168.0.255

# eth2 is the 3rd network card, and the second part of the bridge
# no need to bring this up either - the bridge will do that
#auto eth2

# Here is the bridge configuration.  br0 is the bridge interface (not a physical card)
# it ties together eth1 and eth2 and gives them a static IP address etc
auto br0
iface br0 inet static
	address 192.168.0.254
	netmask 255.255.255.0
	network 192.168.0.0
	broadcast 192.168.0.255
	bridge_ports eth1 eth2

Other notes

Don’t forget to restart networking once set up – rebooting not necessary.

sudo /etc/init.d/networking restart

For LTSP, once the interface has changed, LTSP will likely not let a client connect until you recreate the ssh keys. from the LTSP server page:
“If you change the IP data after you have done the initial setup, please run the command:

sudo ltsp-update-sshkeys 

to make the ssh server aware of the change.” This worked for me (the client wouldn’t connect before this change).

If you need to restart the dhcp server for some reason:

sudo /etc/init.d/dhcp3-server restart 

Other if config items for a bridge
Some suggested config options – I haven’t investigated what any of them do…

auto br0
iface br0 inet static
		address 192.168.0.10
		network 192.168.0.0
		netmask 255.255.255.0
		broadcast 192.168.0.255
		gateway 192.168.0.1
		bridge_ports eth0
		bridge_fd 9
		bridge_hello 2
		bridge_maxage 12
		bridge_stp off

Links to the LTSP notes I used

(although LTSP with Ubuntu 10.10 alternate CD is simple, and solves all the issues I had with LTSP setup 5 years back)

LTSP Server Setup
https://help.ubuntu.com/community/LTSPServerSetup
Thin Client How-To NAT
https://help.ubuntu.com/community/UbuntuLTSP/ThinClientHowtoNAT

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment