Skip to content

Instantly share code, notes, and snippets.

@Paraphraser
Last active June 9, 2024 13:42
Show Gist options
  • Save Paraphraser/820a2a8d9e3a18785dab3c4d534ba8ed to your computer and use it in GitHub Desktop.
Save Paraphraser/820a2a8d9e3a18785dab3c4d534ba8ed to your computer and use it in GitHub Desktop.
Add Network Manager to Proxmox-VE Debian Bookworm guest

Add Network Manager to Proxmox-VE Debian Bookworm guest

When you download a Debian "netinst" ISO and use it to construct a system, you reach an installer screen with the title "Software selection". By default, that screen enables the desktop environment and offers you a choice of windowing interfaces.

If you leave the desktop environment enabled then both Network Manager and the Avahi daemon (multicast DNS) are installed and configured, and the system will boot into the desktop windowing environment.

However, if you disable the desktop environment in the "Software selection" screen then the system will boot to the command-line console and neither Network Manager nor the Avahi daemon will have been installed.

It is not immediately clear why electing not to install a windowing environment should also affect data-communications features. It just does.

There are many reasons to steer clear of a windowing environment. Depending on the deployment, multicast DNS may or may not be useful. But Network Manager is a fairly good thing to have on any Debian system and these instructions explain how to get it running.

Test environment

I tested these instructions on a Debian Bookworm 12.5.0 guest running on Proxmox-VE. At the "Software selection" screen, I:

  1. Disabled the desktop environment; and
  2. Enabled SSH.

Assume the following:

  1. The host name is "debian".
  2. The user name is "user".
  3. The IP address is 192.168.132.235.

Procedure

  1. In the Proxmox-VE GUI, use the Summary view to discover the IP address of the guest. An alternative is to login at the console and run:

    $ hostname -I
    
  2. Ensure SSH has no memory of that IP address:

    $ ssh-keygen -R 192.168.132.235
    

    This is a protective command. It guards against a nasty-sounding warning about an adversary-in-the-middle (AITM aka MITM) attack. You should ignore any errors.

  3. Connect to the host:

    $ ssh user@192.168.132.235
    

    You should expect to encounter the Trust On First Use (TOFU) pattern (the first line of the message is, "The authenticity of [this] host can't be established"). Answer "yes" and enter the user's password.

  4. Install required components:

    $ sudo apt update
    $ sudo apt install -y network-manager avahi-daemon
    

    You can omit avahi-daemon if you don't need multicast DNS.

  5. Verify the components just installed are now active:

    $ systemctl is-active NetworkManager.service
    $ systemctl is-active avahi-daemon
    

    Skip the second command if you did not install avahi-daemon.

  6. List the available network interfaces:

    $ ip link show
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
        link/ether bc:24:11:b4:25:c8 brd ff:ff:ff:ff:ff:ff
        altname enp0s18
    
  7. Ask Network Manager what it knows about network connections:

    $ nmcli conn show
    NAME  UUID                                  TYPE      DEVICE 
    lo    b1ac2883-da07-45eb-a2e3-e04cf3379baf  loopback  lo     
    
  8. The reason why ens18 doesn't appear in the nmcli output is because that interface has been configured in /etc/network/interfaces. That needs to be fixed:

    $ sudo sed -i.bak -e '/ens18/ s/^/#/' /etc/network/interfaces
    

    Notes:

    1. The -e '/ens18/ s/^/#/' rule inserts a # at the start of any line containing ens18.
    2. Add additional -e patterns if ip link show shows multiple interfaces (other than lo).
  9. Restart NetworkManager:

    $ sudo systemctl restart NetworkManager.service
    
  10. Check the result:

    $ nmcli conn show
    NAME                UUID                                  TYPE      DEVICE 
    ens18               ebc05113-7710-411e-bc12-8f324324506c  ethernet  ens18  
    lo                  b1ac2883-da07-45eb-a2e3-e04cf3379baf  loopback  lo     
    Wired connection 1  ac8407a3-f661-3e72-8c37-800c33712f5c  ethernet  --     
    
  11. The ens18 interface is known to NetworkManager but it is in a kind of limbo state. Fix that with a reboot:

    $ sudo reboot
    
  12. Reconnect (this time using the mDNS name):

    $ ssh-keygen -R debian.local
    $ ssh user@debian.local
    

    Expect the TOFU pattern, respond "yes" and supply the password.

    If you decided not to install the Avahi daemon then stick with the IP address form:

    $ ssh user@192.168.132.235
    

    but keep in mind that the IP address may have changed during the reboot so you may need to rediscover it and use ssh-keygen -R to avoid AITM warnings.

  13. Check the result:

    $ nmcli conn show
    NAME                UUID                                  TYPE      DEVICE 
    Wired connection 1  ac8407a3-f661-3e72-8c37-800c33712f5c  ethernet  ens18  
    lo                  300aa1ff-be57-42f2-8ffd-a6da7f535701  loopback  lo     
    

Now Network Manager is responsible for the ens18 interface and the system is running like a bought one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment