Saturday, August 23, 2008

Usefull Linux networking commands:

  • /etc/rc.d/init.d/network start - command to start, restart or stop the network
  • netstat - Display connections, routing tables, stats etc
    • List externally connected processes: netstat -punta
    • List all connected processes: netstat -nap
    • Show network statistics: netstat -s
    • Kernel interface table info: netstat -a -i eth0
  • ping - send ICMP ECHO_REQUEST packets to network hosts. Use Cntl-C to stop ping.
  • traceroute - print the route packets take to network host
    • traceroute IP-address-of-server
    • traceroute domain-name-of-server
  • mtr - a network diagnostic tool introduced in Fedora - Like traceroute except it gives more network quality and network diagnostic info. Leave running to get real time stats. Reports best and worst round trip times in milliseconds.
    • mtr IP-address-of-server
    • mtr domain-name-of-server
  • whois - Lookup a domain name in the internic whois database.
  • finger - Display information on a system user. i.e. finger user@host Uses $HOME/.plan and $HOME/.project user files. Often used by game developers. See http://finger.planetquake.com/
  • iptables - IP firewall administration (Linux kernel 2.6/2.4) See YoLinux firewall/gateway configuration.
  • ipchains - IP firewall administration (Linux kernel 2.2) See YoLinux firewall/gateway configuration.
  • socklist - Display list of open sockets, type, port, process id and the name of the process. Kill with fuser or kill.
  • host - Give a host name and the command will return IP address. Unlike nslookup, the host command will use both /etc/hosts as well as DNS.
    Example: host domain-name-of-server
  • nslookup - Give a host name and the command will return IP address. Also see Testing your DNS (YoLinux Tutorial) Note that nslookup does not use the /etc/hosts file.

No comments: