Network Setup Steps:

  • Setup IP Address
  • Setup Gateway
  • Setup NetMask
  • Name Resolution using /etc/hosts
  • Name Resolution using DNS
  • Setup Hostname

 

Related Commands:

  • ip route
  • ip addr
  • ifconfig
  • hostname
  • ping
  • dig
  • service

Related Files:

  • /etc/sysconfig/network-scripts/ifcfg-eth0
  • /etc/sysconfig/network
  • /etc/resolv.conf
  • /etc/hosts

Eg:

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

DEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

TYPE=Ethernet

USERCTL=yes

PEERDNS=yes

 

Help-Notes for above configuration:

ONBOOT=yes                                    // when host is booted this configuration will be set

BOOTPROTO=none/DHCP           //DHCP – Automatically IP Address set from the router/network

//NONE – If you want to define manual IP address

DNS1=<your router DNS IP>       //Used for Name Resolution (IP-to-Name vice versa)

GATEWAY=<Router Private IP> //This Define from where network traffic will flow from one N/W to other N/w

 

After Network Configuration restart the service:

$ service network restart

If you don’t have DNS Server in your Organization:

You can do the entry in /etc/hosts do the entry of your hostname and IP address.

How it works:

When you ping to your own machine with hostname, first it will go to your /etc/hosts file it will search hostname if it found the hostname then the IP Address is found from their and ping command start working(getting response)

 

What to do entry in Host file:

<your machine ip> <FQDN> <your hostname>                  //remove “<>” this.

Eg: 172.168.8.12                sshinde@rhel.com         sshinde

 

How to Set hostname:

To change hostname permanently goto below file:

Vi /etc/sysconfig/network

Even after a reboot, this hostname will be permanent as per the entry in network file.

 

Temporary change the hostname:

# hostname sshinde

Note: After reboot, this hostname will be lost, it will display the hostname which is there in /etc/sysconfig/network file