Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

Introduction to Networking Commands

1. What Are Networking Commands?

Networking commands are a set of instructions used in the command line interface (CLI) to manage and troubleshoot network-related tasks. These commands help in configuring, monitoring, and diagnosing network settings and connections. Understanding these commands is essential for network administrators and IT professionals.

2. Basic Networking Commands

2.1. Ping

The ping command is used to test the reachability of a host on an IP network. It sends ICMP Echo Request messages and listens for Echo Reply messages.

Example:

ping google.com

Pinging google.com [172.217.14.206] with 32 bytes of data:
Reply from 172.217.14.206: bytes=32 time=14ms TTL=53
Reply from 172.217.14.206: bytes=32 time=13ms TTL=53
Reply from 172.217.14.206: bytes=32 time=13ms TTL=53

2.2. Ipconfig/Ifconfig

The ipconfig (Windows) or ifconfig (Unix/Linux) command is used to display all current TCP/IP network configuration values and refreshes DHCP and DNS settings.

Example (Windows):

ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : example.com
IPv4 Address. . . . . . . . . . . : 192.168.1.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

Example (Linux):

ifconfig

eth0 Link encap:Ethernet HWaddr 00:0c:29:68:8b:6b
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe68:8b6b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1234 errors:0 dropped:0 overruns:0 frame:0
TX packets:5678 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000

2.3. Tracert/Traceroute

The tracert (Windows) or traceroute (Unix/Linux) command is used to determine the path packets take to a destination. It helps in diagnosing routing issues.

Example (Windows):

tracert google.com

Tracing route to google.com [172.217.14.206]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms 192.168.1.1
2 10 ms 9 ms 10 ms 10.0.0.1
3 13 ms 11 ms 12 ms 172.217.14.206

Example (Linux):

traceroute google.com

traceroute to google.com (172.217.14.206), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 0.123 ms 0.098 ms 0.087 ms
2 10.0.0.1 (10.0.0.1) 10.321 ms 10.287 ms 10.254 ms
3 172.217.14.206 (172.217.14.206) 13.154 ms 12.987 ms 12.852 ms

3. Advanced Networking Commands

3.1. Netstat

The netstat command is used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

Example:

netstat -a

Active Connections

Proto Local Address Foreign Address State
TCP 0.0.0.0:80 0.0.0.0:0 LISTEN
TCP 192.168.1.2:139 0.0.0.0:0 LISTEN
UDP 192.168.1.2:1900 0.0.0.0:0

3.2. Nslookup

The nslookup command is used to query the Domain Name System (DNS) to obtain domain name or IP address mapping information.

Example:

nslookup google.com

Server: dns.google
Address: 8.8.8.8

Non-authoritative answer:
Name: google.com
Addresses: 172.217.14.206

3.3. ARP

The arp command is used to display and modify the IP-to-Physical address translation tables used by the Address Resolution Protocol (ARP).

Example:

arp -a

Interface: 192.168.1.2 --- 0x3
Internet Address Physical Address Type
192.168.1.1 00-14-22-01-23-45 dynamic
192.168.1.3 00-14-22-01-23-46 dynamic

4. Conclusion

In this tutorial, we have covered some of the basic and advanced networking commands that are essential for network management and troubleshooting. By mastering these commands, you can efficiently manage and diagnose network issues, ensuring smooth and reliable network operations.