Kamis, 31 Maret 2011

USEFULL LINUX NETWORKING COMMAND

• /etc/rc.d/init.d/network start - command to start, restart or stop the network
• netstat - Display connections, routing tables, stats etc
o List externally connected processes: netstat -punta
 -a: Show both listening and non-listening sockets.
 -p: Show PID of process owning socket
 -u: Show UDP

 -t: Show TCP
 -n: Show IP addresses only. Don't resolve host names
 -g: Show multi-cast group membership info
 -c: Continuous mode - update info every second
 -v: Verbose
 -e: Extended information
 -o: show network timer information
o List all connected processes: netstat -nap
o Show network statistics: netstat -s
o Display routing table info: netstat -rn
$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
o Flags:
 G: route uses gateway
 U: Interface is "up"
 H: Only a single host is accessible (eg. loopback)
 D: Entry generated by ICMP redirect message
 M: Modified by ICMP redirect message
o Display interface statistics: netstat -i
$ netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 2224 0 0 0 1969 0 0 0 BMRU
lo 16436 0 1428 0 0 0 1428 0 0 0 LRU
o Where:
 RX-OK/TX-OK: number of packets transmitted/received error free
 RX-ERR/TX-ERR: number of dammaged/error packets transmitted/received
 RX-DRP/TX-DRP: number of dropped packets
 RX-OVR/TX-OVR: number of packets dropped because of a buffer overrun
o Flags:
 B: A broadcast address has been set
 L: This interface is a loopback device
 M: All packets are received (promiscuous mode)
 N: Trailers are avoided
 O: ARP is turned off for this interface
 P: Point-to-point connection
 R: Interface is running
 U: Interface is up
• ping - send ICMP ECHO_REQUEST packets to network hosts. Use Cntl-C to stop ping.
• traceroute - print the route packets take to network host.
(Ubuntu Note: Typically Ubuntu installs tracepath for IPv4 and traceroute6 for IPv6. One can install traceroute: apt-get install traceroute)
o traceroute IP-address-of-server
o 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.
o mtr IP-address-of-server
o 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.





0 komentar:

Posting Komentar