CentOS / sig-cloud-instance-images

CentOS cloud images
781 stars 563 forks source link

how to change the default NIC name in centos-7 containers #164

Open sunyq opened 4 years ago

sunyq commented 4 years ago

Hi all: My app depends on the existing of eth1, but I just found the NIC name in centos-7.6.1810 is like eth0@if15:

[root@c0f30b739518 /]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1000
    link/tunnel6 :: brd ::
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever

ifcfg-ethx files have been purged from the base image: https://github.com/CentOS/sig-cloud-instance-images/issues/56 so how to change/set the default NIC name ?

Thanks!