Lwin Maung Maung

My Notes and Blogs

Home Laravel Linux

Network interface rename in Gentoo Linux.

Published on  Aug 1st, 2023Updated:  Jul 20th, 2024
2 mins Read

In a VPS, the network settings change frequently due to some reasons. When the ports update, they do not disconnect but are very slow and laggy due to network interface name changes.

This event is very foreseeable in a single VPS, but not very clear if you separate two or more VPS for your production. Your website or web app stops immediately or responds with a 500 error. In the worst case, your web server will say 502 "Bad Gateway" or just 504 "Gateway Timeout", which means "Bye, I'm gone".

No Logging, No data and your apps are gone. When you check your servers, they do not have any problems. When you are looking further, the Web is good, the database is working, and everything seems normal. However, when checking the ports, they are renamed, from eth0 to enp0s1, or vice-versa.

So, the solution is to rename it to the proper port number. In Gentoo Linux, update /etc/conf.d/network.


//dhcp or manual like:

config_eth0 = "dhcp"  

#change eth0 to updated network 
#interface name. enp0s1 in this example.


Also, update in /etc/init.d and rename links from net.eth0 to net.enp0s1.

$ cd /etc/init.d/
$ mv net.eth0 net.enp0s1
$ rc-update add net.enp0s1 default

Finally, restart network services by each network port. If you have two ports, repeat renaming for two links. 

I hope this will work.



  1. Gentoo
© lwinmaungmaung MMXXIII. All Rights Reserved.