Program 1 : FAMILIARISATION OF
NETWORK COMMANDS
AIM :
To get started with basics of network configurations,files and
networking commands in Linux.
THEORY :
Linux Networking Commands
1. ifconfig
• Linux ifconfig stands for interface configurator
• It is one of the most basic commands used in network inspection.
• ifconfig is used to initialise an interface, configure it with an IP
address, and enable or disable it.
• It is also used to display the route and the network Interface.
• Basic information displayed upon using ifconfig are:
◦ IP address
◦ MAC address
◦ MTU(Maximum Transmission Unit)
• Syntax: ifconfig [...OPTIONS] [INTERFACE]
• To install: sudo apt-get install net-tools ifconfig -s
2. Ip
• This is the latest and updated version of ifconfig command
3. Ping
• It is used to test the connectivity of a network considered
• ping stands for Packet INternet Groper
• Ping works by sending one or more ICMP (Internet Control Message
Protocol) Echo Request packages to a specified destination IP on the
network and waits for a reply
• It keeps executing until it is interrupted (Use Ctrl+C Key to interrupt
the execution)
• When the destination receives the package, it responds with an ICMP
echo reply.
• With the ping command, we can determine whether a remote
destination IP is active or inactive
• We can also find the round-trip delay in communicating with the
destination and check whether there is a packet loss
Syntax: ping [OPTIONS] DESTINATION
4. Traceroute
• Linux traceroute is one of the most useful commands in networking
which is used to troubleshoot the network
• Detects the delay and determines the pathway to the target
• It basically helps in the following ways:
◦ Provides the names and identifies every device on the path
◦ Follows the route to the destination
◦ Determines where the network latency comes from and reports it
Syntax: traceroute [options] host_Address [pathlength]
5. tracepath
• Linux tracepath is similar to traceroute command
• It is used to detect network delays
• It doesn't require root privileges
• It is installed in Ubuntu by default
• It traces the route to the specified destination and identifies each hop
in it
• If your network is weak, it recognizes the point where the network is
weak
Syntax: tracepath [-n] [-b] [-l pktlen] [-m max] [-port] destination
6. netstat
• Linux netstat command refers to the network statistics
• It provides statistical figures about different interfaces which include
open sockets, routing tables, and connection information
Syntax: netstat -at : To list all tcp ports
7. ss
• Linux ss command is the replacement for netstat command
• Regarded as a much faster and more informative command than
netstat
• The faster response of ss is possible as it fetches all the information
from within the kernel userspace
• This command gives information about all TCP, UDP, and UNIX
socket connections
• Use -t, -u, -x in the command respectively to show TCP/UDP or UNIX
sockets
• Combine each of these with "a" to show the connected and listening
sockets
Syntax: ss <options>
8. dig
• Linux dig command stands for Domain Information Groper
• This command is used in DNS lookup to query the DNS name server
• It is also used to troubleshoot DNS related issues
• It is mainly used to verify DNS mappings, MX Records, host
addresses, and all other DNS records for a better understanding of
the DNS topography
• This command is an improvised version of nslookup command
Syntax: dig [server] [name] [type]
[server] – The hostname or IP address the query is directed to
[name] – The DNS (Domain Name Server) of the server to query
[type] – The type of DNS record to retrieve. By default (or if left
blank), dig uses the A record type
9.
10. nslookup
• Linux nslookup is also a command used for DNS related queries
• It is the older version of dig
• nslookup (Name Server Lookup) is a useful command for getting
information from DNS server
• It is a network administration tool for querying the Domain Name
System(DNS) to obtain domain name or IP address mapping or any
other specific DNS record.
• It is also used to troubleshoot DNS related problems
Syntax: nslookup [option]
11. route
• Linux route command displays and manipulates the routing table
existing for your system
• A router is basically used to find the best way to send the packets
across to a destination
Syntax: route -n
12. host
• Linux host command displays the domain name for a given IP address
and IP address for a given hostname
• It is also used to fetch DNS lookup for DNS related query
Syntax:
host [-aCdlriTWV] [-c class] [-N ndots] [-t type] [-W
time][-R number] [-m flag] hostname [server]
13. arp
• Linux arp command stands for Address Resolution Protocol
• It is used to view and add content to the kernel's ARP table
• All the systems maintain a table of IP addresses and their
corresponding MAC addresses. This table is called the ARP Lookup
table
• When a destination is requested to connect through IP address, your
router will check for the MAC address in this table. If it is cached, the
table will not be used
• By default, arp displays the hostnames
Syntax: arp [-v] [-i if] [-H type] -a [hostname]
14. iwconfig
• Linux iwconfig is used to configure the wireless network interface
• It is used to set and view the basic WI-FI details like SSID and
encryption
15. hostname
• Linux hostname is the simple command used to view and set the
hostname
of a system
16. curl & wget
• Linux curl and wget commands are used in downloading files from
the internet through CLI
• The curl command has to be used with the option "O" to fetch the file,
while the wget command is used directly
17. tcpdump
• Linux tcpdump command is the most used command in network
analysis among other Linux network commands
• It captures the traffic that is passing through the network interface
and displays it
• This kind of access to the packet will be crucial when troubleshooting
the Network
18. iftop
• Linux iftop command is used in traffic monitoring
19. whois
• Linux whois command is used to fetch all the information related to a
website
• You can get all the information about a website including the
registration
and the owner information
20. mtr
• ethtool is a networking utility on Linux
• It is used to configure Ethernet devices on Linux
Practice Questions
1. View the configuration, including addresses of your computers’
network interfaces
Ans: ifconfig
2. Test the network connectivity between your computer and several
other computers
Ans: ping
3. View the active TCP connections in the computer after visiting a
Website
Ans: netstat -at
4. Find the hardware/MAC address of another computer in the
network using ARP
Ans: arp -a
RESULT : Familiarisation of network commands successfully completed.