设置linux中bond网络,linux之高级网络配置——bond、team网络的配置

高级网络配置html

1、bond网络

Bond 网络

Red Hat Enterprise Linux 容许管理员使用,bonding内核模块合称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式,通道绑定使两个或更多个网络接口做为一个网络接口,从而增长带宽和/提供冗余性。

选择linux以太网绑定模式

模式0(平衡轮循)-轮循策略,全部接口都采用轮循方式在全部Slave(从盘)中传输封包;任何Slave均可以接收。

模式1(主动备份)-容错。一次只能使用一个Slave接口,可是若是接口出现故障,另外一个Slave将接替它。

模式3(广播)-容错。全部封包都经过全部Slave接口广播。

实验一:网卡模式一(主动备份)

1.为虚拟机添加一个网卡

2.[root@localhost ~]# nmcli connection delete eth0 #删除网卡的配置信息

3.[root@localhost ~]# nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.126/24 #新建以一个bond网络

4.[root@localhost ~]# watch -n 1 cat /proc/net/bonding/bond0 #监控命令

5.[root@localhost ~]# ping 172.25.254.26

PING 172.25.254.26 (172.25.254.26) 56(84) bytes of data.

#失败,由于还为设置网卡

6.[root@localhost ~]# nmcli connection add con-name eht0 ifname eth0 type bond-slave master bond0

7.[root@localhost ~]# nmcli connection add con-name eht1 ifname eth1 type bond-slave master bond0 #为bond设置两个网卡为其工做。

8.[root@localhost ~]# ping 172.25.254.26 #成功

PING 172.25.254.26 (172.25.254.26) 56(84) bytes of data.

64 bytes from 172.25.254.26: icmp_seq=1 ttl=64 time=0.099 ms

64 bytes from 172.25.254.26: icmp_seq=2 ttl=64 time=0.105 ms

64 bytes from 172.25.254.26: icmp_seq=3 ttl=64 time=0.126 ms

27561f317239474c22b593cd5e054ac4.png

7df40284ed6588fd4eedc78ccfcb3234.png

563e2bb3546c77eae4dd90bd09e74e92.png

bb8a9958b078b0d4c60f156ff47b3084.png

f041f738b7d9898dc6cb77529cf48278.png

c26e51564e7118d41a1efce7548c97f2.png

ba0115f5aea87eecb2faf6499807df3f.png

66878e1875746f315419727115483721.png

98478599e4a5d58576392febcc77c3c8.png

8d3a024c86c267a1dc220ba5731a65f8.png

2c3460b80ec905f40b58f3d9b0275556.png

adecaaba55b2e65721acc17af70b9a1a.png

111df2e32c3587f10d70ebc123e0e2e9.png

2、Team网络接口linux

Team 和 bond0 功能相似

Team 不须要手动加载相应内核模块

Team 有更强的扩展性

支持8块网卡,企业七以前没有这个功能

平衡轮叫比较机械

负载均衡是将任务平衡分配

[root@localhost Desktop]# watch -n 1 'teamdctl team0 stat' #监控命令

[root@localhost Desktop]# nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.126/24 #添加一个team网络。

Connection 'team0' (825e8e72-f445-4cb5-aa68-7aa593d51497) successfully added.

[root@localhost Desktop]# ifconfig

eth0: flags=4163 mtu 1500

ether 52:54:00:00:47:0a txqueuelen 1000 (Ethernet)

RX packets 79 bytes 5489 (5.3 KiB)

RX errors 0 dropped 37 overruns 0 frame 0

TX packets 442 bytes 21223 (20.7 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163 mtu 1500

ether 52:54:00:48:56:5a txqueuelen 1000 (Ethernet)

RX packets 473 bytes 23963 (23.4 KiB)

RX errors 0 dropped 423 overruns 0 frame 0

TX packets 36 bytes 1624 (1.5 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

inet6 ::1 prefixlen 128 scopeid 0x10

loop txqueuelen 0 (Local Loopback)

RX packets 348 bytes 34336 (33.5 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 348 bytes 34336 (33.5 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

team0: flags=4099 mtu 1500

inet 172.25.254.126 netmask 255.255.255.0 broadcast 172.25.254.255

ether aa:5a:48:1d:7e:65 txqueuelen 0 (Ethernet)

RX packets 0 bytes 0 (0.0 B)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 0 bytes 0 (0.0 B)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@localhost Desktop]# nmcli connection add con-name eth0 ifname eth0 type team-slave master team0

Connection 'eth0' (4c2668fa-f942-4c9a-83a0-7a0c776b1722) successfully added. #添加eth0为team服务

[root@localhost Desktop]# nmcli connection add con-name eth1 ifname eth1 type team-slave master team0

Connection 'eth1' (bc45902b-a912-4d96-92b0-cb827567e9d6) successfully added.#添加eth1为team服务

##监控##

Every 1.0s: teamdctl team0 stat Wed May 23 15:20:45 2018

setup:

runner: activebackup

ports:

eth0

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

eth1

link watches:

link summary: up

instance[link_watch_0]:

name: ethtool

link: up

runner:

active port: eth0

d1049ed8a6df03339930f5c8e9321de0.png

60081956e82829c835107d56e84193b4.png

058daaada12a0410e863538768cec607.png

67aa69943aea3003c420b182b50e7b5e.png

8533fbc2e53f9b17b6f244331ef21bba.png

58cb65ccd39b5e7ec7c158ee423205e5.png

393d77306ca4b3668d8eb7a1918d10e6.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值