0% found this document useful (0 votes)
78 views

Linux Ubuntu 12.04: Network Commands 2

This document provides information on several Linux network tools including netstat, tcpdump, ping, traceroute, host, and nmap. It describes what each tool is used for and provides basic usage examples. Netstat displays network connections and statistics. Tcpdump captures and analyzes network packets. Ping sends echo requests to test network connectivity. Traceroute shows the network path to a destination. Host looks up IP addresses and DNS records. Nmap scans networks to determine available services and open ports.

Uploaded by

harish sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Linux Ubuntu 12.04: Network Commands 2

This document provides information on several Linux network tools including netstat, tcpdump, ping, traceroute, host, and nmap. It describes what each tool is used for and provides basic usage examples. Netstat displays network connections and statistics. Tcpdump captures and analyzes network packets. Ping sends echo requests to test network connectivity. Traceroute shows the network path to a destination. Host looks up IP addresses and DNS records. Nmap scans networks to determine available services and open ports.

Uploaded by

harish sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Network Commands 2

LINUX UBUNTU 12.04

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

yum install tcpdump

yum stands for "Yellowdog Updater Modified".


It is an interactive, rpm-based package manager.
TOOLS FOR NETWORK CONFIGURATION
ping
The ping command (named after the sound of an
active sonar system) sends( ICMP protocol's
mandatory ECHO_REQUEST datagram) echo
requests to the host you specify on the command
line, and lists the responses received their round trip
time.You simply use ping as:

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

Send N packets and stop


Send N packets specified with -c option and then
stop. This way the ping command can exit
automatically instead of pressing CTRL+C to exit.
ping -c 5 google.com
In the following example, ping command sends 5
packets, and waits for response from the destination
host. Ping will exit after receiving the response or
error.
TOOLS FOR NETWORK CONFIGURATION

Print Only Ping Command Summary Statistics


Use option -q to view only the ping statistics
summary as shown below.
ping -c 5 -q 127.0.0.1
TOOLS FOR NETWORK CONFIGURATION

Change Ping Packet Size


You can change the packet size of ping command
using -s option.
Example: Change the default packet size from 56 to
100.
ping -s 100 localhost

Ping Bytes Sent = Ping Packet Size + Ping Header


Packet Size (28 bytes)
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/

You might also like