Linux绑定网卡

 

1.ethtool ethX #查询网卡的信息,确定要绑定的网卡

 

Settings for eth0:
 Supported ports: [ FIBRE ]
 Supported link modes:   10000baseT/Full
 Supported pause frame use: No
 Supports auto-negotiation: No
 Advertised link modes:  10000baseT/Full
 Advertised pause frame use: No
 Advertised auto-negotiation: No
 Speed: 10000Mb/s
 Duplex: Full
 Port: Other
 PHYAD: 0
 Transceiver: external
 Auto-negotiation: off
 Supports Wake-on: d
 Wake-on: d
 Current message level: 0x00000007 (7)
          drv probe link
 Link detected: no
 
Settings for eth2:
 Supported ports: [ TP ]
 Supported link modes:   1000baseT/Full
                         10000baseT/Full
 Supported pause frame use: Symmetric
 Supports auto-negotiation: Yes
 Advertised link modes:  1000baseT/Full
 Advertised pause frame use: No
 Advertised auto-negotiation: Yes
 Speed: 1000Mb/s
 Duplex: Full
 Port: Twisted Pair
 PHYAD: 0
 Transceiver: external
 Auto-negotiation: on
 MDI-X: Unknown
 Supports Wake-on: g
 Wake-on: g
 Current message level: 0x0000000f (15)
          drv probe link timer
 Link detected: yes

 


2.我要绑定的是普通的网卡(eth2,eth3),建立绑定网卡,编辑原来的网卡配置文件
##建立bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0

 

DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.38.3.X
NETMASK=255.255.255.0
GATEWAY=10.38.3.X
DNS1=X.X.X.X
USERCTL=no
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"

 

#编辑eth2和 eth3

 

[root@KSEDI-02 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
#TYPE=Ethernet

USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
#NM_CONTROLLED=yes
BOOTPROTO=none

 

vim /etc/sysconfig/network-scripts/ifcfg-eth3

 

DEVICE=eth3
#TYPE=Ethernet
USERCTL=no
ONBOOT=no
MASTER=bond0
SLAVE=yes
#NM_CONTROLLED=yes
BOOTPROTO=none

 

#创建配置文件
vim /etc/modprobe.conf


alias bond0 bonding
options bond0 miimon=100 mode=1

 

#编辑添加开机自动执行
vim /etc/rc.d/rc.local
#添加到最后
ifenslave bond0 eth2 eth3

 

3.网卡测试
ifconfig eth2 down
ifconfig eth2 up
ifconfig eth3 down
ifconfig eth3 up

 

 

 

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值