A sysadmin's guide to network management

LINUX 14.10.21 14.10.21 319
Бесплатные курсына главную сниппетов

A reference list of Linux utilities and commands makes managing servers and networks easier.

If you're a sysadmin, your daily tasks include managing servers and the data center's network. The following Linux utilities and commands—from basic to advanced—will help make network management easier.

In several of these commands, you'll see <fqdn>, which stands for "fully qualified domain name." When you see this, substitute your website URL or your server (e.g., server-name.company.com), as the case may be.

Ping

As the name suggests, ping is used to check the end-to-end connectivity from your system to the one you are trying to connect to. It uses ICMP echo packets that travel back to your system when a ping is successful. It's also a good first step to check system/network connectivity. You can use the ping command with IPv4 and IPv6 addresses. (Read my article "How to find your IP address in Linux" to learn more about IP addresses.)

Syntax:

You can also use ping to resolve names of websites to their corresponding IP address, as shown below:

ping-screen-0.png

screenshot

Traceroute

More Linux resources
This is a nice utility for tracing the full network path from your system to another. Where ping checks end-to-end connectivity, the traceroute utility tells you all the router IPs on the path you travel to reach the end system, website, or server. traceroute is usually is the second step after ping for network connection debugging.

Syntax:

Telnet

Syntax:

Netstat

The network statistics (netstat) utility is used to troubleshoot network-connection problems and to check interface/port statistics, routing tables, protocol stats, etc. It's any sysadmin's must-have tool.

Syntax:

netstat-r.png

screenshot

netstat-s.png

netstat-s command

netstat-i.png

netstat-i command

Nmcli

nmcli is a good utility for managing network connections, configurations, etc. It can be used to control Network Manager and modify any device's network configuration details.

Syntax:

nmcli.png

nmcli

Routing

There are many commands you can use to check and configure routing. Here are some useful ones:

Syntax:

ip-route.png

IP route

route-add-del.png

adds or deletes a new network route to the routing table

ip-neighbor.png

ip neighbor

ip-neigh-help.png

ip neighbor help

arp.png

arp

Tcpdump and Wireshark

Linux provides many packet-capturing tools like tcpdump, wireshark, tshark, etc. They are used to capture network traffic in packets that are transmitted/received and hence are very useful for a sysadmin to debug any packet losses or related issues. For command-line enthusiasts, tcpdump is a great tool, and for GUI users, wireshark is a great utility to capture and analyze packets. tcpdump is a built-in Linux utility to capture network traffic. It can be used to capture/show traffic on specific ports, protocols, etc.

Syntax:

tcpdump-i.png

tcpdump -i

Iptables

iptables is a firewall-like packet-filtering utility that can allow or block certain traffic. The scope of this utility is very wide; here are some of its most common uses.

Syntax:

The following commands allow traffic from the specified port number to the specified interface:

The following commands allow loopback access to the system:

Nslookup

The nslookup tool is used to obtain IP address mapping of a website or domain. It can also be used to obtain information on your DNS server, such as all DNS records on a website (see the example below). A similar tool to nslookup is the dig (Domain Information Groper) utility.

Syntax:

Network/interface debugging

Here is a summary of the necessary commands and files used to troubleshoot interface connectivity or related network issues.

Syntax:

 

на главную сниппетов
Курсы