IAX trunk between Asterisk and FreePBX - Unreachable

I am trying to setup an IAX trunk between a FreePBX instance (10.0.30.200, pbx1) and an Asterisk instance (10.0.30.201, pbx2).

FreePBX has an IAX trunk setup with the outgoing being:
username=pbx1
type=peer
host=10.0.30.201
secret=redacted
context=from-trunk
qualify=yes
disallow=all
allow=ulaw

And the ingoing being:
type=user
secret=redacted
host=10.0.30.201
context=from-internal
disallow=all
allow=ulaw

On my asterisk instance, the relevant config in iax.conf is the following:
[pbx2]
username=pbx2
type=peer
host=10.0.30.200
secret=redacted
context=from-trunk
disallow=all
allow=ulaw

[pbx1]
type=user
secret=redacted
host=10.0.30.200
context=from-internal
disallow=all
allow=ulaw

All I see on my freepbx is that the trunk is unreachable. There are no logs in asterisk.
pbx1/pbx1 10.0.30.201 (S) 255.255.255.255 4569 UNREACHABLE

I have no idea where to go from here, I have tried SIP trunks, register strings and nothing is working. How can I get this to work?

What are the ip addresses of your two IAX2 servers, If you are .201 then it is unlikely that the incoming will also be .201, conversely with the server at 200, (using a secret on a 10. network is unnecessary for what should be obvious reasons, but you will need a username both ways for peers and users, you can use type=friend and avoid the need for username and secret, if so for efficiency add trunk=yes both ends )

https://www.telecomworld101.com/Asterisk/IAX2Trunk.html

Might help you

I’ve now followed this guide to the letter, and something still isn’t working. For the hell of it I tried pasting the exact configuration and it still shows as offline. They are on the same network so I don’t get why this isn’t working.

This doesn’t really help me. I’ve tried the examples there and they don’t work. I think it is to do with my asterisk iax.conf:

[200-IAXpeer]
host=10.0.30.200
type=friend
context=from-internal
qualify=yes
trunk=yes

Note: this is updated from the guide you sent.

When I type iax2 show peers on the asterisk machine, I get the following message:
0 iax2 peers [0 online, 0 offline, 0 unmonitored]

I really don’t know where to go from here

I have fixed this issue, when I did a reload on iax, it turned out there was an include statement (from the NPSTN boilerplate) that led to a file that didn’t exist. I wish I saw this sooner.