CN Network Commands

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

CN Experiment - 2

Aim - Use basic networking commands in Linux (ping, tracert, nslookup,


netstat, ARP, RARP, ip, ifconfig, dig, route ) Command Prompt

Theroy –

The following are few of the basic networking commands used in the
Linux operating system:

1. Ping command

Function: The ping command is a Command Prompt command used to


test the ability of the source computer to reach a specified destination
computer.It's usually used as a simple way to verify that a computer can
communicate over the network with another computer or network device.
The ping command operates by sending Internet Control Message
Protocol (ICMP) Echo Request messages to the destination computer
and waiting for a response. How many of those responses are returned,
and how long it takes for them to return, are the two major pieces of
information that the ping command provides.

Syntax:
ping [options] [destination]

Example:
ping -c 10 google.com

→ Send 10 packets to destination “google.com” and get a reply from it.


Verifies connection to google.com
2. Traceroute command

Function: Traceroute command in Linux prints the route that a packet


takes to reach the host. This command is useful when you want to know
about the route and about all the hops that a packet takes.
The first column corresponds to the hop count. The second column
represents the address of that hop and after that, you see three
space-separated time in milliseconds. traceroute command sends three
packets to the hop and each of the time refers to the time taken by the
packet to reach the hop.

Syntax:
traceroute [options] host_Address [pathlength]

Example:
traceroute -4 google.com
→ Uses IPv4 address to find a path to destination “google.com”

3. Nslookup

Function: Nslookup (stands for “Name Server Lookup”) is a useful


command for getting information from a 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.
It basically finds an address for the respective destination name.

Syntax:
nslookup [option] <domain_name>

Example:

nslookup -type=ns google.com

→ It will output the name servers which are associated with the given
domain
i.e. google.com

4. Netstat command

Function: Netstat command displays various network related


information such as network connections, routing tables, interface
statistics, masquerade connections, multicast memberships etc.,.
It is a command line utility that can be used to list out all the network
(socket) connections on a system. It lists out all the tcp, udp socket
connections and the unix socket connections. Apart from connected
sockets it can also list listening sockets that are waiting for incoming
connections.

Syntax:
netstat [option]

Example:
netstat -s
→ Lists the statistics for all available ports

5. Arp command

Function: arp command manipulates the System’s ARP cache. It also


allows a complete dump of the ARP cache. ARP stands for Address
Resolution Protocol. The primary function of this protocol is to resolve
the IP address of a system to its mac address, and hence it works
between level 2(Data link layer) and level 3(Network layer).

Syntax:
arp [options] [hostname]

Example:
arp -a
→ Shows all entries of mac Addresses of all connected devices.

6. Ip command

Function: ip command in Linux is present in the net-tools which is used


for performing several network administration tasks. IP stands for
Internet Protocol. This command is used to show or manipulate routing,
devices, and tunnels.
It can perform several other tasks like configuring and modifying the
default and static routing, setting up tunnel over IP, listing IP addresses
and property information, modifying the status of the interface, assigning,
deleting and setting up IP addresses and routes.

Syntax:
ip [ OPTIONS ] OBJECT { COMMAND | help }
Example:
ip address

→ Shows all IP addresses associated on all network devices.

7. Ifconfig command

Function: ifconfig(interface configuration) command is used to configure


the kernel-resident network interfaces. It is used at the boot time to set
up the interfaces as necessary. After that, it is usually used when
needed during debugging or when you need system tuning. Also, this
command is used to assign the IP address and netmask to an interface
or to enable or disable a given interface.

Syntax:
ifconfig [...OPTIONS] [INTERFACE]

Example:
ifconfig -a
→ Displays all the interfaces available, even if they are down.

8. Dig command

Function: dig command stands for Domain Information Groper. It is


used for retrieving information about DNS name servers. It is basically
used by network administrators. It is used for verifying and
troubleshooting DNS problems and to perform DNS lookups. Dig
command replaces older tools such as nslookup and the host.

Syntax:
dig [server] [name] [type]

Example:
dig atharvacoe.ac.in ANY

→ “ANY” option will query all the available DNS record types associated
with a domain. It will include all the available record types in the output.

Outputs:
1. Ping

2. Traceroute

3. Nslookup

4. Netstat

5. Arp

6. Ip

7. Ifconfig

8. dig

Conclusion –

Hence, we have studied and understood a few of the networking


commands and their uses provided by the Linux operating system

You might also like