Skip to content

IPv4/6 Mix Mode

One thing I struggled with on my nodes was getting the systems running in IPv4 / IPv6 mixed mode with Prometheus monitoring using IPv6. While this is quite simple to accomplish once you know what needs changed, I found the information hard to find and figured most of this out through trial and error. I hope this saves you some time. I will be using the server I created in the Minimized Ubuntu 22.04 guide and adding Prometheus monitoring.

First thing you need to do is make sure the system has both an IPv4 and IPv6 address. I’m not going to go into configuring the addresses on the computer but to verify you have both, you can use the ifconfig command. The output from my system is shown below.

I’ve highlighted the IP addresses in yellow. It’s quite possible there will be more than 1 IPv6 address as shown in my output. The address you need with be tagged as ‘global’. My system shows 2 global addresses. The one I highlighted is one I manually assigned to the interface, so I chose it.

First thing we are going to do is configure the cnode Prometheus exporter to use IPv6 instead of IPv4. This is controlled in the config.json file located in the /opt/cardano/cnode/files directory. Change to that directory and use nano to edit the file.

cd /opt/cardano/cnode/files
nano config.json

Arrow down until you file the “hasPrometheus” section circled below and change the address to be :: as shown in the 2nd image.

Use CTRL-o to save the changes to the file and the CTRL-x to quit nano. This will configure the Prometheus exporter to listen on IPv6 instead of IPv4.

The rest of the changes are to files located in the guild scripts directory. We need to edit the env file in that directory. Let’s to to that directory now.

cd /opt/cardano/cnode/scripts
nano env

From my experience, there are 3 things you need to change in the env file, only 1 of which makes sense. This is my original file.

The change that makes sense to me is the IP_VERSION setting towards the bottom of the screen. This will need to be uncommented by removing thge # sign and instead of the default setting of 4, change it to mix. For the 2 settings I dont get, but that seem to be required anyway, uncomment the CNODE_HOME setting and uncommand the PROM_HOST setting. My modified file is below.

I would have expected to set the PROM_HOST to :: as we did in the config.json file, but that does not work. With it uncommented and set to the standard localhost, everything seems to work. Use CTRL-o to save the file and CTRL-x to exit nano.

Time to restart the cnode application and apply the changes. Since sudo is required, you will likely be prompted for your password.

sudo systemctl restart cnode

That should be all that you need to change. As I said it’s not hard to do, but it took me awhile to figure out how the different pieces wanted to be configured. Constructive comments are always welcome. Please note you may need to make local or even external firewall changes to allow the IPv6 connections.

Please consider delegating to my pool: LBC1M

Leave a Reply

Your email address will not be published. Required fields are marked *