Testing federation via IPv6
The first real-world test of whether I could run an IPv6-only setup was to see how far I could get following accounts throughout the Fediverse.
Setting up: Get a non-representative list of domains to test
I wanted to make this as close to a real-world test as possible. What would happen if I tried to migrate from an IPv4 or dual-stack Fediverse server to an IPv6-only server running snac?
Rather than testing an arbitrary collection of Fediverse servers, I decided to use the accounts I already follow. The question was simple: would my IPv6-only snac server be able to follow the same accounts?
After exporting follows.csv from Mastodon, I extracted and counted the number of unique domains:
$ tail -n +2 follows.csv | awk -F ',' '{print $1}' | cut -d'@' -f2- | sort | uniq -c | wc -l
120
I currently follow accounts across 120 domains.
These are the domains on which I follow the largest number of accounts:
$ tail -n +2 follows.csv | awk -F ',' '{print $1}' | cut -d'@' -f2- | sort | uniq -c | sort -r | awk '{print $2}'
mastodon.social
bsd.cafe
bsd.network
fosstodon.org
aus.social
infosec.exchange
hachyderm.io
Saving this list of 120 domains to a text file gave me a convenient but non-representative list of domains to test.
The tests
Test One: How many of these domains have IPv6 addresses?
The first test was straightforward: how many of these domains have an IPv6 address?
Just in case some of the domains were no longer available, I also checked for an IPv4 address. The presence of an address does not prove that an instance is still operational, but if a domain has neither an A nor an AAAA record, there isn't much point trying to contact it.
$ for domain in $(cat domains.txt); do echo "$domain: IPv6: $(dig +short AAAA "$domain" | grep -q . && echo "Yes" || echo "No") IPv4: $(dig +short A "$domain" | grep -q . && echo "Yes" || echo "No")"; done > domains-ipv6.txt
$ cat domains-ipv6.txt | awk '{print $2 $3 " " $4 $5}' | sort | uniq -c
26 IPv6:No IPv4:Yes
1 IPv6:Yes IPv4:No
93 IPv6:Yes IPv4:Yes
So all 120 domains have addresses.
- 93 are dual-stack
- 1 is IPv6-only, and
- 26 are IPv4-only.
All of the seven largest domains have an IPv6 address:
- mastodon.social: Yes
- bsd.cafe: Yes
- bsd.network: Yes
- fosstodon.org: Yes
- aus.social: Yes
- infosec.exchange: Yes
- hachyderm.io: Yes
The 26 IPv4-only domains are obviously unreachable directly from my IPv6-only server, so I ignored errors about those domains during the rest of the testing.
That left 94 domains that, at least according to DNS, should be reachable over IPv6.
Test Two: How many of these domains can I actually follow from an IPv6-only instance?
I passed the list of followed accounts to snac and ran the import command.
As expected, attempts to follow accounts on IPv4-only domains did not succeed:
17:38:58 [brendan] cannot resolve user <user@small-server-I-don't-want-to-shame> to follow
17:38:58 [brendan] Cannot follow <user@small-server-I-don't-want-to-shame> -- server down?
What I was not expecting to see was a number of HTTP 401 Unauthorized errors:
17:38:54 actor_request error https://mastodon.social/users/<username> 401
17:38:54 [brendan] cannot get actor to follow https://mastodon.social/users/<username> 401
17:38:54 [brendan] Cannot follow <username>@mastodon.social -- server down?
After the import finished, I exported the follows from snac and counted the number of unique domains represented:
$ tail -n +2 follows-snac.csv | awk -F ',' '{print $1}' | cut -d'@' -f2- | sort | uniq -c | sort -r | awk '{print $2}' | wc -l
51
Of the seven largest domains, I was only following accounts on five of them:
- bsd.cafe
- fosstodon.org
- bsd.network
- infosec.exchange
- hachyderm.io
I certainly did not expect mastodon.social or aus.social to be missing from this list.
Intermission: What on earth...?
I started with 120 domains.
Of these, 26 domains were IPv4-only. I expected that I wouldn't be able to follow any accounts there because my IPv6-only server cannot connect to those servers directly.
That left 94 domains with IPv6 addresses.
I did not expect to be able to follow accounts on only 51 of those domains.
I did not expect 43 domains to disappear somewhere between having a published AAAA record and successfully following an account.
This time, it wasn't DNS. The snac server had successfully connected to at least some of these servers but received 401 Unauthorized responses when trying to retrieve the actor.
Something else is going on here.
For the purposes of my testing, there are four steps to successfully following accounts on other servers:
- the domain publishes an AAAA record; [investigated]
- snac can establishing a connection to the remote server;
- snac can retrieve the ActivityPub actor; and
- snac can send and process the follow.
Conclusion
The presence of an AAAA record was not enough to ensure that I could successfully follow an account from my IPv6-only server.
Finding out where the other 43 domains disappeared will require some follow-up another day.