Dear friends from internet.
Probably you was able to find some urls in google like this:
- https://esuareznotes.wordpress.com/2014/07/11/change-default-network-name-to-old-eth0-on-rhel-7-fedora-19-above/
- http://linukstricks.blogspot.com/2014/09/change-interface-name-eth0-in-centos-7.html
or many others where main idea is:
1) add this word to cmd line: net.ifnames=0 biosdevname=0,
2) rename files like this: ifcfg-enp0s25 to ifcfg-eth0 (maybe change something inside)
Yes, it can solve problem when 1 (ONE) card is inside, there is no matter how it was named before via new super not expected tool in new Centos7, but what to do if more cards???
Friends, just use UDEV! Only 1 (ONE!!!) file to solve problem ;)
If some creepy software sets names to something not acceptable ... let change it again to something acceptable.
For last 15 years, I expect eth0, eth1 and more eth* like names in system!
I know how to load modules, use it ... How to change name of eth* using MAC ...
I lost one my vacation day to find simple and fast solution (before that it was pollution!) to set my Centos 7 ethernet names LIKE I WANT!
So, after some long story, there is how to do it!
1) new fresh installed Centos 7 distro has for example interface like this:
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:1e:0b:b6:1e:5f brd ff:ff:ff:ff:ff:ff
inet 172.16.200.15/24 brd 172.16.200.255 scope global enp0s25
valid_lft forever preferred_lft forever
inet6 fe80::21e:bff:feb6:1e5f/64 scope link
valid_lft forever preferred_lft forever
2) command biosdevname -d enp0s25 shows input:
BIOS device: em1
Kernel name: enp0s25
Permanent MAC: 00:1E:0B:B6:1E:5F
Assigned MAC : 00:1E:0B:B6:1E:5F
ifIndex: 2
Driver: e1000e
Driver version: 2.3.2-k
Firmware version: 1.3-1
Bus Info: 0000:00:19.0
PCI name : 0000:00:19.0
PCI Slot : embedded
Embedded Index: 1
3) please create file: /etc/udev/rules.d/70-persistent-network.rules with line or lines if more enp* interfaces ;)
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1e:0b:b6:1e:5f", ATTR{type}=="1", KERNEL=="enp*", NAME="eth0"
4) rename file ifcfg-enp0s25 in dir /etc/sysconfig/network-scripts to ifcfg-eth0
and replace lines with enp0s25 to eth0
5) restart your Centos7 based computer ;) and check it!
[root@centos7-xxx ~]# ip a
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:1e:0b:b6:1e:5f brd ff:ff:ff:ff:ff:ff
inet 172.16.200.15/24 brd 172.16.200.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::21e:bff:feb6:1e5f/64 scope link
Please check what is in dmesg ;)
[root@centos7-xxx ~]# dmesg | grep eth
[ 0.047052] reboot: BIOS series board detected. Selecting HP Compaq Laptop-method for reboots.
[ 0.079109] ACPI Error: Method parse/execution failed [\_SB_.PCI0._OSC] (Node ffff880115a7d618), AE_ALREADY_EXISTS (20130517/psparse-536)
[ 0.079116] ACPI: Marking method _OSC as Serialized because of AE_ALREADY_EXISTS error
[ 2.032201] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) 00:1e:0b:b6:1e:5f
[ 2.032205] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
[ 2.032235] e1000e 0000:00:19.0 eth0: MAC: 7, PHY: 6, PBA No: 1062FF-0FF
[ 2.062097] systemd-udevd[302]: renamed network interface eth0 to enp0s25
[ 6.992172] systemd-udevd[616]: renamed network interface enp0s25 to eth0
Now some lines for pc where I have 2 cards, tg3 and rtl based chip:
[root@localhost ~]# dmesg | grep eth
[ 1.829683] r8169 0000:10:00.0 eth0: RTL8168e/8111e at 0xffffc90003742000, c0:4a:00:02:64:fb, XID 0c200000 IRQ 48
[ 1.829686] r8169 0000:10:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[ 1.863198] systemd-udevd[259]: renamed network interface eth0 to enp16s0
[ 1.863346] tg3 0000:1e:00.0 eth0: Tigon3 [partno(BCM95723) rev 5784100] (PCI Express) MAC address 68:b5:99:4f:b9:ac
[ 1.863349] tg3 0000:1e:00.0 eth0: attached PHY is 5784 (10/100/1000Base-T Ethernet) (WireSpeed[1], EEE[0])
[ 1.863352] tg3 0000:1e:00.0 eth0: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[1] TSOcap[1]
[ 1.863353] tg3 0000:1e:00.0 eth0: dma_rwctrl[76180000] dma_mask[64-bit]
[ 1.881264] systemd-udevd[255]: renamed network interface eth0 to enp30s0
[ 6.049986] systemd-udevd[515]: renamed network interface enp30s0 to eth0
[ 6.155023] systemd-udevd[510]: renamed network interface enp16s0 to eth1
Btw, I removed from my Centos7 systems after install one package:
- NetworkManager,
- NetworkManager-tui.
I want to set my IP's manually :-) from configuration.
Oke, enjoy, if there is some bad info, you can write comment :D
I will update.
Thank you for reading :D
abram
edit:
One more thing, pc with 3x ethernet card
#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: enp16s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
# link/ether c0:4a:00:02:87:02 brd ff:ff:ff:ff:ff:ff
#3: enp48s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
# link/ether 00:0e:2e:a4:a0:99 brd ff:ff:ff:ff:ff:ff
#4: enp30s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
# link/ether 68:b5:99:e3:8d:ba brd ff:ff:ff:ff:ff:ff
# inet 172.16.200.17/24 brd 172.16.200.255 scope global enp30s0
# valid_lft forever preferred_lft forever
# inet6 fe80::6ab5:99ff:fee3:8dba/64 scope link
# valid_lft forever preferred_lft forever
#[ 1.870245] r8169 0000:10:00.0 eth0: RTL8168e/8111e at 0xffffc90003742000, c0:4a:00:02:87:02, XID 0c200000 IRQ 48
#[ 1.870247] r8169 0000:10:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
#[ 1.881350] 8139too 0000:30:00.0 eth1: RealTek RTL8139 at 0xffffc90003744000, 00:0e:2e:a4:a0:99, IRQ 17
#[ 1.919373] systemd-udevd[266]: renamed network interface eth0 to enp16s0
#[ 1.961322] systemd-udevd[261]: renamed network interface eth1 to enp48s0
#[ 1.961504] tg3 0000:1e:00.0 eth0: Tigon3 [partno(BCM95723) rev 5784100] (PCI Express) MAC address 68:b5:99:e3:8d:ba
#[ 1.961506] tg3 0000:1e:00.0 eth0: attached PHY is 5784 (10/100/1000Base-T Ethernet) (WireSpeed[1], EEE[0])
#[ 1.961507] tg3 0000:1e:00.0 eth0: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[1] TSOcap[1]
#[ 1.961508] tg3 0000:1e:00.0 eth0: dma_rwctrl[76180000] dma_mask[64-bit]
#[ 1.976543] systemd-udevd[252]: renamed network interface eth0 to enp30s0
Little annoying, isn't it?????
Just create file in /etc/udev/rules.d/ with lines ;) to solve mess ;)
# tg3 on board
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="68:b5:99:e3:8d:ba", ATTR{type}=="1", KERNEL=="enp*", NAME="eth0"
# r8169 in pci
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c0:4a:00:02:87:02", ATTR{type}=="1", KERNEL=="enp*", NAME="eth1"
# RTL8139 in pci
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0e:2e:a4:a0:99", ATTR{type}=="1", KERNEL=="enp*", NAME="eth2"
Brak komentarzy:
Prześlij komentarz