Artyom
08-03-2007, 10:10 PM
To add the IPs in CentOs, RedHat or Fedora Core:
To add IPs in Linux, you need to create a new file for each IP in
1. # cd /etc/sysconfig/network-scripts/
directory. You will find this directory file with a name ifcfg-eth0 or something close to it.
2. # ls ifcfg-*
3. Open the following file in your favorite editor (I will use vi in this example):
# vi ifcfg-eth0
You will quickly notice your main IP address in that file. IMPORTANT: The layout of the file MUST be in this format.
4. To keep the same format, we will simply create a new file with the same content:
# cp ifcfg-eth0 ifcfg-eth0:1
You now have created the file ifcfg-eth0:1 which we will use for your second IP address. IMPORTANT: As with the contents of the file, the names of the file MUST follow that format (i.e. eth0:1, eth0:2, eth0:3, etc..).
5. Using your editor, open up the file we just created
# vi ifcfg-eth0:1
6. Edit the DEVICE line to be:
DEVICE=eth0:1
7. Edit the IPADDR line to the new IP:
IPADDR=*.*.*.* (put in the actual IP instead of the star symbols)
8. To make this IP usable on boot, make sure that the ONBOOT is set to yes:
ONBOOT=yes
9. Reapeat steps {iv} through {viii} for the other IP addresses you have.
10. When you have added all of the new IP addresses, you can issue one of the two following commands:
# service network restart
or
# /etc/rc.d/init.d/network -reload
To add IPs in Linux, you need to create a new file for each IP in
1. # cd /etc/sysconfig/network-scripts/
directory. You will find this directory file with a name ifcfg-eth0 or something close to it.
2. # ls ifcfg-*
3. Open the following file in your favorite editor (I will use vi in this example):
# vi ifcfg-eth0
You will quickly notice your main IP address in that file. IMPORTANT: The layout of the file MUST be in this format.
4. To keep the same format, we will simply create a new file with the same content:
# cp ifcfg-eth0 ifcfg-eth0:1
You now have created the file ifcfg-eth0:1 which we will use for your second IP address. IMPORTANT: As with the contents of the file, the names of the file MUST follow that format (i.e. eth0:1, eth0:2, eth0:3, etc..).
5. Using your editor, open up the file we just created
# vi ifcfg-eth0:1
6. Edit the DEVICE line to be:
DEVICE=eth0:1
7. Edit the IPADDR line to the new IP:
IPADDR=*.*.*.* (put in the actual IP instead of the star symbols)
8. To make this IP usable on boot, make sure that the ONBOOT is set to yes:
ONBOOT=yes
9. Reapeat steps {iv} through {viii} for the other IP addresses you have.
10. When you have added all of the new IP addresses, you can issue one of the two following commands:
# service network restart
or
# /etc/rc.d/init.d/network -reload