How to set up multiple static IP addresses in Ubuntu?
To configure multiple static IP addresses on Ubuntu, you can follow these steps:
- Open the terminal and log in with administrator privileges.
- You can edit the /etc/network/interfaces file using any text editor. For example, you can open the Nano editor using the following command:
- Open the /etc/network/interfaces file using the nano text editor with superuser privileges.
- Locate the configuration of the current network interface in the file. For example, if your interface is eth0, it may appear similar to this:
- Automatically configure eth0 with a static IP address of 192.168.1.100, a netmask of 255.255.255.0, and a gateway of 192.168.1.1.
- Add a new interface configuration below the existing interface configurations. For example, to add another static IP address of 192.168.1.101, you can use the following configuration:
- Automatically create a virtual interface eth0:1 with a static IP address of 192.168.1.101, a netmask of 255.255.255.0, and a gateway of 192.168.1.1.
- To add more static IP addresses, you can increase the configuration with options like eth0:2, eth0:3, etc.
- Save and close the file.
- Restart the network service to apply the changes. Use the following command:
- Restart the networking service using systemctl.
Your Ubuntu system should now have multiple static IP addresses. You can use the ifconfig command to verify that the IP addresses are correctly configured. For example, you can use the following command to check the IP addresses of interfaces eth0 and eth0:1:
ifconfig eth0
ifconfig eth0:1