Network Troubleshooting on Linux
Network troubleshooting can be complicated depends on what tool and restriction on the environment. List some common commands for debugging network connectivity.
Netshoot
Netshoot is a handy docker image packed with all kinds of tools for debugging network, especially in a docker / kubernetes environment.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
apiVersion: v1
kind: Pod
metadata:
name: netshoot
namespace: default
spec:
containers:
- name: netshoot
image: nicolaka/netshoot
command:
- sleep
- "infinity"
imagePullPolicy: IfNotPresent
restartPolicy: Always
Commands
ip
1
2
3
4
5
ip address
ip link
ip addr
ifconfig
arp
dns
/etc/hosts: local DNS record
/etc/resolv.conf: DNS server location
/etc/nsswitch.conf: change DNS resolve order
1
2
3
4
5
6
7
8
9
dig www.google.com
nslookup www.google.com
host www.google.com
# operating system name
uname
# host system name
hostname
Check local process and its listening port
1
sudo lsof -iTCP -sTCP:LISTEN -n -P
openssl
1
2
# view website certificate
openssl s_client -showcerts -connect www.cisco.com:443
curl
1
2
3
4
5
6
7
8
# skip ssl verification, add log, auto redirect
curl -kvvv -L google.com
# custom ca cert
curl --cacert ./cacert.pem google.com
# telnet protocol
curl telnet://192.168.11.2:22
This post is licensed under CC BY 4.0 by the author.
