Let’s Learn About Linux Networking with it’s illustration

Reading Time: 4 minutes

What is Network

Computers are connected in a network to exchange information or resources with each other. Two or more computers are connected through a network medium known as a computer network.

A computer running the Linux operating system can also be part of a network, whether it is a small network or a large network, due to its multitasking and multi-user nature.

Linux Networking Commands

ifconfig Command

The ifconfig (interface configurator) command is to initialise the interface, assign an IP address to the interface, and enable or disable the interface as required.

With this command, you can view IP Address and Hardware / MAC address assign to interface and also MTU (Maximum transmission unit) size.

COMMAND:

ifconfig

Ping Command:

The Ping (Packet INternet Groper) command is the best way to test the connection between two nodes. Whether it’s a local area network (LAN) or a wide area network (WAN).
Therefore Ping uses ICMP (Internet Control Message Protocol) to communicate with other devices. You can ping the hostname or IP address using the commands below.

COMMAND:

ping 4.2.2.2
     OR
ping www.tchmint.com

Traceroute Command:

traceroute is a network troubleshooting utility that reports the number of hops required to reach the destination and also determines the path of the packets. Below, we plot the path to the DNS server’s global IP address and possibly to the destination also showing the path this packet travels.

COMMAND:

traceroute 4.2.2.2

Netstat Command:

The Netstat (Network Statistics) command displays connection information, routing table information, and more. In addition display the routing table information use an option like -r .

Command:

netstat -r

Dig Command:

Dig (domain information provider) queries DNS related information such as records, C Names, MX records, etc. This command is mainly used to troubleshoot DNS related queries.

Command:

dig www.tecmint.com

Nslookup Command:

The nslookup command is also used to find DNS-related queries.

The following examples show a record (IP address) from tecmint.com.

  • Command:
nslookup www.tecmint.com

Route Command:

The routing command also displays and manipulates the IP routing table. To view the default routing table on Linux, enter the following command.

Command:

route

Host Command:

The host command to find the name in IP or IP to set name in IPv4 or IPv6 and also query DNS records.

Command:

host www.tecmint.com

Using -t an option to find out DNS Resource Records like CNAMENSMXSOA, etc.

host -t CNAME www.redhat.com

Arp Command:

ARP (Address Resolution Protocol) is useful for displaying/adding the contents of the kernel ARP table.

For instance To view the default table, use them as a command.

Command:

arp -e

Ethtool Command:

ethtool replaces miitool. This is for viewing, speed setting in addition with duplex printing of your network interface card (NIC).

Command:

ethtool eth0

Iwconfig Command:

The iwconfig command on Linux is used to configure the wireless network interface. We can view and set basic WiFi details like SSID channel and encryption. However, you can refer to the iwconfig man page for more information.

Command:

iwconfig

Hostname Command:

The hostname will be defined in a network. Run the hostname command to see your box’s hostname.

Command:

hostname

Whois Command:

The whois command displays information about site registrations. You can get all the information on a website regarding its owner and registration information.

Command:

whois 

Telnet

Telnet connects the destination’s host and port via a telnet protocol if a connection established means connectivity between two hosts is working fine.

Command:

telnet gf.dev 443

SS

Linux installations have a lot of services running by default. In other words, These should be disabled or preferably removed, as this helps in reducing the attack surface. You can see what services are running with the netstat command. While netstat is still available, most Linux distributions are transitioning to ss command.

use ss command with -t and -a flags to list all TCP sockets. This displays both listening and non-listening sockets.

Command:

ss -t -a

Reference

https://www.javatpoint.com/linux-networking-commands

Written by 

Deeksha Tripathi is a Software Intern at Knoldus Inc Software. She has a keen interest toward learning new technologies. Her practice area is Devops. When not working, she will be busy in listening music , and spending time with her family .