Skip to content.

A Note About Website Navigation

Skip to main menu.

For users of screen readers, depending on the screen resolution, the two checkboxes are for opening and closing the side menus that appear to the left and right side of the screen. This is designed both for large screens and for mobile devices with a touch screen. Checking either the main menu or sidebar checkboxes causes the menu to open from the left or right side of the screen, respectively. Clearing the checkox in either the main menu or sidebar closes the menu. The checkboxes are visible to screen readers such as JAWS and NVDA for Windows, Voiceover for Mac, and Orca screen reader for Linux. When a screen reader says "clickable" for both main menu and sidebar, that is for the respective checkboxes. End of explaination.

Viewing Single Blog Post

Pro Tip for Proxmox Users: Need to Add Multiple IP Addresses for a Single NIC in LXC?

A Note About Proxmox and LXC (Linux Containers)

For those unfamiliar with LXC and Proxmox, LXC is similar to a virtual machine that runs a guest OS (Windows, Linux, Mac, Android, etc.) but the container part of LXC excludes the core part of the OS and simply provides networking and storage inside a container. Unlike virtual machines, applications inside a container can access resources on a host system directly. Proxmox is a hypervisor for running virtual machines and Linux containers (LXC) in a server hardware.

IP Addresses and Subnetting

Do you need to have multiple IP addresses assigned to a network interface inside an LXC container? In terms of networking, a single NIC can have multiple IP addresses. This is useful if you want to run a single server with multiple websites that have their own IP address. Here's what I mean:

172.20.31.0/23
A small HTML file with a list of websites hosted by the web server.
172.20.31.1/23
A web application running Adminer, a lightweight alternative to phpMyAdmin.
172.20.31.2/23
A development version of my website that mirrors a production version. Anyone who visits my site sees my production version of my website. Once I test the changes I made in the development website, I push the changes up to the production website.
172.20.31.3/23
A custom-built web application for taking notes. Any notes written in HTML gets shown up in the web browser.
172.20.31.4/23
A development version of the note-taking web application taken from 172.20.31.3.

A note for those new to networking: pay attention to the subnet. A slash 23 subnet can start with 172.20.30.1 and ends at 172.20.31.254. Both 172.20.30.255 and 172.20.31.0 are both valid IP addresses. 172.20.30.0 is a network address and 172.20.31.255 is a broadcast address. Cisco has an article about IP addressing and subnetting in order to help you understand how subnetting works. With that out of the way, let's get into configuring a Linux container running in a Proxmox server.

How I Initially Configure the Network Interface Inside a Linux Container?

When you create a new Linux container, you get to the Networking tab and filled in the IP address and default gateway. Once you start the container, the output of /etc/network/interfaces is as follows:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

Now you want to add additional IP addresses to a single network interface:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

iface eth0 inet static
        address 172.20.31.1/23

iface eth0 inet static
        address 172.20.31.2/23

iface eth0 inet static
        address 172.20.31.3/23

iface eth0 inet static
        address 172.20.31.4/23

You saved the file and you did a restart of networking service:

systemctl restart networking

What happens if you reboot? The output will be as follows:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

iface eth0 inet static
        address 172.20.31.0/23
        gateway 172.20.30.1

If I did not check out the /etc/network/interfaces file, I would execute the ip a command that lists IP addresses for all interfaces and saw something similar to this:

gpadmin-local@webservers:~$ ip a
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0@if111:  mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 7e:ef:18:b4:a4:b9 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.20.31.0/23 brd 172.20.31.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::7cef:18ff:feb4:a4b9/64 scope link 
       valid_lft forever preferred_lft forever
When I restarted the networking service, I found out that the network interface (eth0) already exists. I don't know why Proxmox would change individual IP addresses to the same IP address and add redundant default gateways with the same IP address, but it seems Proxmox does not handle multiple IP addresses in a network section of the web interface for the Linux container.

Solution

Turns out I have to remove the IP address and gateway from the network configuration. With the Linux container selected (in my case: webservers), I went into Network, double-click the eth0 row containing an IP address, tab over to IPv4/CIDR edit box and removed both the IP address/subnet mask and gateway. Once I've done that, I clicked OK, made configuration changes in /etc/network/interfaces, and rebooted the container. In order to verify full networking functionality, I rebooted the Linux container, logged back into the container, and once I execute ip a command, all the IP addresses are preserved.

IPv4/CIDR and Gateway set to blank.
A screenshot of the Proxmox web interface. Everything in the sreenshot is darkened except for the two edit boxes, which is IP address/CIDR and default gateway. Both are set to blank and the IPv4/CIDR edit box shows "None." This image only shows a dialog box for network configuration. Those with eyesight can view a large image by clicking or tapping in the figure.

Oh, and I almost forgot: this network configuration can also apply to Ubuntu, AlmaLinux, Rocky Linux, OpenSUSE, and just about any other Linux distributions.

Notes For Those Who Use a Screen Reader

For anyone using a screen reader such as JAWS (Windows), NVDA (Windows), VoiceOver (Mac), or Orca (Linux), I'm not sure how anyone can access a virtual machine within a Proxmox web interface. And I'm not even sure if screen readers can read the text within the Linux container console; however, I am able to copy text from the console. The only difference is I have to highlight using a mouse, right-click in the console, and select copy. Doing Control+C sends a termination signal or displays ^C in a terminal. Doing Control+V once does nothing, but executing Control=V again shows a ^V in a console, so pasting text in a Proxmox console does nothing for those who do not want or cannot use a mouse.

Summary

The bottom line is this: in the networking section of the Proxmox web interface, leave the IP address and default gateway blank. Once you get into the console, edit the /etc.network/interfaces and add your IP addresses manually.

Happy Computing!


Article published: 2022-06-21 20:22

Categories: The World of Computers, Networking,

About Grayson Peddie

Hello! I am a web developer and I have a passion for the world of Information Technology. I currently hold 4 CompTIA certificates (A+, Network+, Security+, and CySA+) including Cisco's CCNA (Cisco Certified Network Associate) certificate. Speaking of web development, I am a web accessibility enthusiast. I make sure that users of screen readers and keyboard users who cannot use a mouse can be able to access my website with just only the keyboard. Plus, I have learned a whole lot about Web Content Accessibility Guidelines.

So what are my hobbies? Aside from web development, I watch Star Trek: The Next Generation from time to time during the nights. I listen to music from the likes of David Arkenstone, Yanni, Checkfield, Cucso, Looreena McKennitt, Clannad, 2002, Enya, and even soundtrack from EPCOT Center (1982-1994), Tomorrowland, WALL-E, and TRON: Legacy. Oh, yes! Tomorrowland, TRON: Legacy, and WALL-E are the three movies I watch during Friday nights and every Friday night is my pizza night. I'm an optimist who likes to see what kind of future the world would look like. That's why I follow The Venus Project on Twitter (here's the website to The Venus Project. I do have a lot to cover in my introductory article in my website, so if you want to go in-depth and know more about me, that is the article to visit.