When your Linux server seems to have network issues, you should be able to log in via VNC console to troubleshoot the issue
Mostly used Linux network commands:
ip addr show # Displays the addresses for every link configured on the system. Locate the eth0
link, which connects the host to the wider network on most systems. The inet
field displays the Ipv4 address. It replaces the old ifconfig command
ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether f2:3c:93:60:50:30 brd ff:ff:ff:ff:ff:ff inet 178.00.000.000/24 brd 178.00.000.255 scope global eth0 valid_lft forever preferred_lft forever inet6 2a01:7e00::f03c::5030/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 5155sec preferred_lft 1555sec inet6 fe80::f03c::5030/64 scope link valid_lft forever preferred_lft forever
ifconfig #only displays enabled interfaces.
ping # Test network connectivity to a remote host
ping google.com PING google.com (200.0.000.000) 56(84) bytes of data. 64 bytes from par.net (200.0.000.000): icmp_seq=1 ttl=117 time=21.4 ms 64 bytes from par.net (200.0.000.000): icmp_seq=2 ttl=117 time=23.6 ms
mtr # combines the functionality of traceroute
and ping
to provide continuous traceroute-like output for network diagnostics. It sends ICMP ECHO requests to each router on the path to a destination host, showing both the round-trip time and packet loss percentage at each hop.
mtr google.com My traceroute [v0.92] hostname (0.0.0.0) Thu Jun 21 12:00:00 2024 Keys: Help Display mode Restart statistics Order of fields quit Packets Pings Host Loss% Snt Last Avg Best Wrst StDev 1. router1 0.0% 5 1.0 1.2 0.9 1.5 0.2 2. isp-router 0.0% 5 9.1 10.2 8.3 12.5 1.2 3. destination-router 0.0% 5 20.5 15.9 14.3 20.5 2.0 4. google.com 0.0% 5 21.7 18.3 17.1 21.7 1.8
iperf # widely used tool for network performance measurement and tuning. Iperf has client and server functionality, it allows you to measure various parameters of a network connection, such as bandwidth, latency, and packet loss.
netstat # Display all the active network connections, routing tables, and interface statistics on your Linux system.
This helps in understanding what applications or daemons are running and potentially causing issues, crucial for troubleshooting port conflicts or unauthorized services running on unexpected ports.
Useful in verifying firewall rules and monitoring for unauthorized services or suspicious network activity
netstat -tulpn #shows all programs listening for connections, along with their details like ports and IDs, using numbers instead of names. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:46565 0.0.0.0:* LISTEN 1616/eidLvUIServer tcp6 0 0 :::45623 :::* LISTEN 71127/AppRun.wrappe tcp6 0 0 :::5061 :::* LISTEN 71127/AppRun.wrappe tcp6 0 0 ::1:631 :::* LISTEN - tcp6 0 0 :::1716 :::* LISTEN 1614/kdeconnectd udp 0 0 0.0.0.0:52881 0.0.0.0:* -