Add an IP address to my Linux Server

Adding an IP address to a CentOS server is very easy.
  • Go to the network configuration directory /etc/sysconfig/network-scripts
  • Create a file with the name ifcfg-eth0:1 (This file increments, so if you already have several IP addresses you need to add the next increment, such as ifcfg-eth0:3 for the 4th IP)
  • Paste the following contents into the file:

DEVICE=eth0:1
BOOTPROTO=static
IPADDR=YOUR_NEW_IP_HERE

ONBOOT=yes

  • In order for the IP change to effect, you can either reboot your server or you can run the following command:

ifconfig eth0:1 up

 

 

Add an IP address for Non-SUSE distributions

These are the steps to add the second IP address to your existing network adapter under non-SUSE distributions of Linux.

1. Become root on your system, either by logging into that account or using the su command.


2. Change your current directory to the /etc/sysconfig/network-scripts directory with the command:

cd /etc/sysconfig/network-scripts


3. Check for existing network adapters with the command:

ls ifcfg-*

In most instances, you will see the files ifcfg-eth0 and ifcfg-lo. If you see other files with any other names and are unfamiliar with configuring TCP/IP, you may want to consult with your system administrator before proceeding or contact support@oclc.org.


4. Edit /etc/hosts and add a line for your new address and name such as:

24.249.162.195 ezproxy2.yourlib.org


5. To create the new interface, you will copy ifcfg-eth0 to ifcfg-eth0:0 with the command:

cp ifcfg-eth0 ifcfg-eth0:0


6. Edit icfg-eth0:0 and change the DEVICE line to be similar to:

DEVICE= eth0:0

and change the IPADDR line to be similar to:

<paddr=>24.249.162.195


7. To activate the new IP address, issue a command similar to:

./ifup eth0:0

Add an IP address for SUSE distributions

1. Become root on your system, either by logging into that account or using the su command.


2. Change your current directory to the /etc/sysconfig/network-scripts directory with the command:

cd /etc/sysconfig/network-scripts


3. Check for existing network adapters with the command:

ls ifcfg-eth*

and look for a file named similar to ifcfg-eth-id-12:34:56:78:90:ab. The colon-delimited letters and digits at the end are the MAC address (hardware address) of the Ethernet adapter.


4. Edit /etc/hosts and add a line for your new address and name such as:

24.249.162.195 ezproxy.yourlib.org


5. To create the new interface, you will edit ifcfg-eth-id-12:34:56:78:90:ab. The file should contain lines similar to:

BOOTPROTO='static'
BROADCAST='24.249.162.255'
IPADDR='24.249.162.194'
NETMASK='255.255.255.0'
NETWORK='24.249.162.0'
STARTMODE='onboot'
USERCONTROL='no'
_nm_name='bus-pci-0000:01:04.0'

and will contain additional lines. At the bottom of this file, you should add lines similar to:

IPADDR1='24.249.162.195'
NETMASK1='255.255.255.0'
LABEL1='0'

to add the extra address.


6.  To restart networking and activate the new IP address, issue the command:

/etc/init.d/network restart