I’ve got an asterisk server that connects to an upstream provider over a WAN. The upstream provider supports both IPv4 and IPv6 connectivity, and the asterisk server is behind a NAT.
When asterisk connects to the upstream sip peer via IPv6, everything works perfectly.
The issue I have is that when I configure the asterisk server IPv6 address via DHCPv6, a race condition means that asterisk sometimes ends up attempting to contact the upstream peer via IPv4 (the SIP DNS name has both A and AAAA records). This is because asterisk starts up before the system has a valid IPv6 address. The connection does not work via IPv4 because of the NAT.
Is there a way of configuring the peer to specify that it should only be contactable over IPv6? I guess it might be possible to hack together a firewall rule to deny all IPv4 traffic to that IP, but it’d be easier to configure this within asterisk itself.
Here is what’s going on. This explanation is geared toward Red Hat derived systems:
The server’s startup scripts execute in a particular sequence, with some scripts depending on others completing successfully.
In the case of asterisk, it requires (or should require) that the network be up before starting. You’ll see this in the init script as a line like:
# Required-Start: $local_fs $remote_fs $network
$network is present.
The problem is that by default the network is considered “up” if IPv4 configuration completes, even if IPv6 configuration does not complete.
To change this behavior, edit
/etc/sysconfig/network-scripts/ifcfg-eth0 (or your particular interface) to specify that IPv6 must also come up:
Note that only NetworkManager pays attention to this setting, so if you’ve disabled NetworkManager and are using the old network script, it will be ignored. You can also make the equivalent setting in the NetworkManager GUI.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.