User Tools

Site Tools


wikiv3:bonding-centos7

Bonding CentOS 7 - nmcli

Indificando as interfaces

[root@centos ~]# nmcli connect show
NOME               UUID                                  TIPO            DISPOSITIVO 
Conexão cabeada 1  539e96e1-f43e-4416-aa34-0f03516f7fd7  802-3-ethernet  eth1        
eth0               3b7ef3e5-f255-4ee7-96f5-da7189d74b4d  802-3-ethernet  eth0        
Conexão cabeada 2  81e30c41-da8d-4a5b-a4e3-b4553508ac3b  802-3-ethernet  eth2    

Remover as configurações existentes nas interfaces a serem usadas - eth1 e eth2

[root@centos ~]# nmcli connect del 539e96e1-f43e-4416-aa34-0f03516f7fd7
Connection 'Conexão cabeada 1' (539e96e1-f43e-4416-aa34-0f03516f7fd7) successfully deleted.
[root@centos ~]# nmcli connect del 81e30c41-da8d-4a5b-a4e3-b4553508ac3b
Connection 'Conexão cabeada 2' (81e30c41-da8d-4a5b-a4e3-b4553508ac3b) successfully deleted.

Criando a interface bonding

[root@centos ~]# nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
A conexão "bond0" (267c030a-01bc-4dfa-b5b6-2e9c5bf34bbf) foi adicionada com sucesso.

Configuração da rede

[root@centos ~]# nmcli con mod bond0 ipv4.addresses 192.0.2.58/24
[root@centos ~]# nmcli con mod bond0 ipv4.gateway 192.0.2.1
[root@centos ~]# nmcli con mod bond0 ipv4.method manual
[root@centos ~]# nmcli con mod bond0 ipv4.dns 192.0.2.200 ipv4.dns-search exemplo.org

Adicionando a interface eth1 para a interface bonding:

[root@centos ~]# nmcli con add type bond-slave con-name eth1 ifname eth1 master bond0
A conexão "eth1" (dfb24655-ce58-49d0-99e8-d376cfd9333c) foi adicionada com sucesso.

Adicionando a interface eth1 para a interface bonding

[root@centos ~]# nmcli con add type bond-slave con-name eth2 ifname eth2 master bond0
A conexão "eth2" (47b11bdb-fed4-41ce-b30e-a4ac1b86b9af) foi adicionada com sucesso.

Checando as configurações:

[root@centos ~]# ip addr show eth1
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
    link/ether 52:54:00:55:d1:f9 brd ff:ff:ff:ff:ff:ff
[root@centos ~]# ip addr show eth2
5: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
    link/ether 52:54:00:55:d1:f9 brd ff:ff:ff:ff:ff:ff
[root@centos ~]# ip addr show bond0
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether 52:54:00:55:d1:f9 brd ff:ff:ff:ff:ff:ff
    inet 192.0.2.58/24 brd 192.0.2.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 2001:db8::5054:ff:fe55:d1f9/64 scope global noprefixroute dynamic 
       valid_lft 3435sec preferred_lft 3435sec
    inet6 fe80::5054:ff:fe55:d1f9/64 scope link 
       valid_lft forever preferred_lft forever
