0% found this document useful (0 votes)
255 views

Network Configuration and Troubleshooting Commands

This document provides an overview of common Linux commands used for network configuration and troubleshooting. It describes the purpose and basic syntax of ifconfig, ping, traceroute, netstat, dig, nslookup, route, host, arp, and hostname. Ifconfig is used to view and configure network interfaces. Ping tests network connectivity, while traceroute shows the network path between hosts. Netstat displays network connections and statistics. Dig and nslookup perform DNS lookups. Route manages the routing table. Host resolves hostnames and IP addresses. Arp displays the ARP cache.

Uploaded by

mini
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
255 views

Network Configuration and Troubleshooting Commands

This document provides an overview of common Linux commands used for network configuration and troubleshooting. It describes the purpose and basic syntax of ifconfig, ping, traceroute, netstat, dig, nslookup, route, host, arp, and hostname. Ifconfig is used to view and configure network interfaces. Ping tests network connectivity, while traceroute shows the network path between hosts. Netstat displays network connections and statistics. Dig and nslookup perform DNS lookups. Route manages the routing table. Host resolves hostnames and IP addresses. Arp displays the ARP cache.

Uploaded by

mini
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Network Configuration and

Troubleshooting Commands

1
Introduction
• Computers are connected in a network to
exchange information or resources each other.
• Two or more computer connected through
network media called computer network.
• There are number of network devices or media are
involved to form computer network.
• Computer loaded with Operating System can also
be a part of network whether it is small or large
network.
• Maintenance of system and network is a task
of System / Network Administrator’s job. 
2
1. ifconfig
• ifconfig (interface configurator) command is used to initialize
an interface, assign IP Address to interface and
enable or disable interface on demand.
With this command you can view: 
• IP Address and Hardware / MAC address assign to interface
•  MTU (Maximum transmission unit) size.
NOTE:
• Ifconfig command only shows specific interface details like IP
Address, MAC Address etc.
• with -a options will display all available interface details if it is
disable also.

3
4
5
• Assigning IP Address and Gateway

• Enable or Disable Specific Interface


#ifup eth0
#ifdown eth0
• Setting MTU Size
– By default MTU size is 1500. We can set required MTU size with below command.
Replace XXXX with size.
– # ifconfig eth0 mtu XXXX
• Set Interface in Promiscuous mode
– # ifconfig eth0 – promisc

Note: Network interface only receive packets belongs to that particular NIC. If


you put interface in promiscuous mode it will receive all the packets. This is
very useful to capture packets and analyze later. For this you may require
superuser access.

6
2. PING
• PING (Packet INternet Groper) command is the best way to
test connectivity between two nodes.
• Whether it is Local Area Network (LAN) or Wide Area
Network (WAN).
• Ping use ICMP (Internet Control Message Protocol) to
communicate to other devices.
• You can ping using host name or ip address .
#ping vit.ac.in
Or
#ping 192.168.64.3

7
8
In Linux ping command keep executing until you interrupt.
Ping with -c option exit after N number of request (success or
error respond).

9
3. TRACEROUTE
• traceroute is a network troubleshooting utility
which shows number of hops taken to reach
destination also determine packets travelling path.
• NOTE: tracepath performs a very simlar
function to traceroute the main difference is
that tracepath doesn't take complicated options.
• Below we are tracing route to global DNS server IP
Address and able to reach destination also shows
path of that packet is travelling.

10
11
4. NETSTAT
• netstat (network statistics) is one of the most basic
network service debugging tool for monitoring network
both incoming and outgoing connections as well as
viewing routing tables, interface statistics etc. 
• It is very useful tool in terms of troubleshooting
network related problems and determine network
traffic performance. 
• NOTE: ss command is a replacement for netstat. 
– Using ss command, you can get more information than
netstat command.
– ss command is fast because it gets all the information from
the kernel userspace.

12
Netstat Examples

13
Listing all the LISTENING Ports of TCP and UDP connections using netstat -a option

14
Listing only TCP Ports connections using netstat -at

15
Listing only UDP Ports connections using netstat -au

16
Listing all active LISTENING Connections with netstat -l

17
Listing all active TCP Listening Ports using option netstat -lt

18
Listing all UDP Listening Ports by using option netstat -lu.

19
Listing all UNIX Listening Ports using netstat -lx.

20
Showing Statistics by Protocol
•  By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols.
The -s parameter can be used to specify a set of protocols.

21
Showing Statistics by TCP Protocol using option netstat -st.

22
Showing Statistics by UDP Protocol using option netstat -st.

23
Displaying Service name with PID
using option netstat -tp will display “PID/Program Name”.

24
Showing Network Interface Transactions -  including both
transferring and receiving packets with MTU size.

25
Print Netstat Information Continuously

26
Finding Listening Programs running on a port

27
Displaying RAW Network Statistics

28
5. DIG Command
• Dig stands for (Domain Information Groper) is a network
administration command-line tool for querying Domain
Name System (DNS) name servers.
• It is useful for verifying and
troubleshooting DNS problems and also to
perform DNS lookups and displays the answers that are
returned from the name server that were queried.
• dig is part of the BIND domain name server software
suite.
• dig command replaces older tool such as nslookup and
the host.
• dig tool is available in major Linux distributions.

29
Dig Examples

30
Query Domain “A” Record

Above command causes dig to look up the “A” record


for the domain name yahoo.com. Dig command reads
the/etc/resolv.conf file and querying the DNS servers
listed there. The response from the DNS server is what
dig displays.
31
Query Domain “A” Record with +short

• By default dig is quite verbose. One way to cut down the


output is to use the +short option. which will drastically cut
the output as shown below.

32
Querying MX Record for Domain

• Note: By default dig looks for the “A” record of the domain


specified, but you can specify other records also.
TheMX or Mail eXchange record tells mail servers how to
route the email for the domain. Likewise TTL, SOA etc.

33
Querying SOA Record for Domain

34
Querying ALL DNS Records Types

35
DNS Reverse Look-up

36
Querying Multiple DNS Records

• Query multiple website’s DNS specific query


viz. MX, NS etc. records.

37
6. NSLOOKUP
• nslookup is a command-line administrative tool for testing and
troubleshooting DNS servers (Domain Name Server). It is used to
query specific DNS resource records (RR) as well. 

EXPLORE YOURSELF WITH OPTIONS ????


38
7. ROUTE
• route command shows and manipulate ip routing table.
• To see default routing table in Linux, type the following
command.

39
• Route Adding
# route add -net 10.10.10.0/24 gw 192.168.0.1

• Route Deleting
# route del -net 10.10.10.0/24 gw 192.168.0.1

• Adding default Gateway


# route add default gw 192.168.0.1

40
8. HOST

• host command to find name to IP (or) IP to name


in IPv4 or IPv6 and also query DNS records.

41
9. ARP
• ARP (Address Resolution Protocol) is useful to view / add the contents of
the kernel’s ARP tables. To see default table use the command as.

42
10. HOSTNAME Command

• hostname is to identify in a network.


• Execute hostname command to see the hostname of your
box.
• You can set hostname permanently in /etc/sysconfig/network.
• Need to reboot box once set a proper hostname.
# hostname
tecmint.com
To set a new hostname for the machine.
#sudo hostname temp.com

43
11. GUI tool system-config-network
• Type system-config-network in command prompt to configure network
setting and you will get nice Graphical User Interface (GUI) which may also
use to configure IP Address, Gateway, DNS etc. as shown below image.

44

You might also like