Hjälpcentral

How do I add a secondary IP to Linux without cPanel?

Using ifconfig

If you want to add a secondary IP address to a NIC already in use in Linux, and have that change only temporarily. Enter this command:

ifconfig [nic]:0 [IP-Address] netmask [mask] up

An example is shown below

ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0 up

You need to be root to execute that command.

Using IP command

If you prefer to use the ip command instead of ifconfig

ip address add [ip]/[mask-digits] dev [nic]

Here is an example

ip address add 192.168.99.37/24 dev eth0

With this command you can add more ip addresses to the same dev NIC, the second is considered secondary.

  • additional IP, secondary IP, unmanaged, IP

Hjälpte svaret dig?

164 användare blev hjälpta av detta svar