Archive

Posts Tagged ‘ifconfig’

Adding and removing IP aliases

April 20th, 2009 No comments

You need to add an IP address on interface eth0 ? Use the following command to activate it.

ifconfig eth0:1 192.168.1.177 netmask 255.255.255.0

Now you want to delete it ? No problem, use the following command ;

ifconfig eth0:1 del 192.168.1.177

You can also create a file /etc/sysconfig/network-scripts/ifcfg-eth0:1 to have the IP automatically come up upon reboot.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1
TYPE=Ethernet
# Device Name
DEVICE=eth0:1
# Boot Protocol none,bootp,dhcp
BOOTPROTO=none
# IP Address
IPADDR=192.168.1.177
# Netmask
NETMASK=255.255.255.0
# Normal user cannot activate/deactivate it
USERCTL=no
# IPv6 Actvated
IPV6INIT=no
# Use the parent interface
ONPARENT=yes
# yes = Modify /etc/resolv.conf if DNS directive is set
#       If using DCHP, then yes is the default
# no  = Do not modify /etc/resolv.conf
PEERDNS=no
Categories: Network