How to manage a relay with a dynamic IPv6 address?

I recently started running a middle relay on a dedicated laptop at home.
It works great and self-testing indicates that it allows both IPv4 and IPv6 traffic.

However, it has gone down a couple of times after running approximately 6-8 days on each occurrence. Both times I first noticed it labelled as offline on Tor Metrics, and each time nyx showed it with flags: none and as having about 60-80% of the usual number of connections (mostly some long-lived ones).

I’m running version 0.4.8.13 on Lubuntu and my torrc file is as follows:

Nickname irrelevant
ContactInfo irrelevant
ORPort 443
ExitRelay 0
SocksPort 0
Log notice file /var/log/tor/all
ControlPort auto
CookieAuthentication 1
CookieAuthFileGroupReadable 1

I don’t explicitly specify the IP addresses, letting it configures them automatically.

I suspect my issue is caused by my IPv6 address changing. I don’t have a static v6 address and after the relay goes down, the v6 address that it started up with is no longer listed in the output of ip -6 address.
I assumed that the relay would respond to this by switching to a new v6 address automatically, but due to a bug it does not.

I know this can be resolved by manually restarting the service, but this means the relay might be unavailable for several hours until I’m able to do so.

Is there a better way I can handle my IPv6 address changing?
Or maybe a way to set up a static address? My ISP says the v6 prefix is not static, but it hasn’t changed in a long while, so it’s as good as static to me. I’m rather new to IPv6, so I’m not sure if/how I can configure a static address for my machine.

2 Likes

If i understand you correctly only your ipv6 address changes and not your ipv6 prefix. If that is the case you should take a look at ipv6 privacy extensions and check if they are enabled on your machine. How do you configure your networking?

2 Likes

Thanks for the idea.
I took a look at my networking setting (named “Advanced Network Configuration” on Lubuntu), but I couldn’t figure out how to correctly set up a static IP address there.
My IPv6 privacy extensions was set to “Default”, which I’m guessing means exactly what I described in my post. My address generation was set to “Stable privacy” and I didn’t feel comfortable setting it to “EUI64”, since as far as i understand it’s not considered best practice.

In the process of research I found this helpful Reddit post about setting up a static v6 address.

So I set my netplan config to the following:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp19s0:
      addresses:
        - "<my v6>/48"
        - "<my v4>/24"
      routes:
        - to: default
          via: "<router v6>"
        - to: default
          via: "<router v4>"

And after applying the configuration with netplan apply, running ip -6 a now showed my address with lifetime forever.
But the relay self-test was now reporting complete lack of connectivity.
After tinkering around with local and global addresses, it seems to work fine. So my problem is now resolved.
I then also ported the generated connection (wired in my case) to my default one.

For anyone who might face a similar issue:

  1. Open Advanced Network Configuration
  2. Edit the connection.
  3. IPv6 Settings > Additional static addresses > Add
  4. Address is prefix+custom, e.g. 2a03:dead:beef::420
  5. Prefix is the prefix length (usually 48 or 64)
  6. Gateway is the public router IPv6 address, e.g. 2a03:dead:beef::c0:ffee
  7. Restart networking; sudo netplan apply seems to do the job

OR

  1. Set the same values in /etc/netplan/01-network-manager-all.yaml
  2. Run sudo netplan apply
2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.