Linux Ubuntu 12.04: Network Commands 2
Linux Ubuntu 12.04: Network Commands 2
A.S
TOOLS FOR NETWORK CONFIGURATION
netstat
Displays contents of /proc/net files. It works with
the Linux Network Subsystem, it will tell you what
the status of ports are ie.
open, closed, waiting, masquerade connections. It
will also display various other things. It has many
.different options
Listing all ports (both TCP and UDP) using netstat -a
option
netstat -a | more
TOOLS FOR NETWORK CONFIGURATION
Showing Statistics by Protocol
Displays statistics by protocol. By default, statistics
are shown for the TCP, UDP, ICMP, and IP protocols.
The -s parameter can be used to specify a set of
.protocols
netstat –s
Showing Statistics by TCP Protocol
Showing statistics of only TCP protocol by using
option
netstat -st
TOOLS FOR NETWORK CONFIGURATION
Showing Network Interface Transactions
Showing network interface packet transactions
including both transferring and receiving packets
.with MTU size
netstat –i
Finding Listening Programs
Find out how many listening programs running on a
.port
netstat -ap | grep http
TOOLS FOR NETWORK CONFIGURATION
tcpdump
This is a sniffer, a program that captures packets off a
network interface and interprets them for you. It understands
all basic internet protocols, and can be used to save entire
packets for later inspection.
Install tcpdump in Linux
ping ip_or_host_name
Note to stop ping (otherwise it goes forever)
use CTRL-C (break).
TOOLS FOR NETWORK CONFIGURATION
Check whether the local network interface is up and
running
Ping localhost using zero (0)
ping 0
Ping localhost using name
ping localhost
Ping localhost using ip
ping 127.0.0.1
TOOLS FOR NETWORK CONFIGURATION
traceroute
traceroute will show the route of a packet. It
attempts to list the series of hosts through
which your packets travel on their way to a given
destination. Also have a look at xtraceroute (one of
severalgraphical equivalents of this program).
Command syntax:
traceroute machine_name_or_ip
TOOLS FOR NETWORK CONFIGURATION
Traceroute Examples
to find the network path from my machine to google.com :
traceroute google.com
The ‘*’ field in output
There are times when one could encounter an ‘*’ in the
output rather than a value. This depicts that the required
field could not be fetched. The reason can be anything from
reverse DNS lookup failure to packets not hitting the target
router to packets getting lost on their way back. So we see
that the reason could be many but for all these type of
cases the traceroute utility provides an * in the output.
TOOLS FOR NETWORK CONFIGURATION
HOST Command
host command to find name to IP or IP to name
in IPv4 or IPv6 and also query DNS records.
host www.google.com
Using -t option we can find out DNS Resource
Records like CNAME, NS, MX, SOA etc.
host -t CNAME www.redhat.com
TOOLS FOR NETWORK CONFIGURATION
nmap
“ network exploration tool and
security scanner”. nmap is a very advanced network
tool used to query machines (local or remote) as to
whether they are up and what ports are open on
these machines.
A simple usage example:
nmap machine_name
More information :
http://nmap.org/