Linux双网卡绑定一个IP

来源:互联网 发布:阿里云短信 app code 编辑:程序博客网 时间:2024/06/11 02:41
 

1.新建/etc/sysconfig/network-scripts/ifcfg-bond0文件
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.128.225
NETMASK=255.255.255.224
GATEWAY=192.168.128.233
USERCTL=no

2.更改/etc/sysconfig/network-scripts/ifcfg-eth0网卡属性

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no

3.更改/etc/sysconfig/network-scripts/ifcfg-eth1网卡的属性
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
USERCTL=no

4.编辑/etc/modprobe.conf文件,加入以下内容
alias bond0 bonding
options bond0 miimon=100 mode=0

5.加入/etc/rc.d/rc.local启动项
ifenslave bond0 eth0 eth1

6.启动网卡
ifconfig bond0 192.168.128.225 up
ifenslave bond0 eth0 eth1

注:完成以上步骤一定要重启计算机,由于bonding需要加载驱动,本环境在CentOS4.5测试通

原创粉丝点击