7 Useful Linux Networking Commands - page 2
ifconfig, iwconfig, ethtool
tcpdump for sniffing network packets
This isn't just a simple tool; its a network sniffer or analyzer. It can capture the packets traveling through your interfaces and on the network. You can inspect the raw packets or review statistics. The tool is often used by other GUI programs, but can also be useful in a terminal. Here are some command options to get you started:
- -i: Specifies the interface to capture on, such as eth0 or ath0.
- -n: Stops replacing IP addresses with hostnames.
- -nn: Stops resolving hostnames or port names.
- -s : Maximum bytes to display for each packet. Default is 68. Use 0 to display entire packets.
- v, -vv, and -vvv: Steps up the amount of details printed along with the packets, such as the total length and options in an IP packet, fully decoded SMB packets, and telnet details.
- -x: Displays the packet contents in the HEX format.
- -X: Prints the packet contents in the ASCII format.
Ping, your network sonar
Start pinging an IP address or a host/domain name:
To stop the pinging, hit Ctrl + C.
Here are a few options that you might want to use:
- -c: Count, or number, of packets to send
- -i: Wait interval; number of seconds between packets
- -s: Packet size of pings; default is 56 (64 with ICMP)
- -w: Waitsecs or how long in seconds to perform pinging
Netstat for reviewing network statistics
The netstat (or network statistics) tool can display details of your network connections, interface statistics, routing tables, masquerade connections, and multicast memberships. Here are a few commands that might interest you:
View a list of open sockets:
Display a table of all the network interfaces:
Display the summary statistics for each protocol:
Hostname lets you view and change your hostname
If you're an administrator, you know what a hostname is. For everyone else: a hostname helps identify network devices in a more user-friendly (alphabetic) way rather just by a crude IP address. Linux distros usually include a simple tool called hostname to view and temporarily change your hostname.
View the current hostname setting:
Temporarily change the hostname (until restart):
To permanently change the hostname, you'll have to edit the /etc/hostname or /etc/sysconfig/network files.
Eric Geier is the Founder and CEO of NoWiresSecurity, which helps businesses easily protect their Wi-Fi with enterprise-level encryption by offering a hosted RADIUS/802.1X authentication service. He is also the author of many networking and computing books for brands like For Dummies and Cisco Press.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Linux from Scratch, Ubuntu 14.01 Beta and Arch Updates