先用2張網卡 組合出一台bridge 再說:
ifconfig eth1 0.0.0.0
ifconfig eth2 0.0.0.0
brctl addbr br0
brctl addif br0 eth1
brctl addif br0 eth2
此時 橋接器 br0 已經完成
在 /sys/class/net/br0/bridge/ 目錄下有這些檔案
ageing_time group_addr root_id topology_change
bridge_id hello_time root_path_cost topology_change_detected
flush hello_timer root_port topology_change_timer
forward_delay max_age stp_state
gc_timer priority tcn_timer
這些檔案和 STP 協定有關
如果想要強制清除 MAC Address table
只要動此檔案
/sys/class/net/br0/bridge/flush
所以
先打 brctl showmacs br0
root@switch-master:/sys/class/net/br0/bridge# brctl showmacs br0
port no mac addr is local? ageing timer
1 00:01:53:81:c5:3e no 270.57
1 00:01:53:81:fa:de no 53.61
1 00:01:53:82:0a:d7 no 1.47
2 00:01:53:82:18:41 yes 0.00
1 00:01:53:82:2f:a8 yes 0.00
成為 root
echo "1" > /sys/class/net/br0/bridge/flush
在看看 mac address table 的變化
root@switch-master:/sys/class/net/br0/bridge# brctl showmacs br0
port no mac addr is local? ageing timer
2 00:01:53:82:18:41 yes 0.00
1 00:01:53:82:2f:a8 yes 0.00
哈哈, 清掉了
2008年2月12日 星期二
[原創] Linux Bridge 下 清除 MAC Address Table
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言