linux7多网卡负载均衡,Centos7 多网卡绑定实现负载均衡

#查看bonding模块是否加载

lsmod | grep bonding

bonding 136705 0

#如果没有加载,手动先加载

modprobe bonding

#在/etc/sysconfig/network-scripts目录下配置ens33,ens37,bond0三个网卡接口,bond0是抽象网卡

[root@wangguan network-scripts]# cat ifcfg-enp5s0

TYPE=Ethernet

BOOTPROTO=none

DEVICE=enp5s0

ONBOOT=yes

USERCTL=no

MASTER=bond0

SLAVE=yes

BONDING_MASTER=yes

[root@wangguan network-scripts]# cat ifcfg-enp8s0

TYPE=Ethernet

BOOTPROTO=none

DEVICE=enp8s0

ONBOOT=yes

USERCTL=no

MASTER=bond0

SLAVE=yes

BONDING_MASTER=yes

#实际是把原来网卡1的ip配置放入了bond0里

[root@wangguan network-scripts]# cat ifcfg-bond0

TYPE=Bond

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

ZONE=public

IPADDR=192.168.2.205

NETMASK=255.255.255.0

USERCTL=no

NM_CONTROLLED=no

BONDING_MASTER=yes

BONDING_OPTS="mode=6 miimon=100"

重启网络systemctl restart network,如果原来network就没启动,那么使用systemctl start network

#enp5s0和enp8s0应该是没有配置IP的

[root@wangguan network-scripts]# ip a

1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: enp1s0: mtu 1500 qdisc mq state UP qlen 1000

link/ether 00:90:27:e3:02:de brd ff:ff:ff:ff:ff:ff

inet 192.168.1.153/24 brd 192.168.1.255 scope global enp1s0

valid_lft forever preferred_lft forever

3: enp5s0: mtu 1500 qdisc mq master bond0 state DOWN qlen 1000

link/ether 00:90:27:e3:02:df brd ff:ff:ff:ff:ff:ff

4: enp7s0: mtu 1500 qdisc mq state DOWN qlen 1000

link/ether 00:90:27:e3:02:e0 brd ff:ff:ff:ff:ff:ff

inet6 2408:8207:2530:5e30:290:27ff:fee3:2e0/64 scope global mngtmpaddr dynamic

valid_lft 245372sec preferred_lft 158972sec

inet6 fe80::290:27ff:fee3:2e0/64 scope link

valid_lft forever preferred_lft forever

5: enp8s0: mtu 1500 qdisc mq master bond0 state DOWN qlen 1000

link/ether 00:90:27:e3:02:e1 brd ff:ff:ff:ff:ff:ff

6: enp11s0: mtu 1500 qdisc mq state DOWN qlen 1000

link/ether 00:90:27:e3:02:e2 brd ff:ff:ff:ff:ff:ff

inet6 2408:8207:2530:5e30:290:27ff:fee3:2e2/64 scope global mngtmpaddr dynamic

valid_lft 245371sec preferred_lft 158971sec

inet6 fe80::290:27ff:fee3:2e2/64 scope link

valid_lft forever preferred_lft forever

7: enp12s0: mtu 1500 qdisc mq state DOWN qlen 1000

link/ether 00:90:27:e3:02:e3 brd ff:ff:ff:ff:ff:ff

inet6 2408:8207:2530:5e30:290:27ff:fee3:2e3/64 scope global mngtmpaddr dynamic

valid_lft 245372sec preferred_lft 158972sec

inet6 fe80::290:27ff:fee3:2e3/64 scope link

valid_lft forever preferred_lft forever

8: virbr0: mtu 1500 qdisc noqueue state DOWN qlen 1000

link/ether 52:54:00:9d:d6:e0 brd ff:ff:ff:ff:ff:ff

inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0

valid_lft forever preferred_lft forever

9: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000

link/ether 52:54:00:9d:d6:e0 brd ff:ff:ff:ff:ff:ff

10: bond0: mtu 1500 qdisc noqueue state DOWN qlen 1000

link/ether 00:90:27:e3:02:df brd ff:ff:ff:ff:ff:ff

inet 192.168.2.205/24 brd 192.168.2.255 scope global bond0

valid_lft forever preferred_lft forever

inet6 fe80::290:27ff:fee3:2df/64 scope link

valid_lft forever preferred_lft forever

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值