fbpx
Search
Close this search box.

7 Linux Networking Commands All Admins Need to Be Aware Of

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

In the world of system administration, Linux networking commands play a huge role in optimizing, managing, and trouble shooting networking environments. To ensure that everything runs smoothly it is important to be well-versed in commands that allow admins to ensure proficient security, the ability to diagnose issues quickly, and ensure seamless network operations. 

It is important to understand that there is a reason why developers and IT professionals use Linux over other systems. Though slightly complicated for the novice user, Linux is an open source software that is more robust and customizable. Hence traditional networking is different from Linux networking. Today we will explain 7 Linux networking commands and the difference between traditional and Linux networking.

What’s the Difference Between Traditional Networking and Linux Networking?

Tools and network management practices that are executed through hardware in patented systems like Windows or a number of network applications is generally considered as traditional networking. Such networks heavily rely on devices like routers, firewalls, switches, etc that are managed by third party interfaces and protocols.

Linux networking emphasis software based networking instead giving users the ease of using flexible open source tools. Thanks to its versatile command-line options (ping, ifconfig, traceroute, ip, etc.), powerful command applications like tcpdump, nftable, iptables, etc, and scripting capabilities, Linux is a more robust option. Moreover, it also provides advanced configurations such as bonding, bridging, and virtualization tools such as KVM and brctl.

Main Differences

  • Linux networking is more flexible, adaptable, and customizable. It can complete commands through automation tools. While traditional networking mostly relies on third party softwares and is often limited.
  • Linux networking is relatively cheaper because it mainly relies on open source software and commodity hardware. 
  • Linux networking can be difficult for the novice user, open source software is often complicated while traditional networking software is made based on ease for user familiarity,
  • Linux being an open source can be deployed on various hardware systems. From embedded systems to high performance servers. 

The bottom line is that Linux networking is more cost-friendly, customizable, and powerful. But traditional networking is simpler and in most cases will get the job done. 

7 Linux Networking Command

1. IP Command

Also known as the iproute2 package, is a versatile and powerful tool that is used to manage network interfaces, addresses, and routes. It offers more flexibility and consistent syntax compared to older tools like route and ifconfig. 

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

Basic Usage

View status and network interfaces 

ip a

Assign an IP address to an interface:

ip addr add 192.168.1.100/24 dev eth0

Bring an interface up or down:

ip link set eth0 up
ip link set eth0 down

View the routing table:

ip route

Advanced Usage

Add a new route:

ip route add 192.168.2.0/24 via 192.168.1.1

Delete a route:

ip route del 192.168.2.0/24

The flexibility and breadth of the ip command make it an important tool for Linux system based network management.

2. Ifconfig Command

Even though ifconfig command lost favor when compared to ip, it is still a very popular tool that is commonly used to manage and configure network interfaces. It is familiar and simple, which makes it a valuable command in an admins toolkit. 

Basic Use

View interface details:

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

ifconfig

Assign an IP address:

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

Bring an interface up or down:

ifconfig eth0 up
ifconfig eth0 down

Additional Options

Enable or disable promiscuous mode (useful for packet capturing):

ifconfig eth0 promisc
ifconfig eth0 -promisc

Change the MAC address of an interface:

ifconfig eth0 hw ether 00:11:22:33:44:55

Despite many claiming that there are better command options available, ifconfig is still widely used especially in legacy scripts and systems.

3. Ping Command

The ping command is used to test the connection between two devices on the same network and this makes it one of the fundamental networking tools. It listens to Echo Reply packets and sends ICMP Echo Request packets to the target host. This helps determine latency and how far the network reaches.

Basic Usage

Ping a host:

ping 8.8.8.8

Ping a host a specific number of times:

ping -c 4 8.8.8.8

Advanced Options

Set the interval between pings (in seconds):

ping -i 0.5 8.8.8.8

Set the packet size:

ping -s 1000 8.8.8.8

Flood ping (send packets as fast as possible, requires root privileges):

ping -f 8.8.8.8

The ping command is effective and simple. This makes it an important basic network diagnostic tool.

4. Netstat and SS Commands

Both the netstat command and the ss command give information about routing tables, interface stats, masquerade connections, network connections, and multicast memberships. But, the ss command has more options and is faster then netstat, this also makes it more popular. 

Basic Usage

View all active connections:

netstat -tuln
ss -tuln

Advanced Options

Display all TCP connections:

netstat -at
ss -at

Display all UDP connections:

netstat -au
ss -au

Show detailed information about sockets:

ss -s

Monitoring Ports

List processes listening on ports:

netstat -tulnp
ss -tulnp

The way users transitioned from netstat to ss just shows how Linux networking tools have evolved into more efficient and powerful systems.

5. Tracerroute Command

The traceroute command tracks the path of packets from the source system to the destination host. It helps to identify failure points or delays in the networks as well as diagnose routing issues.   

Basic Usage

Trace the route to a host:

traceroute 8.8.8.8

Advanced Options 

Specify the maximum number of hops:

traceroute -m 20 8.8.8.8

Set the packet size:

traceroute -s 60 8.8.8.8

Use ICMP ECHO instead of UDP packets (similar to Windows tracert):

traceroute -I 8.8.8.8

Visual Tracerroute

For a graphic representation, mtr (My Traceroute) combines fuctionlity of trecerroute and ping:

mtr 8.8.8.8

traceroute is immensely important to realizing network paths and diagnostic connectivity issues between hosts.

6. tcpdump Command

The tcpdump command is a powerful packet analyzer that collects network traffic data for analysis. It gives admins the capability of intercepting and displaying contents of network packets and this makes it a crucial tool for diagnosing network issues. 

Basic Usage

Capture packets on an interface:

tcpdump -i eth0

Advanced Options
Capture packets and save them to a file:
tcpdump -i eth0 -w capture.pcap

Read packets from a file:

tcpdump -r capture.pcap

Filter packets by host, port, or protocol:

tcpdump -i eth0 host 192.168.1.1
tcpdump -i eth0 port 80
tcpdump -i eth0 tcp

Display Options

Show packet details in ASCII:

tcpdump -A -i eth0

Show packet details in HEX and ASCII:

tcpdump -X -i eth0

Users often use Wireshark, a graphical packet analysis tool for a more detailed analysis.

7. nmap Command

The nmap command (Network Mapper) is a flexible and commonly used tool for network detection and security audits. It scans networks to identify open port, running application, potential threats, and connected devices.

Basis Use

Scan a single host:

nmap 192.168.1.1

Advanced Scans

Scan a range of IP addresses:

nmap 192.168.1.1-100

Scan an entire subnet:

nmap 192.168.1.0/24

Perform a stealth scan (SYN scan):

nmap -sS 192.168.1.1

Service and Version Detection  

Detect service versions

nmap -sV 192.168.1.1

OS detection:

nmap -O 192.168.1.1

Security Auditing

Scan for known vulnerabilities:

nmap --script vuln 192.168.1.1

nmap’s has many capabilities which make it an important tool for security assessments, vulnerability scanning, and network mapping.  

Conclusion

If you plan on becoming or hiring a system administrator then these 7 tools are essential. These tools provide you with the functionalities to efficiently diagnose, manage, and secure Linux networking environments. By using these commands properly, admins can enhance the security, and efficiency of network operations, and ensure a robust environment. Regular practice of these commands and using them will help you see their true potential. You can also find loads of commands in communities. Until next time, take care guys! 

Mubashir Ijaz
I write to help and inform people about various topics. My passion for learning and to share knowledge allows me excel as a content creator
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!