In this article you will find information about the most used basic network commands in Linux and how to edit DNS settings.
1. For Network Connection and IP Configuration: ifconfig
The ifconfig command allows you to examine and change the network connection and IP configuration settings available in the system.
Firstly, you see the eth0 information. eth0 is the part that shows the information about your Ethernet card. If other Ethernet cards connected to the system, they would have names such as eth1, and eth2, respectively.
lo represents the computer itself, ie localhost.
If you are using a wireless network environment, you can also see the wlan0 information. wlan0 means the wireless network card.
Instead of using the ifconfig command this way, you can list the desired information one by one. For example, if you want to list only the Ethernet card information, ifconfig eth0 the command will suffice.
For example, you saw above that the local IP address of eth0 is 10.0.2.15. To change this IP address to 10.0.2.13:
With ifconfig, you can change the information here, as well as adjust the information cards you encounter in the output. ifconfig card_name down the command can remove the desired card from display, you can show this card again with ifconfig card_name up the command.
As can be seen from the output, the down parameter made the lo card invisible now.
2. A Kind of Control Mechanism: ping
The ping command checks whether communication is established between the target and your system. For example, you can query the communication speed between you and Google.
While doing this, I ended this process with the Ctrl + C combination after the 5th query package. If you use a command like a ping -c 4 google.com, you only send 4 query packets. The process will terminate after the number of query packets exhausted.
3. For IP Routing Table: route
The route command allows you to see the contents of the IP routing table on your system. You can type the route -n command in the console for this.
The gateway address here is the forwarding address used when passing from the local network to the internet network.
4. Forwarding Tracking for a Specific Target: traceroute
With Traceroute, your command shows you which hosts the packet sent to a specific destination has passed through. This time, let’s think of the target address www.makeuseof.com as an example.
As you can see, to be able to be directed to the desired address, first a request made to the address 10.0.2.1. You can use the traceroute command to see such routing paths and to understand any routing problems that occur in the network.
5. For Domain Information: whois
The whois query contains information such as when the domain established, how long it is valid and so on. Let’s target google.com as an example of a whois query.
Also, you can avoid having to use the command screen by using the best websites to look up whois information for free.
6. Getting Information About Target Address: host
The host command allows you to get information about the destination address. With the host command, you can access the domain name from the IP address and the IP address from the domain name.
7. To Look at DNS Records: dig
The dig command (domain information groper) is a common Linux network command used to lookup DNS records.
Also, you can examine NS (Nameserver) records with the dig command. You can use the -t NS the command for this.
8. For IP-MAC Address Matchings: arp
The arp command shows the tables where IP-MAC Address mappings are kept.
9. For Connections Made by the System: tcpdump
The tcpdump command allows you to instantly view the connections made by your system and the connections made to your system.
In addition, if you want to follow the links directly without address resolution, you can use the tcpdump -n command.
10. DNS Settings
Compared to other operating systems, settings DNS on Linux is quite easy. To do this, you can make some changes to the etc/resolv.conf file where DNS information stored.
If you want to add a new DNS here, you can use the echo command.
After making these additions, when you browse the etc/resolv.conf file again, you will see that the desired changes made.
Inside the /etc/ folder, there is another file called hosts that acts as a domain nameserver. This file is checked when performing domain name resolution in the system.
Network Management Is Simpler With Linux Commands
Linux is one of the most widely used operating systems. Knowing the correct commands used in Linux will be very beneficial in terms of time and effort. When configuring your Linux network and looking for any problems that may occur in the network, you can make use of the Linux network commands.