vps header 1200x200

3.3 Why we will use Network Manager to Create a Bridge Connection

A bridge connection is a way to enable our virtual private server to bypass our host computer and connect to the public internet using its own static IP address rather than the IP address of our host computer. Giving each VPS its own static IP address that goes directly to the Internet is an essential step before we can add a Hestia Control Panel to each VPS. In this article, we will explain how to create a bridge network interface using a Linux tool called Network Manager. As a reminder, here is what a Bridge connection looks like:

101

What is Network Manager and Why We Recommend It
Setting up a sandbox virtual private server has numerous challenges that can be very confusing for beginners. First, there are many tools for creating virtual private machines. Many tutorials on the Internet explain how to use a tool called VirtualBox to create virtual servers. I do not recommend VirtualBox because it is not a native Linux tool. A real virtual private server creates Linux Kernel Virtual Machines (KVM). We therefore recommend learning how to use tools called Virtual Machine Manager and Cockpit. Both of these tools create KVM virtual servers.

02

The second challenge we are faced with is that the default network, called NAT will allow us to install Hestia because NAT hides our VPS behind our host computer IP address. We therefore need to learn how to create a bridge network (which we will do in this article). But the challenges do not end there. In the next article, we will learn how to use DNS which is also required to install Hestia onto our VPS.

The fourth challenge is that there are several different Linux Network Management tools in common use today. Here is a brief description of each.

#1 The Original Linux Network Manager – Ifupdown
The original tool has the terrible name “Ifupdown.” We have to learn to deal with this tool because it is the only tool that comes installed and active by default on our Debian 10 Virtual Private Servers. Ifupdown has very limited functions but is compatible with all of the other more modern network managers.

#2 Network Manager
This Linux tool was created in 2004 to add more functions to Ifupdown. The name Network Manager is very confusing because when one hears the term Network Manager, you have no idea if the term refers to the general concept of a network manager or if the term is being used to refer to the specific program called Network Manager. The benefit of Network Manager over the other two modern options is that Network Manager comes installed and active on Linux Mint Debian Desktop computers and can easily be added to Debian 10 Virtual Servers. Another huge benefit of Network Manager is that it has two graphical interfaces which help beginners better understand how to create and edit network settings.

03

The first of these Network Manager graphical interface tools is an applet which is on your LMDE task bar called Network Connections. On LMDE, click on the Network icon on the right side of your task bar.

04

Network Connections does not work on a Debian 10 server because the server does not include a task bar.

The second graphical tool is has a terrible name called Network Manager Text User Interface or nmtui. You can open nmtui in your terminal. nmtui therefore works with either LMDE or your Debian Virtual Private Servers. This is the tool we will use below to create our first Bridge connection. It is also a tool we will use on our virtual private servers. Here is what Network Manager TUI looks like:

05

Network Manager also comes with a terminal command tool called Network Manager Command Line Interface aka nmcli. The names alone can be challenging for beginners to learn. We will occasionally use nmcli to do tasks that cannot be done by nmtui.

The third network management option is called networkd. Another terrible name. Sadly, networkd conflicts with Network Manager. So you can use one but not both. networkd comes installed on both the LMDE desktop and on Debian 10 servers. Thankfully, it is not active on either – and we are not going to activate it because it would conflict with Network Manager. The drawback of networkd is that it only comes in a command line version. There is no graphical interface version. It is therefore difficult for beginners to understand what networkd is doing. Here is what a typical networkd configuration file looks like:

06

The fourth and final network management option is called Netplan.
As if three choices were not bad enough, in 2017, Ubuntu came out with a new network management tool called Netplan – which uses the truly insane process of setting up a YAML file to control network configurations. Netplan only has a command line version. There is no graphical version. But Netplan is much more difficult to use that Network Manager or networkd because Netplan requires the use of YAML files. YAML files are possibly the most confusing files ever created. This is because YAML files use hidden (non-visible) spaces as part of the command. These hidden spaces must be set in exactly the correct way or the YAML file will not even run. This makes YAML files a nightmare for beginners to learn. Here is an example of a Netplan YAML file:

07

The hidden spaces are to the left of each line. Note that Netplan can use used with either Network Manager or networkd as the renderer (but not both). This means that you still need to learn how to use either Network Manager or networkd in order to use Netplan.

YAML files uses spacial formatting in addition to the conventional text scripting. Spacial formatting means that not on does the text have a special meaning, but so do the indentations and spacing between the words. Get one space or indent out of alignment and the entire YAML file will not run.

The hidden spaces add a level of abstraction that make Netplan the most difficult of the four Linux network management options.