[root@centos ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=bond0
UUID=267c030a-01bc-4dfa-b5b6-2e9c5bf34bbf
ONBOOT=yes
BONDING_OPTS=mode=active-backup
IPADDR=192.0.2.58
PREFIX=24
GATEWAY=192.0.2.1
DNS1=192.0.2.200
DOMAIN=exemplo.org
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[root@centos ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 
TYPE=Ethernet
NAME=eth1
UUID=dfb24655-ce58-49d0-99e8-d376cfd9333c
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@centos ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
TYPE=Ethernet
NAME=eth2
UUID=47b11bdb-fed4-41ce-b30e-a4ac1b86b9af
DEVICE=eth2
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@centos ~]# nmcli connect show bond0
connection.id:                          bond0
connection.uuid:                        267c030a-01bc-4dfa-b5b6-2e9c5bf34bbf
connection.interface-name:              bond0
connection.type:                        bond
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.timestamp:                   1454633078
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     desconhecido
ipv4.method:                            manual
ipv4.dns:                               192.0.2.200
ipv4.dns-search:                        exemplo.org
ipv4.addresses:                         192.0.2.58/24
ipv4.gateway:                           192.0.2.1
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (desconhecido)
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
bond.options:                           mode=active-backup
GENERAL.NOME:                           bond0
GENERAL.UUID:                           267c030a-01bc-4dfa-b5b6-2e9c5bf34bbf
GENERAL.DISPOSITIVOS:                   bond0
GENERAL.ESTADO:                         ativado
GENERAL.PADRÃO:                         não
GENERAL.PADRÃO6:                        sim
GENERAL.VPN:                            não
GENERAL.ZONA:                           --
GENERAL.CAMINHO DBUS:                   /org/freedesktop/NetworkManager/ActiveConnection/4
GENERAL.CAMINHO CON:                    /org/freedesktop/NetworkManager/Settings/4
GENERAL.OBJETO-ESPEC.:                  /
GENERAL.CAMINHO PRINCIPAL:              --
IP4.ENDEREÇO[1]:                        192.0.2.58/24
IP4.MÁQUINA:                            192.0.2.1
IP4.DNS[1]:                             192.0.2.200
IP6.ENDEREÇO[1]:                        2001:db8::5054:ff:fe55:d1f9/64
IP6.ENDEREÇO[2]:                        fe80::5054:ff:fe55:d1f9/64
IP6.MÁQUINA:                            fe80::5054:ff:feb4:1508
IP6.ROTA[1]:                            dst = 2001:db8::/64, nh = ::, mt = 300
IP6.DNS[1]:                             fe80::5054:ff:feb4:1508
[root@centos ~]# nmcli connect show eth1
connection.id:                          eth1
connection.uuid:                        dfb24655-ce58-49d0-99e8-d376cfd9333c
connection.interface-name:              eth1
connection.type:                        802-3-ethernet
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.timestamp:                   1454633078
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      bond0
connection.slave-type:                  bond
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     desconhecido
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          yes
802-3-ethernet.mac-address:             --
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.mac-address-blacklist:   
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            
802-3-ethernet.wake-on-lan:             1 (default)
802-3-ethernet.wake-on-lan-password:    --
GENERAL.NOME:                           eth1
GENERAL.UUID:                           dfb24655-ce58-49d0-99e8-d376cfd9333c
GENERAL.DISPOSITIVOS:                   eth1
GENERAL.ESTADO:                         ativado
GENERAL.PADRÃO:                         não
GENERAL.PADRÃO6:                        não
GENERAL.VPN:                            não
GENERAL.ZONA:                           --
GENERAL.CAMINHO DBUS:                   /org/freedesktop/NetworkManager/ActiveConnection/5
GENERAL.CAMINHO CON:                    /org/freedesktop/NetworkManager/Settings/5
GENERAL.OBJETO-ESPEC.:                  /
GENERAL.CAMINHO PRINCIPAL:              /org/freedesktop/NetworkManager/Devices/5
IP4.MÁQUINA:                            
IP6.MÁQUINA:                            
[root@centos ~]# nmcli connect show eth2
connection.id:                          eth2
connection.uuid:                        47b11bdb-fed4-41ce-b30e-a4ac1b86b9af
connection.interface-name:              eth2
connection.type:                        802-3-ethernet
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.timestamp:                   1454633078
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      bond0
connection.slave-type:                  bond
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     desconhecido
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          yes
802-3-ethernet.mac-address:             --
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.mac-address-blacklist:   
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            
802-3-ethernet.wake-on-lan:             1 (default)
802-3-ethernet.wake-on-lan-password:    --
GENERAL.NOME:                           eth2
GENERAL.UUID:                           47b11bdb-fed4-41ce-b30e-a4ac1b86b9af
GENERAL.DISPOSITIVOS:                   eth2
GENERAL.ESTADO:                         ativado
GENERAL.PADRÃO:                         não
GENERAL.PADRÃO6:                        não
GENERAL.VPN:                            não
GENERAL.ZONA:                           --
GENERAL.CAMINHO DBUS:                   /org/freedesktop/NetworkManager/ActiveConnection/6
GENERAL.CAMINHO CON:                    /org/freedesktop/NetworkManager/Settings/6
GENERAL.OBJETO-ESPEC.:                  /
GENERAL.CAMINHO PRINCIPAL:              /org/freedesktop/NetworkManager/Devices/5
IP4.MÁQUINA:                            
IP6.MÁQUINA:                            
[root@centos ~]# ping -c3 192.0.2.58
PING 192.0.2.58 (192.0.2.58) 56(84) bytes of data.
64 bytes from 192.0.2.58: icmp_seq=1 ttl=64 time=0.012 ms
64 bytes from 192.0.2.58: icmp_seq=2 ttl=64 time=0.025 ms
64 bytes from 192.0.2.58: icmp_seq=3 ttl=64 time=0.028 ms
 
--- 192.0.2.58 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.012/0.021/0.028/0.008 ms
[root@centos ~]# cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
 
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
 
Slave Interface: eth1
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:55:d1:f9
Slave queue ID: 0
 
Slave Interface: eth2
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:0c:81:57
Slave queue ID: 0

Referências:

wikiv3/bonding-centos7.txt · Last modified: by 127.0.0.1