How To Configure Static IP Address In Linux

Configure By Editing Configuration Files

Step1:Add a new configuration file named ifcfg-eth<x>. ('x'  is number order of NIC card).  Here create ifcfg-eth0 in /etc/sysconfig/network-scripts/
[root@server ~#]vi /etc/sysconfig/network-scripts/ifcfg-eth0
#Add your address settings in below format
DEVICE=eth0
IPADDR=192.168.10.50
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
GATEWAY=192.168.10.1
DNS1=192.168.10.2
DNS2=192.168.10.3
#save the file

Step2: restart network to take effect new ipaddress
[root@server ~#]service network restart

Step3: verify the new ip address
[root@server ~#]ifconfig eth0

To set as DHCP client

Step1:Add a new configuration file in /etc/sysconfig/network-scripts/
[root@server ~#]vi /etc/sysconfig/network-scripts/ifcfg-eth0
#add there lines
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

Step2: restart network
[root@server ~#]service network restart

Step3: verify the new ip address
[root@server ~#]ifconfig eth0

Configure IP Address via "setup" utility

Step1: Login as root in text mode, and type "setup" , and you can reach a setup utility wizard(pic:1).
Pic:1.  Setup Utility Wizard

Step2: Select Network configuration-> Device Configuration-> and select a device(like eth0 or eth1...) & set ip address, subnetmask, gateway, dns, etc. or set as DHCP client.

Pic:2 Set ipaddress, mask,gateway etc.
Pic:3 Enable dhcp

1 comments:

Anonymous said...

grand post, Merci..

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons