Network file config is located /etc/sysconfig/network-scripts. Firstable need to check your using network interfaces. Follow the command:
ip a
In the example by default is using «eth0». Now edit network file config of this interface:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Update it as follows:
IPADDR2=Address
PREFIX2=Mask (example=24)
GATEWAY2=Gateway
Enter the new IP address that you want to add as IPADDR1. If this new IP is in a different subnet, enter the gateway and subnet mask as GATEWAY1 and PREFIX1.
After save reboot the server:
shutdown -r now
Debian
Network file config is located /etc/network/interfaces. Check your using network interfaces. Follow the command:
ip a
In the example by default is using «ens18». Now edit network file config of this interface:
nano /etc/network/interfaces
By default you have been see follow settings.
Now to add a new IP you need to write in the end:
auto ens18:0
iface ens18:0 inet static
address
netmask
After save reboot the server:
shutdown -r now
Ubuntu
Network file config is located /etc/netplan/*.yaml. Check your using network interfaces. Follow the command:
ip a
In the example by default is using «ens18». Now edit network file config of this interface:
nano /etc/netplan/*.yaml
After save reboot the server:
shutdown -r now