Lwin Maung Maung

My Notes and Blogs

Home Laravel Linux
<-

Network interface rename in Gentoo Linux.

Published on  Aug 1st, 2023Updated:  May 23rd, 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.

#/etc/conf.d/net

//dhcp or manual like:192.168.1.1/24

config_eth0 = "dhcp"  

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

config_enp0s1="dhcp"

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.

 

Reference: 

  1. Gentoo
© lwinmaungmaung MMXXIII. All Rights Reserved.