Useful command To Checking Connectivity of Network -
- ping
- ss
- netstat
- route
- tcmpdump
- wireshark
- munin
- cacti
Ping - to use ping command for checking IP or host or network is reachable or not
Ex- ping < network )
# ping 10.10.10.1
SS - socket statistics - to know all information about TCP/UDP Connection , Established Connection , protocol , TCP socket etc.
# ss
Option
-a = Display all info
-l = Display all open port/socket
-o = Show time info
-m = Show memory info
-p = Show process info
-i = Show internet TCP/IP information
-r = Resolve host name
-4 = Display only IPv4 socket
-6 = Display only IPv6 socket
Netstat - t o see the information about network connection , routing table , interface etc.
# netstat
Option
-t = display all tcp connection
-u = display all UDP connection
-r = display all routing table
-s = display networking statistics
-v = verbos mode
-l = list all open socket
-a = all
-o = display time
route = to see the routing table , add new route etc
# route
Option
-v, --verbose be verbose
-n, --numeric don t resolve names
-e, --extend display other/more information
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
To add default getaway
# route add default gw 10.10.10.1
To set route for 2 different network
For example , we have 2 eth one is direct broadband connection establish by modem & second eth1 we gave IP 10.10.10.100 & netmask 255.255.0.0 we do not give gateway
To add route command
#route add -net < network> netmask <netmask> gw <getaway>
Ex - # route add -net 10.10.20.0 netmask 255.255.0.0 gw 10.10.10.1
Ex - # route add -net 10.10.30.0 netmask 255.255.0.0 gw 10.10.10.1
To reject particular host/IP/Network
# route add -host 10.10.10.200 reject
Tcmpdump - is an command-line packet capture and analyzer tool for monitoring network traffic.
# yum install tcpdump
Command
# tcpdump
Specific interface
# tcpdump -i eth0
Display Available interface
# tcpdumb -D
Capture packet in ASCII Format
# tcpdump -A -i eth0
Capture packet in HEX & ASCII Format
# tcpdump -XX -i eth0
Capture packet & save in file : here *.pcap is file format
# tcpdump -w 0001.pcap -i eth1
Read capture packet file
# tcpdump -r 0001.pcap
Capture IP Address Packet
# tcpdump -n -i eth0
Capture TCP Packet
# tcpdump -i eth0 tcp
Capture packet form specific port
# tcpdump -i eth0 port 22
Capture packet form source IP
# tcpdump -i eth0 src 10.20.2.33
Capture packet form Destination IP
#tcpdump -i eth0 dst 10.20.2.126
Wireshark - is an open source network protocol analyzer that is used to troubleshoot network related issues.
# yum install wireshark*
Munin - is an web based network and system monitoring application that is used to display results in graphs using rrdtool.