Setting up IP address to Network Card in Linux

, , No Comments

STEP 1: Setting up first IP address. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 on Redhat Linux box and give the following entries as shown.

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0   BOOTPROTO=static   IPADDR=192.168.1.10   NETMASK=255.255.255.0   NETWORK=192.168.1.0   ONBOOT=yes

STEP 2:  Setting up second IP address. Create one file as /etc/sysconfig/network-scripts/ifcfg-eth0:1 and give the entries as below in to this file.

vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1   BOOTPROTO=static   IPADDR=192.168.1.11   NETMASK=255.255.255.0   NETWORK=192.168.1.0   ONBOOT=yes

STEP 3:  Once you configure above files and save them. Now reload the network service on your machine.

service network reload

STEP 4: Check if you get the IP address assigned to the eth0 and eth0:1 interfaces respectively.

ifconfig

Note1: We can assign virtual IP to the same interface with ifconfig but that one is not permanent so not giving info on that.

Note2: We can assign up to 16 virtual IP address to a single NIC card.

0 टिप्पणियाँ:

Post a Comment