OEL 7: Alterar nome de interface de rede

Ao instalar o Oracle RAC, as interfaces de rede devem ter o mesmo nome em todos os nós. Por exemplo, se a interface pública tem o nome eth0 em um nó, tem que ter este mesmo nome em todos os outros nós.

No OEL 7 (e RHEL / CentOS) o padrão de nomes de interfaces de rede mudou (aliás, o que não mudou no OEL 7…).

No exemplo abaixo, eu preciso alterar a interface de enp2s2 para enp2s1, como está no outro nó.

[root@nerv01 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    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: enp2s2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether d8:5d:4c:80:39:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.101/24 brd 192.168.1.255 scope global enp2s2
       valid_lft forever preferred_lft forever
    inet6 fe80::da5d:4cff:fe80:3908/64 scope link
       valid_lft forever preferred_lft forever
3: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:11:f0:5d:1b brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.101/24 brd 192.168.0.255 scope global ens32
       valid_lft forever preferred_lft forever
    inet6 2804:14c:85:87f8:225:11ff:fef0:5d1b/64 scope global mngtmpaddr dynamic
       valid_lft 604787sec preferred_lft 86387sec
    inet6 fe80::225:11ff:fef0:5d1b/64 scope link
       valid_lft forever preferred_lft forever
[root@nerv01 ~]#

Execute os comandos abaixo para trocar o nome da interface.

[root@nerv01 ~]# /sbin/ip link set enp2s2 down
[root@nerv01 ~]# /sbin/ip link set enp2s2 name enp2s1
[root@nerv01 ~]# /sbin/ip link set enp2s1 up
[root@nerv01 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    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: enp2s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether d8:5d:4c:80:39:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.101/24 brd 192.168.1.255 scope global enp2s1
       valid_lft forever preferred_lft forever
    inet6 fe80::da5d:4cff:fe80:3908/64 scope link tentative
       valid_lft forever preferred_lft forever
3: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:11:f0:5d:1b brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.101/24 brd 192.168.0.255 scope global ens32
       valid_lft forever preferred_lft forever
    inet6 2804:14c:85:87f8:225:11ff:fef0:5d1b/64 scope global mngtmpaddr dynamic
       valid_lft 604791sec preferred_lft 86391sec
    inet6 fe80::225:11ff:fef0:5d1b/64 scope link
       valid_lft forever preferred_lft forever
[root@nerv01 ~]#

E para que esta mudança persista após um boot, renomeie e altere o arquivo da interface como abaixo.

Antes o arquivo era assim:

[root@nerv01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s2
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp2s2
UUID=e5bc8b38-3be7-4ef8-8c61-10e8506eecfc
DEVICE=enp2s2
ONBOOT=yes
IPADDR=192.168.1.101
PREFIX=24
[root@nerv01 ~]#

E agora está assim:

[root@nerv01 ~]# mv /etc/sysconfig/network-scripts/ifcfg-enp2s2 /etc/sysconfig/network-scripts/ifcfg-enp2s1
[root@nerv01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s1
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp2s1
DEVICE=enp2s1
ONBOOT=yes
IPADDR=192.168.1.101
PREFIX=24
HWADDR=d8:5d:4c:80:39:08
[root@nerv01 ~]#

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.