Tuesday, February 18, 2014

Steps for Assigning IP Address to Linux machine

www.unixbabuforum.inwhat are the steps for assigning the IP Address to linux machine.
I am using the RHEL 5.8. 
I am not sure about which files should be edited or which services to be restarted

www.unixbabuforum.inCheck and update following file with ip address / gateway / netmask / hostname 

/etc/sysconfig/network-scripts/ifcfg-eth0 

Restart network service : /etc/init.d/network restart 

/sbin/ifconfig - to check

www.unixbabuforum.inYOu need to edit 4 files 
1/ /etc/sysconfig/netowrks-scripts/ifcfg-eth0 
2. /etc/sysconfig/networks 
3. /etc/hosts 
4 /etc/resolve.conf 

after this run : 

# ifup eth0 
#service network restart 

www.unixbabuforum.inYou can edit your file for example: 

[root@vhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 <- name might vary depending on your server. 
# /etc/sysconfig/network-scripts/ifcfg-eth0 

# 2.device = eth0 
# 2.ipaddr = 192.168.1.x 
# 2.netmask = 255.255.255.0 
# 2.enabled = 192.168.1.x 
DEVICE=eth0 
BOOTPROTO=none 
ONBOOT=yes 
BROADCAST=192.168.1.255 
NETWORK=192.168.1.0 
NETMASK=255.255.255.0 
IPADDR=192.168.1.xxx 
USERCTL=no 
[root@vhost ~]# 


If you have graphic environment like gnome or kde you can use network-manager 

www.unixbabuforum.inIt does depend on what you are trying to do, 
whether you are adding to an existing network 
or connecting to internet, and whether you are using a static or dynamic 
addresses. 

Its best you read up on linux networking if your not familiar. 

However if you just want to add to an existing network you can edit your 
ifcfg-eth0 file in /etc/sysconfig/network-scripts, set the bootproto to 
dhcp or static, if static, set the ipaddress and add it to the hosts 
table in /etc/hosts as well. you will also need to set your dns address 
if you are conncting to the internet and add your gateway address too. 
also add the dns to /etc/resolv.conf. assuming you installed networking 
as default you should be able to stop and start the service 
using /etc/init.d/network which should be linked to the appropriate run 
level rc startup files. best to setup everything manually so you know 
what is going on. 

www.unixbabuforum.inlot of ways: 

bad one 

a)cd /etc 

b)edit rc.local and insert a line similar below 
ifcobfic ethX XXXX.XXXX.XXXX.XXXX netmask ... 

another way 

2) execute "setup" 

third way 

3) edit /etc/sysconfig/network-scripts/ ifcfg-ethx 

execute "dmesg" and find proper name instead of "ETHX"

www.unixbabuforum.inneed to edit ifcfg-eth.. file 

Location of file 

# vi /etc/sysconfig/network-scripts/ifcfg-eth0 

Example :- 

DEVICE=eth0 
BOOTPROTO=static 
HWADDR=f2:ce:4t:0f:a8:bu 
NM_CONTROLLED=no 
ONBOOT=yes 
TYPE=Ethernet 
UUID="459538ca-5cbe-44bd-a5fd-69342c07e211" 
IPADDR=192.168.0.1 
NETMASK=255.255.255.0 
GATEWAY=192.168.0.2 
DNS1=192.168.0.3 
IPV6INIT=no 
USERCTL=no 


www.unixbabuforum.inUse below link to assign a ip address in linux 

http://www.cyberciti.biz/faq/linux-configure-a-static-ip-address-tutorial/ 

0 comments:

Post a Comment

 
Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM