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
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.
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.
ping 220.127.116.11 OR ping www.tchmint.com
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.
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 .
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.
The nslookup command is also used to find DNS-related queries.
The following examples show a record (IP address) from tecmint.com.
The routing command also displays and manipulates the IP routing table. To view the default routing table on Linux, enter the following command.
The host command to find the name in IP or IP to set name in IPv4 or IPv6 and also query DNS records.
-t an option to find out DNS Resource Records like CNAME, NS, MX, SOA, etc.
host -t CNAME www.redhat.com
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.
ethtool replaces miitool. This is for viewing, speed setting in addition with duplex printing of your network interface card (NIC).
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.
The hostname will be defined in a network. Run the hostname command to see your box’s hostname.
The whois command displays information about site registrations. You can get all the information on a website regarding its owner and registration information.
Telnet connects the destination’s host and port via a telnet protocol if a connection established means connectivity between two hosts is working fine.
telnet gf.dev 443
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
use ss command with
-a flags to list all TCP sockets. This displays both listening and non-listening sockets.
ss -t -a