In this tutorial, I will be showing you how you can set up multiple static ips on a debian installation. I will be doing this by modifying the network interfaces file. To open this file, type
The file should look like this
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback
At the bottom of this, we will need to add our ethernet interface so we can set a static IP for it. This should be eth0 however this could be different with other network interfaces. We can see an example of these settings below.
auto eth0 iface eth0 inet static address 192.168.1.41 netmask 255.255.255.0 gateway 192.168.1.1
To assign multiple, we will need to create virtual network adapters for each IP which can be seen below.
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.41 netmask 255.255.255.0 gateway 192.168.1.1 #Add extra ips to virtual network adapters auto eth0:0 #the :0 would change depending on how many adapters you would add. iface eth0:0 inet static address 10.0.0.41 netmask 255.0.0.0
auto eth0:1 iface eth0:1 inet static address 10.0.1.41 netmask 255.0.0.0
After we have done this, we can then restart the networking service like so
service networking restart
We can then use the ifconfig command to see our network adapters and their settings.
which should return something that looks like this
If this doesn't work, you may still have the Network Manager program running which is stopping you from managing your network. View This Tutorial for How to Disable Network Manager from Starting in Debian
Once you have done this, you should reboot just to be safe!
If you are following this after running a DHCP configuration, you should probably follow this guide to find out How to set which DNS / Nameservers to use on Debian