1.雙網卡綁定2. 雙網卡綁定的設定檔
/etc/sysconfig/network-scripts/ifcfg-bond0DEVICE="bond0"BOOTPROTO="static"ONBOOT="yes"TYPE="ethernet"IPADDR=x.x.x.xNETMASK=255.255.255.0BONDING_OPTS="miimon=100 mode=1 updelay=600000 primary=eth0" #100ms 健康檢測 #mode=1 是主備模式 #primary=eth0 #預設active 是eth0
/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth1
2. 千兆網卡,突然變成10Mbps 或者100Mbps(1) proc/net/bonding/bond0 資訊查看
這個資訊是linux啟動後載入的硬體網卡資訊
cat /proc/net/bonding/bond0 #查看雙網卡資訊Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)Bonding Mode: fault-tolerance (active-backup)Primary Slave: eth0 (primary_reselect always) #預設active 是eth0Currently Active Slave: eth1MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 600000Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 Mbps #有時會突然變成10M/sDuplex: fullLink Failure Count: 0Permanent HW addr: xxxxSlave queue ID: 0Slave Interface: eth1MII Status: upSpeed: 10 Mbps # 為什麼突然變成10M/sDuplex: fullLink Failure Count: 2Permanent HW addr: xxxxxSlave queue ID: 0
(2). ethtool 工具來看
sudo ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full #支援10M 半全雙工系統 100baseT/Half 100baseT/Full #支援100M 半 全雙工系統 1000baseT/Full #支援1000M 全雙工系統 Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s #現在是100Mbps 實際網卡支援1000Mbps 所以網卡其實浪費了,有時網卡打滿會出問題啊 Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) Link detected: yes
(3) . ethtool 修改speed
sudo ethtool -s eth0 speed 1000 #eth0 的speed 修改成1000sudo ethtool eth0 #查看修改是否成功,此時/proc/net/bonding/bond0 還是沒有修改的sudo /etc/init.d/network restart #重啟網卡vim /proc/net/bonding/bond0 #此時 /proc/net/bonding/bond0 就修改成1000 啦