Various commands used to detect a connected network cable on Linux

How to detect whether a physical cable is connected to network card slot on Linux

If you’ve ever needed to know whether a physical cable is connected to a network port on your Linux system, you don’t necessarily need to be right in front of the computer or server to look and see. There are several methods we can use from the Linux command line in order to see if a cable is plugged into a network slot.

There are a few reasons why this could come in handy. For one, it shows you whether the system itself detects that there’s a cable plugged in. This could be an essential troubleshooting step if you know for a fact that the cable is properly plugged in, yet the system is not detecting it. It’s also helpful on remote systems or if you’re just too lazy to look at the back of the computer and see if the cable is plugged in.

Check out some of the examples below where we go over various commands that check whether a physical network cable is plugged in or not.

In this tutorial you will learn:

  • How to detect physical network cable connectivity with Bash commands and ethtool

Read more

How to configure DHCP on Linux

What is DHCP and how to configure DHCP server in Linux

DHCP is a networking protocol used to assign IP addresses to networked devices. In this guide, we’ll introduce you to the protocol and explain how it works. You’ll also see how to implement a DHCP server on Linux systems, and configure it for your own network.

In this tutorial you will learn:

  • What is DHCP?
  • How to implement a DHCP server on major Linux distros
  • How to configure DHCP on Linux

Read more

Changing the MAC address with the macchanger command on Linux

Change mac address with macchanger Linux command

A Media Access Control (MAC) address is a unique number that gets assigned to every network interface, including Ethernet and wireless. It’s used by many system programs and protocols in order to identify a network interface. One of the most common examples would be in the case of DHCP, where a router assigns an IP address to a network interface automatically. The router will know which device it has assigned an IP address to by referring to the MAC address.

Unlike an IP address, which is temporary and can be changed easily, MAC addresses are hardcoded into a network interface from the manufacturer. However, it’s still possible to change or “spoof” a MAC address temporarily. On Linux systems, one of the easiest ways to do this is with the macchanger command line program. There are both legitimate and shady reasons for why a Linux user may find the need to change a MAC address.

In this guide, we’ll show how to install the macchanger program on major Linux distros and then use the macchanger command to change the MAC address of a network interface either to a random value or some specific number. Follow the examples below to learn how.

In this tutorial you will learn:

  • How to install macchanger on major Linux distros
  • How to identify current MAC address and network interface
  • How to change an interface’s MAC address
  • How to change interface to a specific MAC address

Read more

apache-logo

How to manage dynamic virtual hosts with Apache and the mod_vhost_alias module

The Apache web server has the ability to serve multiple websites from the same IP address, using virtual hosts. Each Virtual Host can be configured in the main server configuration file, or, thanks to the Include or the IncludeOptional
directives, in its own dedicated one. When the number of virtual hosts increases, their management starts to become troublesome. If their configuration is quite similar, we can manage them dynamically, thanks to the mod_vhost_alias module. In this tutorial we will see how to do it.

In this tutorial you will learn:

  • What is an Apache virtual host
  • How to check if the mod_vhost_alias module is enabled
  • How to load the mod_vhost_alias module on Debian and Red Hat family of distributions
  • How to manage dynamic virtual hosts using the mod_vhost_alias module
apache-logo

Read more

Linking two Docker containers together through networking on Linux

Basic networking example on how to connect docker containers

One of the many desirable features built directly into Docker is networking. Docker’s networking feature can be accessed by using a --link flag which allows to connect any number of Docker containers without the need to expose a container’s internal ports to the outside world.

In this guide, you will learn how to network two or more Docker containers together on a Linux system through command line instructions. This will work on any Linux distribution. Check out the step by step instructions below to find out how.

In this tutorial you will learn:

  • How to network Docker containers together

Read more

Configuring an NFS server share on Linux

How to configure NFS on Linux

Sharing files between computers and servers is an essential networking task. Thankfully, NFS (Network File System) is available for Linux systems and makes the job extremely easy. With NFS properly configured, moving files between computers is as easy as moving files around on the same machine. Since NFS functionality is built directly into the Linux kernel, it is both powerful and available on every Linux distro, although the configuration can differ slightly between them.

In this guide, we’ll show how to install and configure NFS on major Linux distros, like Ubuntu and others based on Debian, and Fedora and others based on Red Hat. The configuration will involve a server (which hosts the files) and one client machine (which connects to the server to view or upload files). Follow along with the steps below to get NFS setup on your own system.

In this tutorial you will learn:

  • How to install NFS server
  • How to configure NFS server shares
  • How to connect to NFS server from client machines

Read more

Configuring the wireless interface on Ubuntu Linux

Setup Wireless interface on Ubuntu

Setting up the wireless interface on Ubuntu Linux is likely one of the first things you’ll need to do after installing the operating system and booting into it for the first time. As long as you have the proper hardware, Ubuntu can easily connect to Wi-Fi networks configured with various types of security like WEP, WPA, and WPA2.

In this guide, we will cover the step by step instructions to connect to a Wi-Fi network from the GNOME GUI (the default desktop environment) on Ubuntu. We will also show how to connect to Wi-Fi from command line, which is handy in the case of headless servers or those running without a desktop environment. Follow along with us below to find out how.

In this tutorial you will learn:

  • How to connect to Wi-Fi network in GNOME GUI
  • How to connect to Wi-Fi network via command line
  • How to enable or disable the system’s Wi-Fi adapter

Read more

Changing the hostname on Debian Linux

How to change hostname on Debian Linux

The hostname of a Linux system is important because it’s used to identify the device on a network. The hostname is also shown in other prominent places, such as in the terminal prompt. This gives you a constant reminder of which system you’re working with. It’s a real life saver when you’re managing multiple systems through SSH and those command line terminals start to blend together in your mind.

Of course, IP addresses are used when devices need to communicate with each other, but those can change frequently. Hostnames give us a way to know which device we’re interacting with either on the network or physically, without remembering a bunch of numbers that are subject to change. Thus, it’s important that your system bears a hostname which helps you to identify it quickly. For example, “backup-server” is much more informative than “server2.” If you can’t easily identify a system’s purpose from the hostname, it’s time to change it.

In this guide, we’ll show you how to change the hostname on Debian Linux. Changing the hostname can be done either by command line or GUI, and we’ll show you the steps for both methods below.

In this tutorial you will learn:

  • How to change the Debian hostname from command line
  • How to change the Debian hostname from GNOME GUI
Changing the hostname on Debian Linux

Changing the hostname on Debian Linux

Read more

Configuring Squid proxy on Linux

Squid proxy configuration tutorial on Linux

Squid is a robust proxy server that supports caching for protocols like HTTP, HTTPS, and FTP. It has the ability to speed up web requests by caching frequently accessed websites, and serving that cache to requesting clients. This is a great way for networks to reduce bandwidth consumption and provide snappier response times for web browsing.

In this guide, we’ll go over the step by step instructions to download, install, and configure Squid proxy on a Linux system. Follow along with us to get it setup on your own system, which can either provide caching just for yourself or all the way up to an entire organization of computers.

In this tutorial you will learn:

  • How to download and install Squid proxy on major Linux distros
  • How to configure Squid proxy
  • How to configure a browser to use Squid proxy

Read more

Creating an SSH tunnel through port forwarding on Linux

Enable SSH port forwarding on Linux

Most Linux users are familiar with the SSH protocol as it allows remote management of any Linux system. It’s also commonly used for SFTP to download or upload files. SSH is known as a very secure protocol because it encrypts traffic end to end. But the encrypted tunnels it creates are actually quite versatile and can be used for more than just remote server management or file transfer.

SSH port forwarding can be used to encrypt the traffic between two systems for pretty much any protocol. This is accomplished by creating a secure tunnel and then routing another protocol’s traffic through that tunnel. By principle, it works very similarly to a VPN.

In this guide, we’ll go over the step by step instructions to show you how to use SSH port forwarding to create a secure tunnel for some other application. As an example, we’ll create port forwarding for the telnet protocol, which is usually avoided because of how it transfers data in clear text. This will secure the protocol and make it safe to use.

In this tutorial you will learn:

  • How to use SSH port forwarding
  • How to create a persistent SSH tunnel

Read more

How to setup an FTP/SFTP server on AlmaLinux

How to setup FTP/SFTP server and client on AlmaLinux

FTP and SFTP are great protocols for downloading files from a remote or local server, or uploading files onto the server. FTP will suffice for some situations, but for connections over the internet, SFTP is recommended. In other words, FTP is not secure to use over an internet connection, since your credentials and data are transmitted without encryption. The ‘S’ in SFTP stands for ‘Secure’ and tunnels the FTP protocol through SSH, providing the encryption needed to establish a secure connection.

In this guide, we’ll go over the step by step instructions to setup an FTP server through VSFTP software or SFTP server through OpenSSH on AlmaLinux. Then, we’ll see how to connect to the server from a client AlmaLinux system. Setting up FTP/SFTP is a common step after installing AlmaLinux or migrating from CentOS to AlmaLinux.

In this tutorial you will learn:

  • How to setup an FTP server through VSFTPD
  • How to setup an SFTP server through OpenSSH
  • How to setup FTP and SFTP user accounts
  • How to allow FTP and SFTP through firewalld
  • How to connect to an FTP/SFTP server via command line
  • How to connect to an FTP/SFTP server via GNOME GUI
How to setup an FTP/SFTP server on AlmaLinux

How to setup an FTP/SFTP server on AlmaLinux

Read more