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.

  • 3
    Don't assign your servers' addresses with DHCPv6. Problem solved. (And a lot of other problems solved...) – Michael Hampton Jun 23 '13 at 23:51
  • In addition to Michael's comment; given that IPv6 support is still in its infancy in most applications (which sucks but is the truth), doing this at the firewall is most likely the easiest way of doing it. It wouldn't be much of a "hack" and should be simple enough to do. Another option could be to just remove the IPv4 gateway from the asterisk server? – Mark Henderson Jun 23 '13 at 23:58
  • I had a grand, bold vision of being able to DHCP ALL THE THINGS, but I'm slowly learning that this is overly optimistic. Static addressing it is then. – growse Jun 24 '13 at 9:29
  • DHCP address assignment is totally unnecessary in IPv6, but that doesn't mean you are denied the ability to use DHCPv6 to specify host configuration information (such as NTP and DNS servers). – Falcon Momot Jun 26 '13 at 3:30
  • This was pretty much my understanding. That said, if you want a static IPv6 address, you're either in manual configuration land, or your into using DHCP and static leases. The latter is much easier to manage centrally, but invokes DHCPv6-flavoured issues. – growse Jun 26 '13 at 8:57

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

where $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.

  • Interesting. I'm actually running this on Ubuntu, but I can see a situation where the system marks networking as complete before DHCPv6 completes. I'll investigate how this is configured in Ubuntu. – growse Jun 26 '13 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.