Networking in Linux - A Starter Guide to CLI Configuration

Networking in Linux can be very intimidating especially for first time users. But by focusing on the key concepts of networking for Linux, basic network configuration is actually a possibility. Linux offers a wide variety of possibilities due to its open source concept but it will require a bit of research and practice to ensure everything works as expected.

IP Address as Key Component for Network Configuration

An IP (Internet Protocol) address is an identifier uniquely associated to any connected device to the network and/or internet. There are two types of IP addresses based on its type of connection: private and public. A connected device will be assigned with a private IP address once they are connected to a network. A public IP address on the other hand, is given to a connected network to the internet. The public IP address is given by the ISPs to identify their clients.

An IP Address could be an IPv4 which is a 32-bit IP address that comes with four sets of numbers separated by dots that range from 0 to 255. In a basic network connection, an IP address will look like this:

On the other hand, an IPv6 is a 128-bit IP address that looks like this: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

While IPv6 is considered the next generation of IP addresses, the most network configuration goes through IPv4. Networking in Linux also uses IPv4 for simpler naming convention and configuration.

Know Your Distribution and Version

Before finding the right command for Linux Networking it's very important to know the type of distribution installed in the device. Check the knowledge-base of the distribution to learn more about the basic networking functions.

Linux Networking often goes through CLI or Command Line Interface but more and more distributions are using graphical interface to ease the learning curve for networking.

For CLI, there are two common types of commands available for configuration - ip and nmcli.

If the distribution uses an ip command, the network configuration can be accessed using this syntax:

ip addr show

The CLI will display something like this:

ip addr Command

This simple command is very powerful because it will display the IP address of EVERY connected device within the network. The "eth" syntax is the connected device on the network. In this sample, there are three connected devices (eth0, eth1 and eth2).

It's important to take note of each device configuration for proper network management. The following are sample commands to use for IP address networking:

ip a add (IP address) dev (device name) - assign a specific IP address to the device
ip a del (IP address) dev (device name) - delete the assigned IP address
ip neighbour - view every connected device's MAC address
ip help - view every command available related to IP address connection

For Linux distributions that use an nmcli command, the network can be access through this command:

nmcli connection show

The command will display the following:

nmcli Command

If you're going to define the static IP address of a device use the following configuration:

nmcli con mod "Name of Connection" ipv4.addresses "Device IP Address" ipv4.method manual

To activate a connection the following command is used:

nmcli con up "Name of Connection"

To retrieve related commands for nmcli, "nmcli --help" can be used to learn which command to use to move forward.

Using a GUI

Using CLI for manual network configuration can be extremely challenging because it will require familiarity with a lot of concepts exclusive to a Linux distribution. Fortunately, more and more Linux distributions are using GUI or Graphical User Interface just like in MAC and Windows so that first time users can make some network changes without the use of a command line.

Posted on

Help Me Find VPN Software for My Device

More Articles You Might Like

Show all articles