How to Set Dual IP addresses with a single Nic in Linux.
1. Set the first IP Address:
[Root @ linux root] # cd/etc/sysconfig/network-Scripts
[Root @ Linux Network-Scripts] # vi ifcfg-eth0
Device = eth0
Bootproto = static
Broadcast = 192.168.80.255 // * broadcast address *//
Ipaddr = 192.168.80.189 // * The first IP Address *//
Netmask = 255.255.255.0 // * network mask *//
Network = 192.168.80.0 // * network segment *//
Onboot = Yes
: WQ // * Save and exit *//
2. Copy the first IP address configuration file to the second IP Address Configuration File and modify the IP Address:
[Root @ Linux Network-Scripts] # cp ifcfg-eth0 ifcfg-eth1
[Root @ Linux Network-Scripts] # vi ifcfg-eth1
Device = eth0
Bootproto = static
Broadcast = 192.168.80.255 // * broadcast address *//
Ipaddr = 192.168.80.199 // * Second IP Address *//
Netmask = 255.255.255.0 // * network mask *//
Network = 192.168.80.0 // * network segment *//
Onboot = Yes
: WQ // * Save and exit *//
3. Restart the NIC:
[root @ Linux Network-Scripts] # service network restart
or:
[root @ Linux Network-Scripts] # ifdown eth0
[root @ Linux Network-Scripts] # IFUP eth0
or
[root @ Linux Network -Scripts] # ifconfig eth0 down
[root @ Linux Network-Scripts] # ifconfig eth0 up
This article is from: it Knowledge Network (http://www.itwis.com) detailed source reference: http://www.itwis.com/html/ OS /linux/20090912/6196.html