HOSTNAME AND IP SETTING
1. Setting IP Address
2. Making host entry
3. Changing the Host name.
Note: Lines in pink color represent the commands to be entered by user
Lines in blue color represent the comment lines to understand.
Lines in black color represent the system generated lines.
STEP 1: SETTING IP ADRESS
<Login as super user;>
[root@EMS-1 ~]#netconfig
<Above command will open one ip configuration window. Like below>
Press return(enter) button to enter the ip address. It will open another window like
below;
2
Press tab key to move cursor to IP address field and enter the IP address like below
3
Using tab key fill the required information, keep the correct default gateway IP if
required or you can delete it and primary DNS server IP.
Move cursor to “OK” button using tab key and press return (enter) key. It will take you
to the command prompt again.
[root@EMS-1 ~]#
STEP 2: MAKING HOST ENTRY
[root@EMS-1 ~]#vi /etc/hosts
<it will open one vi editor which shows like below>
Press i button and move cursor to end of line 127.0.0.1 localhost.localdomain
localhost and press return (enter) key. Bottom of above line, add the following
entry:
Type IP address (ex: 192.168.21.52) and press tab button and type Hostname (ex EMS)
<Now it should look like below>
4
Now press Esc key and type :wq! to save the file. It will take you to command prompt
again.
[root@EMS-1 ~]#
STEP 3: CHANGING THE HOSTNAME
[root@EMS-1 ~]# vi /etc/sysconfig/network
<It will open vi editor which looks like below>
5
<here you need to delete localhost.localdomain and have to give EMS( same name
mentioned in “/etc/hosts” inplace of it.. to do this,>
Press i button, move cursor to end of line HOSTNAME=localhost.localdomain and
delete “localhost.localdomain” in place of that type EMS. Now it look like
6
<Now to save this file, >
Press Esc button and type :wq! And press return (enter) key.
<Now to reflect whole things do the following>
[root@EMS-1 ~]#service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@EMS ~]#
< Now to confirm whether hostname and ip setting are proper, do the following>
[root@EMS ~]#hostname
<it should show you here the name you given in /etc/sysconfig/network.>
[root@EMS ~]#hostname -i
<it should show you here the server IP.>
< If above both are showing properly, hostname and ip settings are done>
Document made by:
Lakshmaiah.G
09886401921
mailto:lakshmaiah@india.tejasnetworks.com