RHCE作业

一,在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作

1、添加两块虚拟网卡

2、连接会话
[root@chenxudong ~]# nmcli device connect ens224
Device 'ens224' successfully activated with '39bef2c8-fc11-4059-84b9-679bfb13719a'.
[root@chenxudong~]# nmcli device connect ens256
Device 'ens256' successfully activated with 'b27b5e56-6c3c-4dc8-9f95-5c0a924fa971'.
[root@chenxudong ~]# nmcli device status 
DEVICE      TYPE      STATE      CONNECTION 
ens160      ethernet  connected  ens160     
ens224      ethernet  connected  ens224     
ens256      ethernet  connected  ens256     
virbr0      bridge    connected  virbr0     
lo          loopback  unmanaged  --         
virbr0-nic  tun       unmanaged  --        
5: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:79:d6:07 brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.131/24 brd 192.168.225.255 scope global dynamic noprefixroute ens256
       valid_lft 1764sec preferred_lft 1764sec
    inet6 fe80::2b84:62ab:7ee7:12f2/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
6: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:79:d6:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.130/24 brd 192.168.225.255 scope global dynamic noprefixroute ens224
       valid_lft 1758sec preferred_lft 1758sec
    inet6 fe80::81f0:cc46:b792:268a/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3、创建 team0 设备和 team0 会话
[root@chenxudong ~]# nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name": "activebackup"}}'
[root@chenxudong  doc]# cd /usr/share/doc/teamd/example_configs/
[root@chenxudong example_configs]# ll
total 64
-rw-r--r--. 1 root root 305 Jul 26  2020 activebackup_arp_ping_1.conf
-rw-r--r--. 1 root root 465 Jul 26  2020 activebackup_arp_ping_2.conf
-rw-r--r--. 1 root root 194 Jul 26  2020 activebackup_ethtool_1.conf
-rw-r--r--. 1 root root 212 Jul 26  2020 activebackup_ethtool_2.conf
-rw-r--r--. 1 root root 241 Jul 26  2020 activebackup_ethtool_3.conf
-rw-r--r--. 1 root root 447 Jul 26  2020 activebackup_multi_lw_1.conf
-rw-r--r--. 1 root root 285 Jul 26  2020 activebackup_nsna_ping_1.conf
-rw-r--r--. 1 root root 318 Jul 26  2020 activebackup_tipc.conf
-rw-r--r--. 1 root root  96 Jul 26  2020 broadcast.conf
-rw-r--r--. 1 root root 209 Jul 26  2020 lacp_1.conf
-rw-r--r--. 1 root root  98 Jul 26  2020 loadbalance_1.conf
-rw-r--r--. 1 root root 140 Jul 26  2020 loadbalance_2.conf
-rw-r--r--. 1 root root 183 Jul 26  2020 loadbalance_3.conf
-rw-r--r--. 1 root root  93 Jul 26  2020 random.conf
-rw-r--r--. 1 root root 244 Jul 26  2020 roundrobin_2.conf
-rw-r--r--. 1 root root  97 Jul 26  2020 roundrobin.conf

[root@chenxudong example_configs]# more activebackup_arp_ping_2.conf 
{
    "device":    "team0",
    "runner":    {"name": "activebackup"},
    "link_watch":    {
        "name": "arp_ping",
        "interval": 100,
        "missed_max": 30,
        "source_host": "192.168.23.2",
        "target_host": "192.168.23.1"
    },
    "ports":    {
        "eth1": {
            "prio": -10,
            "sticky": true
        },

4、向team0中添加从设备(ens224、256)
[root@chenxudong ~]# nmcli connection add type team-slave ifname ens224 con-name team0-port1 master team0
Connection 'team0-port1' (3c198f30-556c-407d-8a58-1c7e123b4791) successfully added.
[root@chenxudong~]# nmcli connection add type team-slave ifname ens256 con-name team0-port2 master team0
Connection 'team0-port2' (cd8f75d6-e16a-402e-a651-a8d964683282) successfully added.
如果没有 team-slave 就输出 ethernet

ip a 查看到 team0 是未开启状态

7: team0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 6e:c2:f8:66:cf:70 brd ff:ff:ff:ff:ff:ff
5、先激活 team0-port1、team0-port2 从设备,再激活 team0 主设备
[root@chenxudong~]# nmcli connection up team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)
[root@chenxudong ~]# nmcli connection up team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
[root@chenxudong~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)
[root@chenxudong ~]# nmcli connection sh 
ens160       f667da4f-915c-4c68-ba16-2211ac796d6a  ethernet  ens160 
team0        597c5007-56ea-402b-9768-48ea445f47c4  team      team0  
virbr0       82441c83-895c-46c2-add3-a9b378921af6  bridge    virbr0 
team0-port1  3c198f30-556c-407d-8a58-1c7e123b4791  ethernet  ens224 
team0-port2  cd8f75d6-e16a-402e-a651-a8d964683282  ethernet  ens256 
ens224       39bef2c8-fc11-4059-84b9-679bfb13719a  ethernet  --     
ens256       b27b5e56-6c3c-4dc8-9f95-5c0a924fa971  ethernet  --     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值