Summer training at Goeduhub Technologies-Jaipur
Register for Free Certified Workshop on AI & Machine Learning:: 23-02-2020 ||  Career options for aspiring CS/ITECEEE or EIC or EEE Engineers
0 like 0 dislike
in Tutorial & Interview questions by (6.7k points)

1 Answer

0 like 0 dislike
by (6.7k points)
selected by
Best answer

This document covers TCP/IP networking, network administration and system configuration basics. Linux can support multiple network devices. The device names are numbered and begin at zero and count upwards. For example, a computer with two NICs will have two devices labeled eth0 and eth1. 

Local DNS resolution 

File: /etc/hosts contains a list of hosts that are to be resolved locally(not by DNS)

 Sample contents of the file: localhost.localdomain localhost XXX.XXX.XXX.XXX node-name 

The file format for the hosts file is specified by RFC 952

 Configure DNS servers for domain name resolution 

File: /etc/resolv.conf contains a list of DNS servers for domain name resolution 
Sample contents of the file:
nameserver # IP address of the primary name server 
nameserver # IP address of the secondary name server

In case internal DNS server you can validate if this server resolve DNS names properly using dig command: 

$ dig +short

See and manipulate routes 

Manipulate the IP routing table using route 
Display routing table
$ route # Displays list or routes and also resolves host names 
$ route -n # Displays list of routes without resolving host names for faster results

Add/Delete route 

Option                                             Description 

add or del                    Add or delete a route

-host x.x.x.x               Add route to a single host identified by the IP address 

-net x.x.x.x                Add route to a network identified by the network address 

gw x.x.x.x                 Specify the network gateway

 netmask x.x.x.x      Specify the network netmask 

default                      Add a default route 


  • add route to a host $ route  add -host x.x.x.x eth1 
  • add route to a network $ route add -net netmask eth0 
  • Alternatively, you could also use cidr format to add a route to network route add -net eth0 
  • add default gateway $ route add default gw eth0 
  • delete a route $ route del -net

Manipulate the IP routing table using ip 

Display routing table 

$ ip route show # List routing table

Add/Delete route 

Option                                                                Description 

add or del or change or append or replace        Change a route 

show or flush                                               the command displays the contents of the routing tables or remove it 

restore                                     restore routing table information from stdin 

get                                           this command gets a single route to a destination and prints its contents exactly as the kernel sees it


  • Set default gateway to $ ip route add default via
  •  Adds a default route (for all addresses) via the local gateway that can be reached on device eth0 

$ ip route add default via dev eth0

Configure a hostname for some other system on your network 

You can configure your Linux (or macOS) system in order to tie in an identifier to some other system's IP address in your network. You can configure it:
  • Systemwide. You should modify the /etc/hosts file. You just have to add to that file a new line containing: 
    • the remote system's IP address , 
    • one or more blank spaces, and 
    • the identifier . 
  • For a single user. You should modify the ~/.hosts file --- you-d have to create it. It is not as simple as for systemwide. Here you can see an explanation.

For instance, you could add this line using the cat Unix tool. Suppose that you want to make a ping to a PC in yout local network whose IP address is and you want to refer to that IP address just by remote_pc. Then you must write on your shell:

$ sudo cat remote_pc  

Then you can make that ping just by: 

$ ping remote_pc 

Interface details 

List all the interfaces available on the machine
$ ifconfig -a

List the details of a specific interface 

Syntax: $ ifconfig 


$ ifconfig eth0 

eth0         Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx 

 inet addr:x.x.x.x Bcast:x.x.x.x Mask:x.x.x.x 

 inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/64 Scope:Link 


 RX packets:4426618 errors:0 dropped:1124 overruns:0 frame:0 

 TX packets:189171 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:382611580 (382.6 MB) TX bytes:36923665 (36.9 MB) Interrupt:16 Memory:fb5e0000-fb600000 

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
 Go to your Branch CSE or IT | ECE | EE, EIC or EEEMECE
 Know About Popular Colleges/Universities  List of IITsList of NITs | RTU-KOTA | Manipal University-Jaipur | JECRC University | Amity University Jaipur | BIT Mesra-Jaipur | MODY UNIVERSITY | LNMIIT-Jaipur | JK Lakshmipat | Banasthali Vidyapith | POORNIMA University
 Exams:   List of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG) | JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs
Placements:  List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Online Free Training:  Artificial Intelligence(AI) Machine Learning(ML)Python Programming | Internet of Things-IoT | OpenCV (Open Source Computer Vision Library) | LINUX | Big Data : Hadoop | 
About Us | Contact Us   Social::   |  |