But the most confusing problem for beginners is that each of these four radically different network management tools has its own group of proponents in the Linux community. Each of these groups has created their own Networking tutorials explaining how to use their favorite network management tool. Rarely do any of these hundreds of tutorials even mention that their tutorial only works with their chosen networking tool – nor do they mention that once you start using networkd, you need to turn off Network Manager – or once you decide to use Network Manager, you need to not use networkd.

This crazy situation of 4 different network management tools has led to a massive amount of confusion.

08

To make matters worse, the four different network management tools, have vastly different configuration files each with their own set of rules and locations:

09

Here is what the default If Up Down configuration file looks like:

10

It includes files from the interfaces.d folder. But there is nothing in the interfaces.d folder and therefore nothing in the etc/network/interfaces file. Here is the Network Manager configuration file:

11

Managed false means that Network Manager is not using If Up Down.

As for the systemd configuration file, go to the etc/systemd/network folder. You will see that there is not even a blank configuration file there.

Finally, go to the etc/Netplan folder and open the configuration file:

12

At least on LMDE, Neplan lets Network Manager handle all devices and connections. The good news is that Debian 10 still works with Network Manager and will continue to work with Network Manager. Hopefully, some day, sanity will be restored to the Networking process and YAML files will be thrown into the dust bin of history.

More reasons to use Network Manager for both Home Desktop and Virtual Servers
My home computer uses Network Manager exclusively. Cockpit and Virtual Machine Manager use Network Manager simply because they are applications on my home computer which is a desktop computer that is using Network Manager. The bridge0 connection we are about to make will also be made with the Network Manager graphical interface. To avoid confusion and conflicts, we will also use Network Manager on our Debian 10 virtual servers.

Create a Second Ethernet Device
The biggest problem with creating a Bridge Connection is that it needs an Ethernet port. If you only have one Ethernet device, when you create a bridge connection, it will take your Ethernet Port and if you were using that Ethernet port to access the Internet, you will no longer have access to the Internet via your Ethernet port (you can still just unplug the Ethernet cable and use WIFI – but it will not be as fast or as secure).

13

The solution to this problem is to create a second Ethernet device on a second Ethernet port. One way to create this second Ethernet device is to buy a USB3 to Gigabyte Ethernet Adapter. You can get one of these at Best Buy for less than $25 and use it to set up a second Ethernet port on more than one computer. Plug the USB3 end of the adapter into a USB 3 port (typically located on the left side of your laptop). Then open Network Connections where you will find a new Ethernet Wired Connection 3:

14

Click on the Settings wheel.

15

The new Ethernet device has a really long name that is very difficult to remember. To copy both the name and mac address of the new device, open a terminal and type ip addr

6: enx00051bc8e12e: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000

link/ether 00:05:1b:c8:e1:2e brd ff:ff:ff:ff:ff:ff

The name of the new device is the first set of numbers and letters. The MAC address is the 12 digit code separated by colons right after the word Ether.

Change the name of the new Ethernet Device
To change the name of the new Ethernet device to something shorter, open your file manager and go to File System, etc, udev, rules.d folder. Right click on the screen and click Open as Root. Then enter your password. Then right click on the screen again and click Create New File, Blank File. Name the file 70-persistent-net.rules

Then open the file with Bluefish and copy paste the following (first changing the mac address to the mac address of your new device and changing the name to the new name you want to use:

# This file was automatically generated by the

# /lib/udev/write_net_rules program

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.

# net device example try it without the KERNEL match condition

# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="54:52:00:ff:ff:dd", ATTR{type}=="1", NAME="eth0"

# Change the MAC address and NAME to what you want.

# USB3 to Ethernet Adapter

# device original name enx00051bc8e12e mac 00:05:1b:c8:e1:2e

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:05:1b:c8:e1:2e", ATTR{type}=="1", NAME="enx0"

Then save and close the file and close the file manager. Then restart your laptop.

Then open a terminal and type ip addr. You should now see the new device with the shorter name. But it has no IP address. Close the terminal and open Network Connections. Select the new Wired Connection (which will be the one that has never been used) Then click on the Settings wheel. Then at the Ethernet tab, use the drop down to change the device from enx0 to enx0 with its mac address. Then click on the IPv4 tab. Change the method to Manual and click Add to give it a static IP address:

16

Then click Save and close Network Connections. Then open a terminal and type nmtu to start the graphical interface. Then press Enter. Then use the down arrow to select Activate a connection. Then press Enter. Use the down arrow to select Wired connection 3:

17

Use the right arrow to move to the right column. Then press Enter. Then press Escape to return to the first screen. Then use the down arrow to select Quit and press Enter to close nmtui. Then close the terminal. To test the connection, remove your Ethernet cable from the normal laptop Ethernet Port and insert it into your USB3 to Ethernet adapter.

What’s Next?

Now that we have to Ethernet devices, we are ready to create our first bridge.