Bug report: IPv6 configuration fails on Debian 12 due to deprecated ifconfig command

Issue with network configuration in Debian 12

There is a compatibility issue in the network configuration generated by Virtualmin for Debian 12 systems. The configuration uses the ifconfig command, which is no longer included by default in Debian 12.

Problem details:

  • The issue occurs when adding a new IPv6 network interface during the “Create Virtual Server” process that wasn’t previously active
  • In /etc/network/interfaces, there is a line using ifconfig to add an additional IPv6 address:
up ifconfig eth0 inet6 add 2001:db8:1234:5678:abcd:1234:5678:abcd/64
  • The ifconfig command is part of the net-tools package, which is no longer installed by default in Debian 12
  • This causes network configuration to fail when using the default Debian 12 installation

Consequences:

  • The networking service fails to start during boot
  • As a result, nginx also fails to start during the boot process
  • This leads to system services not working properly after installation

Additional issue with manual fixes:

  • If a user manually corrects the command in /etc/network/interfaces by changing from ifconfig to ip, this fix is completely deleted when creating another virtual server

Solution:

Replace the ifconfig command with the equivalent ip command (from the iproute2 package) in the Virtualmin code that generates network configurations:

up ip -6 addr add 2001:db8:1234:5678:abcd:1234:5678:abcd/64 dev eth0

This modification ensures compatibility with Debian 12’s default networking tools without requiring additional packages to be installed, and would need to be implemented in the Virtualmin code that generates these configuration files.


2 Likes

Solution: IPv6 Configuration Fails on Debian 12 Due to Deprecated ifconfig Command

I’ve found and fixed the cause of the IPv6 configuration problem affecting Virtualmin on Debian 12. The issue occurs when adding additional IPv6 addresses to network interfaces during virtual server creation.

Root Cause

The problem exists in the Webmin networking library file /usr/share/webmin/net/debian-linux-lib.pl. There are actually two issues:

  1. Writing Issue: When generating configuration, it uses the deprecated ifconfig command which is no longer available by default in Debian 12.

  2. Reading Issue: When parsing existing configurations, it fails to recognize IPv6 addresses configured with ip -6 addr add format (only recognizing the ip addr add format without the -6 flag).

This means that when Virtualmin writes to /etc/network/interfaces, it uses an unavailable command, and when it reads its own modified configurations, it may not properly recognize existing IPv6 entries.

Complete Solution (Two Parts)

Part 1: Fix the Writing Code

In the save_interface() function (line 341), replace:

push(@options6, [ "up","ifconfig $cfg->{'fullname'} inet6 add $a/$n" ]);

with:

push(@options6, [ "up","ip -6 addr add $a/$n dev $cfg->{'fullname'}" ]);

Part 2: Fix the Reading Code

In the boot_interfaces() function (line 136), replace:

elsif ($param eq "up" &&
       $value =~ /ip\s+addr\s+add\s+([a-f0-9:]+)\/(\d+)\s+dev\s+(\S+)/ &&
        $3 eq $name) {
    # Additional v6 address with ip command, like :
    # ip addr add 2607:f3:aaab:3::10/64 dev eth0
    push(@{$v6cfg->{'address6'}}, $1);
    push(@{$v6cfg->{'netmask6'}}, $2);
}

with:

elsif ($param eq "up" &&
       $value =~ /ip\s+(-6\s+)?addr\s+add\s+([a-f0-9:]+)\/(\d+)\s+dev\s+(\S+)/ &&
        $4 eq $name) {
    # Additional v6 address with ip command, like :
    # ip addr add 2607:f3:aaab:3::10/64 dev eth0
    # or: ip -6 addr add 2607:f3:aaab:3::10/64 dev eth0
    push(@{$v6cfg->{'address6'}}, $2);
    push(@{$v6cfg->{'netmask6'}}, $3);
}

This updated regular expression now properly recognizes both formats (ip addr add and ip -6 addr add) and adjusts the capture groups accordingly.

Why This Works

The fix addresses both sides of the problem:

  • It updates the writing portion to use the modern ip command that’s available in Debian 12
  • It improves the reading portion to recognize both formats of IPv6 configuration commands

After applying this fix, Virtualmin will:

  1. Correctly read existing IPv6 configurations, including those with the -6 flag
  2. Write new configurations using the proper modern syntax
  3. Preserve IPv6 addresses when modifying network configurations

This comprehensive fix should resolve the issues with IPv6 configurations in Virtualmin on Debian 12 without requiring the installation of deprecated packages.

Hello,

Thanks for the heads up!

Did you test those suggestions?

Could you also show a screenshot of the page you’re using to add the IPv6 address in Virtualmin?

1 Like

Be extremely careful with anything ChatGPT suggests. I’m not saying it’s wrong, but I’d be surprised if it’s entirely right.

I normally delete ChatGPT answers (and it’s against our guidelines to post LLM-generated answers), but since you’re answering your own question, and this is an issue that needs fixing, I’ll leave it as part of the discussion.

It won’t make it into the next Webmin release, that’s already been tagged, but we’ll definitely fix any dependencies on ifconfig.

4 Likes

yes, it is working now! this is the page I am using:

Thanks! And, could you also show the error message you receive when creating a new virtual server?

And, what is the output of the following command on your system:

whereis ifconfig

unfortunately, there was no error message during the creation of a new virtual server. my system would only fail to bring up networking during the next boot up.

sudo whereis ifconfig
ifconfig:

Did you later use the “Webmin / Networking ⇾ Network Configuration” module to add or apply IPv6 address?

Never mind, we see what the issue is.

2 Likes