Linux Network Commands Part 1 – Preparation

Computer Data NetworkThere are many network-related tasks that you may find yourself needing to perform over the course of time.

From configuring your network settings so that you can access the network, to pinging a server to see if it’s up — or maybe it’s you that’s down! — it’s all possible from the Linux command line.

To that end, this series is all about network-related Linux commands.

Some rather popular commands are now obsolete — in which cases I try to mention that fact — but still used and/or often mentioned, hence their inclusion.

Most commands are too complex for all of their details to be mentioned here; I recommend checking out the man (manual) pages for additional details.

But first, before we even get to the commands, let’s cover a few basic subjects that will make various aspects of the commands make more sense later on.

Network Interfaces

Network interfaces are what connect a computer to a network. Generally that means a hardware solution, such as a network interface card (NIC), but it can also refer to a software solution.

Traditionally, Linux used an ethX naming conventions for network interfaces, when referencing them.

– The first wired ethernet interface (network card/device/etc.) is referred to as eth0 and consecutive interfaces are incremented in number, referencing as eth1, eth2, etc.

– The first wireless network interface is referred to as wlan0 and consecutive interfaces are incremented in number, referencing as wlan1, wlan2, etc.

Because this convention caused problems on some machines, the convention began to change in 2009. Some distributions (Fedora/Red Hat/SUSE) adopted it quickly; others have yet to catch up.

– The wired ethernet naming scheme is “em[1-N] for on-board (embedded) NICs (# matches chassis labels)” so you may see references such as enp3s0/enp4s0/enp5s0/etc. rather than eth0/eth1/eth2/etc.

– The change does not affect wireless and USB devices.

The “loopback interface” that a system uses to communicate with itself is referred to as lo.

Network Sockets

A network socket is an endpoint in communication flowing between two programs on a network. Sockets can also be used for processes to communicate on the same computer.

A socket API (application programming interface) allows application to use network sockets.

A socket address –the combination of a port number and IP address — is how internet sockets deliver incoming data packets to the correct application(s).

Host Names

Host names are labels that identify a device connected to a network. They are essentially a device’s name.

On Windows, the default host name is WindowsPC, and on Linux the default is localhost.

Domain Names Vs. IP Addresses

As mentioned before, domain names are the human-readable “front” for an IP address that identifies that website’s server.

For most commands –run on the internet and not the LAN — domain names and IP addresses can be used interchangeably, but using the IP address may be faster, as it can cut out the domain-look up step.

Other Terms

During configuration, especially, you may run into some of the following:

Gateway: A gateway is a network device or devices that interact with other networks over various protocols, to forward packets, etc.

Network Mask (aka Subnetwork Mask or Subnet Mask): A subnet mask is the means used to determine a packet’s network and host addresses, and thus how to route it.

Broadcast Address: An address where all devices connected to a network can receive data.

MAC Address: A Media Access Control (MAC) address is a unique identifier for each network interface.

Conclusion

Next week is when the real fun begins, and when you can once again return to the command line to test out your growing knowledge of commands.

Leave a Reply

You have to agree to the comment policy.