Command: network related commands

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:

arp

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.

Example:[precode]arp -van[/precode]

ifconfig

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.

Example:

OpenVZ [precode] ifconfig venet0:0[/precode] or [precode]ifconfig venet0[/precode]

KVM or dedicated [precode] ifconfig eth0 [/precode]

netstat

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.

nslookup

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]

ping/ping6

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 (192.71.245.185) 56(84) bytes of data.
64 bytes from www.lowendguide.com (192.71.245.185): icmp_req=1 ttl=46 time=129 ms

[/precode]

[precode]

ping6 lowendguide.com
PING lowendguide.com(www.lowendguide.com) 56 data bytes
64 bytes from www.lowendguide.com: icmp_seq=1 ttl=45 time=905 ms

[/precode]

route

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.

Example: [precode]route[/precode]

You can manually add/remove routes, meaning you can force traffic to go one specific way to reach it’s destination.

traceroute/traceroute6

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]

[precode]traceroute6 lowendguide.com[/precode]

mtr

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]

4 comments for “Command: network related commands

  1. April 18, 2013 at 11:55

    start a facebook

  2. April 28, 2013 at 14:47

    My brother recommended I may like this blog. He was once entirely right.
    This post actually made my day. You can not consider just how so much time I
    had spent for this info! Thanks!

    • Andralyn
      January 23, 2014 at 09:32

      Enhgnlteiing the world, one helpful article at a time.

Leave a Reply

Your email address will not be published. Required fields are marked *