Cook Book
Configure your linux box as a switch:
Step zero: You need to plug more than one NIC cards. You can configure your linux box as switch with only one NIC card. But it doesn't make sense for your switch with one port.
Step one: You need to download and install bridge software: bridge-utils-0.9.3.tar.gz
Step two: You need to recompile your kernel to include this network option: 802.1d Ethernet Bridging
Step three: Setup your bridge.
After you install bridge-utils, you will have "brctl" application.
# brctl
commands:
addbr
<bridge>
add bridge
addif
<bridge> <device> add interface to bridge
delbr
<bridge>
delete bridge
delif
<bridge> <device> delete interface from
bridge
show
show a list of bridges
showbr
<bridge>
show bridge info
showmacs <bridge>
show a list of mac addrs
setageing <bridge> <time>
set ageing time
setbridgeprio <bridge> <prio>
set bridge priority
setfd
<bridge> <time> set bridge
forward delay
setgcint <bridge>
<time> set garbage collection
interval
sethello <bridge>
<time> set hello time
setmaxage <bridge> <time>
set max message age
setpathcost <bridge> <port> <cost>
set path cost
setportprio <bridge> <port> <prio>
set port priority
stp
<bridge> <state> {dis,en}able stp
root@mbb-1:~ # brctl addbr mybridge |
root@mbb-1:~ # brctl addif mybridge eth0 root@mbb-1:~ # brctl addif mybridge eth1 |
root@mbb-1:~ # ifconfig eth0 0.0.0.0 root@mbb-1:~ # ifconfig eth1 0.0.0.0 |
root@mbb-1:~ # ifconfig mybridge up |
root@mbb-1:~ # ifconfig mybridge 192.168.100.5 netmask 255.255.255.0 up |