Linux bridge基本命令可以先試試
特別值得一提的是Linux bridge有很多值得學(xué)習(xí)的地方,這里我們主要介紹Linux bridge,包括介紹Linux bridge等方面。Linux bridge 下流量控制等 (Netemulator,tc)
netem provides Network Emulation functionality for testing protocols by emulating the properties of wide area networks. The current version emulates variable delay, loss, duplication and re-ordering.
If you run a current 2.6 distribution, (Fedora, OpenSuse, Gentoo, Debian, Mandriva, Ubuntu), then netem is already enabled in the kernel and a current version of iproute2 is included. The netem kernel component is enabled under:
Networking --> Networking Options --> QoS and/or fair queuing --> Network emulator
端口延時命令
# tc qdisc add dev eth0 root netem delay 100ms表示對端口廷時100ms# tc qdisc del dev eth0 root netem delya 100ms表示對端口廷時命令刪除
# tc qdisc change dev eth0 root netem delay 100ms 10ms表示對改變端口廷時命100ms ± 10ms 延時范圍(90到110)# tc qdisc change dev eth0 root netem delay 100ms 10ms 25%表示廷時范圍100ms ± 10ms * 25%
端口丟包命令:# tc qdisc change dev eth0 root netem loss 0.1%丟包率為0。1%# tc qdisc change dev eth0 root netem loss 0.3% 25%丟包率為范圍(0。3% 25%)[edit][ed數(shù)據(jù)包副本命令# tc qdisc change dev eth0 root netem duplicate 1%
數(shù)據(jù)包副本率 1%[edit] [edi數(shù)據(jù)包分發(fā)命令# tc qdisc change dev eth0 root netem gap 5 delay 10ms數(shù)據(jù)包重發(fā)每格5的整數(shù)倍的包將不被延時。其它的將延時10ms
[edit] 速率控制命令:兩條命令共同完成
- # tc qdisc add dev eth0 root handle 1:0 netem delay 100ms
- # tc qdisc add dev eth0 parent 1:1 handle 10: tbf rate 256kbit buffer 1600 limit 3000
- # tc -s qdisc ls dev eth0 ----查看規(guī)則信息。
- # tc qdisc show
更多幫助# tc help , tc qdisc help以上是建立速率控制命令規(guī)則。Linux bridge紅色部分為限制包數(shù)量可去掉清除規(guī)則命令:tc qdisc del dev eth0 root
完畢后可以先試試Linux bridge的基本命令:(這是可以把此主機(jī)看到兩個端口的HUB )
- brctl addbr mybridge (創(chuàng)建bridge mybridge,然后用ifconfig查看會發(fā)現(xiàn)多了一個mybridge端口)
- brctl addif mybridge eth0
- brctl addif mybridge eth1 (把eth0和eth1包含到mybridge中)
然后需要對各端口做以下動作
- ifconfig eth0 0.0.0.0 promisc
- ifconfig eth1 0.0.0.0 promisc(打開混雜模式)
- ifconfig mybridge up(啟動網(wǎng)橋)
【編輯推薦】