Skip to content

Instantly share code, notes, and snippets.

@jestan
Created August 23, 2013 12:58
Show Gist options
  • Select an option

  • Save jestan/6319076 to your computer and use it in GitHub Desktop.

Select an option

Save jestan/6319076 to your computer and use it in GitHub Desktop.
Linux Network Diagnostics
# PING is all about host reachability
1. Test the reachability
> ping <destination>
2. Test packet losses with large packets
> ping <destination> -s <packet size>
# Diagnose routes
1. Trace the route for a destination
> traceroute <destination>
> tracepath <destination>
2. Show all routes
> route
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.8 0.0.0.0 UG 0 0 0 eth1
link-local * 255.255.0.0 U 1000 0 0 eth1
192.168.0.0 * 255.255.255.0 U 2 0 0 eth1
Here
U : This flag signifies that the route is up
G : This flag signifies that the route is to a gateway. If this flag is not present
then we can say that the route is to a directly connected destination
H : This flag signifies that the route is to a host which means that the destination
is a complete host address. If this flag is not present then it can be assumed
that the route is to a network and destination would be a network address.
D : This flag signifies that this route is created by a redirect.
M : This flag signifies that this route is modified by a redirect.
# Diagnose firewall issue
1. List all firewall rules
> iptables --line-numbers -n -L
# Diagnose TCP/UDP/SCTP Connectivity
1. TELNET
> telnet <destination> <port>
2. NETCAT/ NC
Server: > netcat -l <source> 8080
Client: > netcat <destination> 8080
3. Diagnose SCTP Connectivity
Server: > sctp_test -H <source> -P <source-port> -l
Client: > sctp_test -H <source> -P <source-port> -h <destination> -p <destination-port> -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment