Getting your Trinity Audio player ready... |
15 Useful Linux Networking Commands
In this post, I am going to share 15 useful Linux networking commands which are frequently used by Linux administrators and by network administrators as well.
To troubleshoot network issues reported or any issue with interface configuration in the Linux system.
This collection of 15 useful Linux networking commands is really useful and you must be aware of these commands to perform as a Linux administrator or network administrator.
Linux Networking Commands
The list of 15 Useful Linux Networking Commands shared in this post is as below.
1. ping 2. nslookup 3. dig 4. wget 5. telnet 6. ftp 7. ssh 8. ifconfig 9. ethtool 10. netstat 11. route 12. traceroute 13. tcpdump 14. scp 15. hostname
So let us deep dive into all of them one by one.
1. ping command in linux
ping command in Linux is a very useful and handy command to check network connectivity between two servers. The full form of ping is Packet InterNet Groper. Ping command in Linux or UNIX is used to check connectivity status between two network resources like servers or switches or routers.
$ ping google.com google.com is alive
2. nslookup command in Linux
nslookup command is Linux also very useful command for finding DNS related information.
DNS is a tool used for name resolution IP to host and host to IP as it is easy to remember name versus remembering IP Address which is 32-bit address if we consider IP Version 4.
$ nslookup google.com Non-authoritative answer: Name: google.com Address: 172.217.10.238
[maxbutton id=”1″]
3. dig command in linux
dig command in Linux is another useful Linux networking command. dig stands for domain information groper and is a flexible tool. dig is a Linux command-line tool for interrogating DNS name servers.
dig performs DNS lookups and displays the answers that are returned from the nameservers primary and secondary which were queried.
Most of the DNS administrators use the dig tool to troubleshoot DNS related problems because of its flexibility and ease of use and clarity of output as compared to other tools.
4. wget commands in linux
wget command in Linux is a free Linux command-line utility that is non-interactive in nature and used to download files from the web. It supports protocols like HTTP, HTTPS, and FTP.
Syntax of wget command in linux is like below.
$ wget <source url>
5. telnet command in linux
telnet command in Linux used to communicate with another host using the TELNET protocol. It is known as a teletype network in the networking arena used to connects remote hosts. telnet port number in Linux is 21.
$ telnet <IP ADDRESS OF SERVER PC> <PORT>
[maxbutton id=”2″]
6. ftp command in linux
ftp command in Linux is another very good file transfer Linux command-line tool ftp.ftp is the user interface available to transfer files to and from a remote network. It uses its own protocol called File Transfer Protocol. ftp port number in Linux is 23.
$ ftp ftp.microsoft.com
By default, most of the Linux system telnet and FTP are always restricted due to its nature to have the vulnerability. If you want to use FTP you can use secure FTP programs like vsftpd.
7. ssh command in linux
ssh command in Linux is a command which you need to access to any server security. an ssh is a short form of secure shell. This is widely used to connect the remote server. ssh port number in Linux is 22. Unlike all other remote connectivity tools, it is the safest one.
$ ssh <remote host>/<remote ip>
8. ifconfig command in linux
ifconfig command in Linux is one of the most important commands to configure and display the network card configuration.
If you simply type ifconfig it will display network configuration like below. It saves all the network configurations in /etc/sysconfig/network-scripts/ifcfg-eth0 interface wise.
$ ifconfig eth0 Link encap:Ethernet HWaddr 00:1B:78:9C:AF:2E inet addr:210.182.176.15 Bcast:10.82.177.255 Mask:255.255.254.0 inet6 addr: fe80::21b:78ff:fe9c:af2e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11456090648 errors:0 dropped:1884508 overruns:0 frame:0 TX packets:44015198382 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7218932064596 (6.5 TiB) TX bytes:64274718397331 (58.4 TiB) Interrupt:201 Memory:f6000000-f6012800 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:154489333 errors:0 dropped:0 overruns:0 frame:0 TX packets:154489333 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:64366523512 (59.9 GiB) TX bytes:64366523512 (59.9 GiB)
[maxbutton id=”3″]
9. ethtool command in linux
ethtool is a really important tool to verify physical connectivity status and all other properties of the interface cards.
$ sudo ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on Supports Wake-on: g Wake-on: g Link detected: yes $
10. netstat command in linux
netstat command in Linux is useful command-line tools to print network connections routing tables interface statistics and multicast memberships.
$ sudo netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 190.200.176.0 * 255.255.254.0 U 0 0 0 eth0 192.200.0.0 * 255.255.0.0 U 0 0 0 eth0 default 210.182.176.1 0.0.0.0 UG 0 0 0 eth0 $ sudo netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP eth0 1500 0 11456107945 0 1884508 0 44015216988 0 0 lo 16436 0 154517481 0 0 0 154517481 0 0 0 LRU
11. route command in linux
route command in Linux is another useful command to display and modify IP routing configurations.
$ sudo route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.82.176.0 * 255.255.254.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 default 210.182.176.1 0.0.0.0 UG 0 0 0 eth0
12. traceroute command in linux
Another really good networking related Linux command called traceroute. traceroute command in Linux as the name suggests prints the route packets tracing to destination network host using your present network and DNS infrastructure.
$ sudo traceroute google.com
[maxbutton id=”4″]
13. tcpdump command in linux
tcpdump command in Linux is a really helpful command if you want to track traffic to a specific network to find out any issue related to the network.
You can simply type tcpdump to see network statistics.
$ sudo tcpdump $ sudo tcpdump host server1.google.com
This will be helpful to print all packets arriving at or departing from server1.
14. scp command in linux
SCP command in Linux is a frequently used command to copy files between servers. SCP stands for secure copy. While cp is being used inside the Linux system. FTP is not secure for file transactions there it comes SCP. You can copy files securely to and from remote hosts.
$ sudo scp /location1/file1.txt user@targethost:/home/
This will copy file from your local server to target server at /home directory.
15. hostname command in linux
hostname command in Linux does the work as its name. If you need to check your server name you can simply type hostname and it will print hostname for you.
$ hostname linuxq16 If you want to know FQDN Fully qualified domain name you can use switch. $ hostname -a linuxqa.google.com
[maxbutton id=”5″]
Conclusion :
All Linux networking commands mentioned above are always required to troubleshoot the networking-related issue by Linux administrators as well as network administrators. Using these Linux networking commands reported network issues can be identified or at least have a fair idea about network performance. I hope that you must have enjoyed the collection of 15 useful Linux networking commands.
If you remember if any other Linux networking command is not there in this collection of 15 useful Linux networking commands and deserves space in the collection please share in the comment section for the awareness about the command to our readers.
That will be really helpful to our readers and they will have additional information in form of another Linux networking commands which can make their life even easier.
Comments
Pingback: All about Unix Linux System Administrator Roles and Responsibilities – RSY DIGITAL WORLD