CN Lab1
CN Lab1
CN Lab1
1) Ifconfig
The command ifconfig stands for interface configurator. This command enables us to initialize
an interface, assign IP address, enable or disable an interface. It display route and network
interface.
We can view IP address, MAC address and MTU (Maximum Transmission Unit) with ifconfig
command.
Look at the above snapshot, it shows the IP address of eth and lo.
2) Ip
Linux IP command is the newer version of the ifconfig command. It is a handy tool for
configuring the network interfaces for Linux administrators. It can be used to assign and remove
addresses, take the interfaces up or down, and much more useful tasks.
Syntax:
Route: It contains the protocols that manage the routing of traffic sent to addresses via
interfaces (links).
3) traceroute
Linux traceroute command is a network troubleshooting utility that helps us determine the
number of hops and packets traveling path required to reach a destination. It is used to display
how the data transmitted from a local machine to a remote machine. Loading a web page is one
of the common examples of the traceroute. A web page loading transfers data through a
network and routers. The traceroute can display the routes, IP addresses, and hostnames of
routers over a network. It can be useful for diagnosing network issues.
- The first line is displaying the hostname and IP address that is to be reached, hops that
are going to be attempted by the traceroute command, and the size of the packets to be
sent.
- From the second line, each line is displaying a hop to the destination. And the hostname
followed by the IP address of the host, roundtrip time. The roundtrip time is the sum of
time that it takes for a signal to be sent and the time it takes to respond to the host.
- The '*' symbol represents the packet loss. The packet loss happens because of a network
outage, high traffic to network congestion, or maybe the firewall is dropping traffic. In
much loss of packet, the traceroute will display the error as "destination is not reached."
- By default, it sends three packets for each host, so three response times are listed.
4) tracepath
tracepath <destination>
In the above snapshot, path to the google.com is being traced by the tracepath command.
5) Ping
ping command stands for (Packet Internet Groper). It checks connectivity between two nodes to
see if a server is available. It sends ICMP ECHO_REQUEST packets to network hosts and displays
the data on the remote server's response. It checks if a remote host is up, or that network
interfaces can be reached. Further, it is used to check if a network connection is available
between two devices.
To check if a remote host is up, execute the ping command, followed by the remote server's
hostname or IP address. Consider the below command:
ping -4 google.com
6) netstat
Linux netstat command stands for Network statistics. It displays information about different
interface statistics, including open sockets, routing tables, and connection information. Further,
it can be used to displays all the socket connections (including TCP, UDP). Apart from connected
sockets, it also displays the sockets that are pending for connections. It is a handy tool for
network and system administrators.
To display only the TCP connection, execute the command with the 't' option as follows: netstat
-at
To display only UDP connection, execute it with 'u' option as follows: netstat -au
7) ss
The ss command is a replacement for netstat command. This command gives more information
in comparison to the netstat. It is also faster than netstat as it gets all information from kernel
userspace.
8) dig
Linux dig command stands for Domain Information Groper. This command is used for tasks
related to DNS lookup to query DNS name servers. It mainly deals with troubleshooting DNS
related problems. It is a flexible utility for examining the DNS (Domain Name Servers). It is used
to perform the DNS lookups and returns the queried answers from the name server. Usually, it is
used by most DNS administrators to troubleshoot the DNS problems. It is a straightforward tool
and provides a clear output. It is more functional than other lookups tools.
9) nslookup
This command is also used to find DNS related query.
nslookup google.com
10) route
It shows that if the destination is within the network range of 10.0.0.0 to 10.0.0.255, then the
gateway is *, which is 0.0.0.0. This is a special address which represents an invalid or non-
existent destination.
Packets which are not within this IP range, will be forwarded to default gateway, which further
routes the packet.
11) Host
Linux host command displays domain name for given IP address or vice-versa. It also performs
DNS lookups related to the DNS query. The host command's default behavior displays a summary
of its command-line arguments and supported options.
The above command will use the Ipv4 address for query transport on the given domain name.
12) Arp
The command arp stands for Address Resoslution Protocol. It allows us to view or add content
into kernel's ARP table.
command arp displays ARP table.
13) Iwconfig
The command iwconfig configures a wireless network interface. We can view and set basic wi-fi
details like SSID and encryption.
Iwconfig is similar to ifconfig(8), but is dedicated to the wireless interfaces. It is used to set the
parameters of the network interface which are specific to the wireless operation (for example :
the frequency). Iwconfig may also be used to display those parameters, and the wireless
statistics (extracted from /proc/net/wireless).
All these parameters and statistics are device dependent. Each driver will provide only some of
them depending on hardware support, and the range of values may change. Please refer to the
man page of each device for details.
14) Hostname
Linux hostname command allows us to set and view the hostname of the system. A hostname is
the name of any computer that is connected to a network that is uniquely identified over a
network. It can be accessed without using a particular IP address.
These commands are used to download a file from the internet using CLI. With curl commands
option O will be used while wget command will be used without any option. The file will be
saved in the current directory.
16) Mtr
The mtr command is a combination of ping and traceroute commands. It is a network diagnostic
tool that continuously sends packets showing ping time for each hop. It also displays network
problems of the entire route taken by the network packets.
mtr --csv google.com
The mtr command supports Xml format output. To display the Xml output, pass the '--xml'
option with mtr command. The Xml format is useful for automated processing.
17) whois
The whois command displays information about a website's record. We may get all the
information about a website regarding its registration and owner's information.
This command performs a WHOIS lookup for the IP address "8.8.8.8" and provides information
about the associated organization.
18) tcpdump
The tcpdump command is widely used in network analysis with other commands of the Linux
network. It analyses the traffic passing from the network interface and shows it. When
balancing the network, this type of packet access will be crucial.
This command captures packets on the eth0 network interface