|Basic Networking Commands in Linux|
Computers are connected in a network to exchange information or resources with each other. Computer loaded with Linux Operating System can also be a part of a network whether it is a small or large network by its multitasking and multi-user natures. Maintaining of system and network up and running is a task of a System/ Network Administrator’s job.
Ifconfig (also known as Interface Configurator), is the first type of basic command used by network administrators. This command is used to view the IP address and MAC address of the system.
Using ifconfig, you can enable or disable an interface on demand as required. Also, ifconfig with an interface (eth0) command only shows specific interface details like IP Address, MAC Address, etc.
The command shows the desired output like MAC or Hardware Address, IPv4, and IPv6 address for the eth0 adapter.
vetechno@sr:~$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.12.52 netmask 255.255.252.0 broadcast 192.168.19.255
inet6 ff81::971c:18ff:fe45:19a3 prefixlen 64 scopeid 0x20<link>
ether 9a:2d:67:65:19:w31 txqueuelen 1000 (Ethernet)
RX packets 31151731 bytes 2815986106 (2.8 GB)
RX errors 0 dropped 3320148 overruns 0 frame 0
TX packets 174658 bytes 15527750 (15.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
To enable or disable a specific interface, command #ifup eth0 or #ifdown eth0.
vikash.ekka@vetechno:~$ ping 22.214.171.124
PING 126.96.36.199 (188.8.131.52) 56(84) bytes of data.
64 bytes from 184.108.40.206: icmp_seq=1 ttl=113 time=39.5 ms
64 bytes from 220.127.116.11: icmp_seq=2 ttl=113 time=28.9 ms
64 bytes from 18.104.22.168: icmp_seq=3 ttl=113 time=36.8 ms
64 bytes from 22.214.171.124: icmp_seq=4 ttl=113 time=34.4 ms
--- 126.96.36.199 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 28.939/34.892/39.459/3.880 ms
Netstat is used to
- Print network connections
- Routing tables
- Interface statistics
- Masquerade connections and multicast groups.
Basic networking command -dig and nslookup
The basic networking tools to gather DNS related information is
Dig (domain information groper)
DIG will query DNS related information like A Record, CNAME, MX (that is Mail exchange) Record etc. This command is mainly used to troubleshoot DNS related queries.
The image shows the dig command to gather information about website vetechno.in
- ethtool is developed and inbuilt to the Linux kernel.
- ethtool is used to view, setting speed and duplex of your Network Interface Card (NIC)
The table shows the optional basic networking commands.
Scan open ports on a network, important for security analysis
Monitor network traffic in text mode
Combines functionality of ping and traceroute, to give upadated display
Dumps network traffic for analysis