Network Configuration and Troubleshooting Commands
Network Configuration and Troubleshooting Commands
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
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
32
Querying MX Record for Domain
33
Querying SOA Record for Domain
34
Querying ALL DNS Records Types
35
DNS Reverse Look-up
36
Querying Multiple DNS 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.
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
40
8. HOST
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
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