×

There are certain cases when you are required to have multiple NICs attached to your system. Like when you have two separate networks in your office and you need to connect to both of them or you want to host multiple SSL websites, and so on. 

In such cases, you should not purchase additional NICs. Instead, you can assign more than one IP addresses to a single interface. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux Mint queries.

Previously, we have reviewed assigning multiple IP addresses to a single NIC in Debian  and Ubuntu.

In this context, we shall look into how to assign multiple IP addresses to a single NIC in Mint.


How to Temporarily Assigning Multiple IP Addresses to Single NIC in Mint ?

Here, you will learn how to assign more than IP address (temporarily) to a single NIC. We will do this using the ip addr command. 

The IP address assigned by this method will be remained assigned until you reboot your system.

The ip addr command is also used to show the current IP address of a system .

To display your IP address, simply execute this command in Terminal:

$ ip addr

The output of the above command will shows the system's current IP address as well as its interface.


To assign a second IP address to your Network interface card, use the below syntax:

$ sudo ip addr add <ip-address/net-mask> dev <interface>

Where <ip-address/net-mask> is the second IP address you want to allocate to your NIC <interface>.


Now, to check if the second IP address has been added to the network interface, run the below command:

$ ip a


How to remove the Multiple IP addresses from NIC ?

You can also remove multiple IP addresses allocated to a NIC. The command to remove the IP address is almost similar to the one that is used to add the IP address, except “add” which is replaced with the “del”.

Here is the command to remove the IP address from NIC:

$ sudo ip addr del <ip-address/net-mask> dev <interface>

For multiple IP addresses, repeat the command for each of the IP address.


How to Permanently Assigning Multiple IP Addresses to Single NIC in Mint ?

To add multiple IP addresses to a single interface and keep it persistent, you will have to configure it in the /etc/network/interfaces configuration file.

To display your IP address, simply execute this command in Terminal:

$ ip addr

Here, the output of the ip addr command will shows our system's current IP address as well as its interface.


To assign a second IP address to your Network interface card, open the /etc/network/interfaces file:

$ sudo nano /etc/network/interfaces

In the /etc/network/interfaces file, append the below lines:

iface <interface> inet static
address <ip-address>

In the above lines, replace <interface> with the interface name you want to assign the address to and <ip-address> with the required IP address.


Also, more IP addresses can be added to your NIC.

Save and close the configuration file once you’re finished with the configurations.

Now to apply the network configuration changes, either restart the networking service using the following command:

$ sudo systemctl restart networking.service

Or disable and enable the network interface as follows:

$ sudo ifdown ens33
$ sudo ifup ens33

Now, to check if the secondary IP address has been added to the NIC, run the following command:

$ ip a


How to remove the Multiple IP addresses from NIC ?

You can remove the secondary IP addresses either through the ip addr command or through the /etc/network/interfaces file.

To remove IP address through the ip addr command, use the following syntax:

$ sudo ip addr del <ip-address/net-mask> dev <interface>

To remove IP address through the /etc/network/interfaces file, open this file through the following command:

$ sudo nano /etc/network/interfaces

Then remove the IP address entry address from the file.

Then save and close the configuration file once you’re finished with the configurations.


Now to apply the network configuration changes, either restart the networking service using the following command:

$ sudo systemctl restart networking.service

Or disable and enable the network interface as follows:

$ sudo ifdown ens33
$ sudo ifup ens33

Now, to check if the second IP address has been removed from the NIC, run the following command:

$ ip a


[Need urgent assistance to install missing packages on Linux Mint? We can help you. ]


Conclusion