1. Login to server via ssh
2. Before binding the new ip address you can check the existing ip address and network interfaces using the following command.
ifconfig
3. Now navigate to the directory /etc/sysconfig/network-scripts/
cd /etc/sysconfig/network-scripts/
4. You should be now able to see the file ifcfg-eth0 where the default ip is binded. Just copy this file for the new ip address. We need to edit the DEVICE part and IPADDR part only.
cp -rp ifcfg-eth0 ifcfg-eth0:1
5. Now open the file ifcfg-eth0:1 . A sample file will be having the following contents.
vi ifcfg-eth0:1
DEVICE="eth0:1"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="192.168.1.1"
Following are the explanation for different directives.
DEVICE: This is name of the interface you are going to assign the IP to.
BOOTPROTO: “static” This means the IP address is statically assigned to the server.
ONBOOT: “yes” This means the sever will bind this IP during boot process.
IPADDR: This is where you enter your IP Address. Make sure to enter the correct ip information here.
Now save the file.
You can bring the new ip UP by using the following command.
ifup ifcfg-eth0:1
Or
service network restart
2. Before binding the new ip address you can check the existing ip address and network interfaces using the following command.
ifconfig
3. Now navigate to the directory /etc/sysconfig/network-scripts/
cd /etc/sysconfig/network-scripts/
4. You should be now able to see the file ifcfg-eth0 where the default ip is binded. Just copy this file for the new ip address. We need to edit the DEVICE part and IPADDR part only.
cp -rp ifcfg-eth0 ifcfg-eth0:1
5. Now open the file ifcfg-eth0:1 . A sample file will be having the following contents.
vi ifcfg-eth0:1
DEVICE="eth0:1"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="192.168.1.1"
Following are the explanation for different directives.
DEVICE: This is name of the interface you are going to assign the IP to.
BOOTPROTO: “static” This means the IP address is statically assigned to the server.
ONBOOT: “yes” This means the sever will bind this IP during boot process.
IPADDR: This is where you enter your IP Address. Make sure to enter the correct ip information here.
Now save the file.
You can bring the new ip UP by using the following command.
ifup ifcfg-eth0:1
Or
service network restart
No comments:
Post a Comment