Add second IP address

You can add address to any network adapter, but that change can be temporary or permanent

Temporary:

# ifconfig <network adapter>:0 <ip> netmask <netmask> up
# example:
ifconfig eth0:0 192.168.0.23 netmask 255.255.255.0 up

# or 
# ip address add <ip>/<netmask> dev <network adapter>
ip address add 192.168.0.23/24 dev eth0

Permanently:

#edit /etc/network/interfaces
# auto <network adapter>:<number>
# iface <network adapter>:<number> inet static
# address <ip>
# gateway <gateway ip>
# netmask <netmask>
# example:

auto eth0:1
iface eth0:1 inet static
address 192.168.0.23
gateway 192.168.0.1
netmask 255.255.255.0

 

Leave a Reply

Your email address will not be published.

*