Mass add IPv6 addresses to all domains, and add IPv6 address by default.

We’d like to start using IPv6 for everything (because we can!), and that means updating all our old virtual hosting customers in Virtualmin to use IPv6 as well. But I can’t find any way to do this through the Virtualmin web interface.

Also, it would be real nice to set up IPv6 addresses by default on creating a new domain, so that people don’t have to remember to check that box. Is this possible in the server templates (it doesn’t seem to be)?

Thanks for posting how you got that working!

If you wanted to use the Virtualmin UI for tweaking individual IPv6 addresses, it’s possible to do that in Server Configuration -> Change IP Address.

But, for mass-adding IP’s, your solution is great!


Wow. I think I just broke a new record for answering my own question.

The answer is…

Run the following on each domain:

virtualmin modify-domain --domain --allocate-ip6

This assumes that you already have a pool of IP addresses assigned in Virtualmin under System Settings -> Server Templates -> Virtual IP address.

This is best run on the command line against a list of domains like this:

for i in cat domains.txt; do virtualmin modify-domain --domain $i --allocate-ip6; done;

One way to gather this list of domains is to do this:

virtualmin list-domains --name-only > domains.txt

But there may be some domains that don’t make sense to Virtualmin… you can edit these out of domains.txt, or just ignore the error messages about nonexistent domains.

By the way what would be the syntax for setting the ip6 to the single shared address? When i try it (e.g. virtualmin modify-domain --domain --ip6 2606:2800:220:1:248:1893:25c8:1946 but with my real domains and ip) i get

Error: Failed to add IPv6 address : SIOCSIFADDR: File exists

Academic for me as i’m doing it manually via the browser Server Configuration -> Change IP Address but thought it might help others :slight_smile:

By the way, the reason i wanted to do this was because I was getting Let’s Encrypt errors on my new Linode server, saying that the .well-known file wan’t found (challenge did not pass etc), but i could see it fine in a browser. I was also getting not found when trying the same url with curl from the server, which said it was trying to access it via the IP6 address, hence thinking this would be worth a go and it seems to have been.

We also got the “apache installed ok” site showing up on a facebook for one of the sites, and that’s also ok now :slight_smile: