0

I'm running CentOS 7 over VirtualBox VM. I installed the OS with one virtual network adapter and then added another one later, using VirtualBox.

The first adapter is normal. It has a normal name 'enp0s3', which I understand: en stands for Ethernet, p0 means physical position 0 and s3 means slot 3. I can see 'enp0s3' with command "ip addr". I can find a file named 'ifcfg-enp0s3' under directory network-scripts. The file contains configuration line 'NAME=enp0s3' and 'DEVICE=enp0s3'. All seems good.

But the second adapter, which I added after the OS installation, is weird . When I check network-scripts, there is a file named "ifcfg-Wired_connection_1", and there is a line 'NAME="Wired connection 1"' in the file. But when I run "ip addr", it shows an interface named "enp0s8", which has same IP address which I configured for "Wired connection 1".

I just wonder, how CentOS map "enp0s8" to "Wired connection 1"? Now I have only 2 adapters so I can easily figure out that "enp0s8" is "Wired connection 1", but if there are "enp0s4", "enp0s5", "enp0s6" shown by "ip addr", while "ifcfg_Wired_connection2", "ifcfg_Wired_connection3", "ifcfg_Wired_connection4" exists under network-script, how can I know "enp0s4" maps to "ifcfg_Wired_connection2" and "enp0s5" maps to "ifcfg_Wired_connection3"?

My output of "ip addr":

[root@localhost ~]# 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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:12:e7:8d brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 79239sec preferred_lft 79239sec
    inet6 fe80::a00:27ff:fe12:e78d/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:ae:e1:38 brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.80/24 brd 192.168.56.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:feae:e138/64 scope link
       valid_lft forever preferred_lft forever

Files under "network-scripts":

[root@localhost network-scripts]# ls ifcfg*
ifcfg-enp0s3  ifcfg-lo  ifcfg-Wired_connection_1

Content of file "ifcfg-Wired_connection_1" (which I don't understand, because I cannot find any 'enp0s8'):

[root@localhost network-scripts]# cat ifcfg-Wired_connection_1
HWADDR=08:00:27:AE:E1:38
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.56.80
PREFIX=24
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="Wired connection 1"
UUID=b8664f1f-01ee-4dd9-953b-fbb363bdb6d8
ONBOOT=yes

Content of file "ifcfg-enp0s3" (seems pretty good):

[root@localhost network-scripts]# cat ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=6f16b780-dd1c-4704-bba0-a867c04dc5d7
DEVICE=enp0s3
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

I just found that using "nmcli device show" could display the mapping between the name in the ifcfg-xxx file and the name shown by "ip addr":

[root@localhost ~]# nmcli device show
GENERAL.DEVICE:                         enp0s3
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         08:00:27:12:E7:8D
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     enp0s3
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/0
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         10.0.2.15/24
IP4.GATEWAY:                            10.0.2.2
IP4.DNS[1]:                             135.251.124.100
IP4.DNS[2]:                             135.251.38.218
IP4.DOMAIN[1]:                          int.nokia-sbell.com
IP6.ADDRESS[1]:                         fe80::a00:27ff:fe12:e78d/64
IP6.GATEWAY:

GENERAL.DEVICE:                         enp0s8
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         08:00:27:AE:E1:38
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     Wired connection 1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.56.80/24
IP4.GATEWAY:
IP6.ADDRESS[1]:                         fe80::a00:27ff:feae:e138/64
IP6.GATEWAY:

GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:
IP6.ADDRESS[1]:                         ::1/128
IP6.GATEWAY:

But still, where is the mapping stored, and how to change? For example I want to change "Wired connection 1" to "enp0s8" and also change file name "ifcfg-Wired_connection_1" to "ifcfg-enp0s8", how to change it smoothly?

0

I fixed this by disabling network manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.