If you want to be the master of your VPS or dedicated server you must know some basic networking commands to troubleshoot connection issues or to find out more information about your or someone else server.
This guide will not go into any depth for each command, thats what the man pages are for 🙂 This is here as a cheat-sheet to keep close when you need it.
Lets get started, the commands are listed in alphabetical order:
This command manipulates the kernel’s ARP cache in various ways. The primary options are clearing an address mapping entry or manually setting up one.
For debugging purposes, the arp program also allows a complete dump of the ARP cache.
This command is used to check all network interfaces. Using the ifconfig command without parameters will show you details of already configured network cards or interfaces. This is a great way to get a check that your network hardware is working properly.
OpenVZ [precode] ifconfig venet0:0[/precode] or [precode]ifconfig venet0[/precode]
KVM or dedicated [precode] ifconfig eth0 [/precode]
This command displays all sockets and server connections. This is usually very helpful for webserver administrating.
Example: [precode] netstat -nap[/precode]
This command shows you the IP (n) instead of hostname, all (a) listening ports and what program/pid (p) is listening on that port.
You can use this command to check the domain name and IP information of a server, user -query=<type> to change what type of information you are looking for.
Example: [precode]nslookup -query=ns lowendguide.com [/precode]
As you can guess, ping is used to ping a server to check if it works properly
Example: [precode]ping lowendguide.com
PING lowendguide.com (22.214.171.124) 56(84) bytes of data.
64 bytes from www.lowendguide.com (126.96.36.199): icmp_req=1 ttl=46 time=129 ms
PING lowendguide.com(www.lowendguide.com) 56 data bytes
64 bytes from www.lowendguide.com: icmp_seq=1 ttl=45 time=905 ms
This command has the same usage as the command netstat -r. Route (without parameters) will display a list of the routing tables for your server.
You can manually add/remove routes, meaning you can force traffic to go one specific way to reach it’s destination.
This is a very powerful network command that basically gives the exact route between your machine and a server. It is used to trace the existing network routing for a remote or local server.
Example: [precode] traceroute lowendguide.com [/precode]
mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.
mtr supports both IPv6 and IPv4 and will default to IPv6 when available. It is possible to force and IPv4 trace using the ‘-4‘ switch.
Example: [precode] mtr lowendguide.com [/precode]