Zyxel P-660HW-T1 vs IPv6 tunnel vs SIP

I’m a SIP/VoIP user.  It allows me to make international calls for the cost of a local connection.  I have set up a Linksys PAP2T gateway with a regular phone connected to it. Worked great for calling out.  Unfortunately, the SIP gateway kept on logging out of the SIP server.  It could last a day or an hour, but it would always eventually lose the logged-in state and never return to it without human intervention.  Resetting the gateway would not help, it was usually necessary to switch it off for 15 minutes or so.  A quicker method was to change the SIP port from 5060 to 5061 and back every time I needed to restore the service.  I tried fiddling with the PAP2T settings, but no setting changes seemed to alleviate the issue.

I’m also a an IPv6 user.  I’ve got an OpenWRT installation on WRT54GL, running aiccu and providing an IPv6 tunnel from SixXS.  The tunnel had a similar ailment: it would go down every couple hours to days.  The workaround was to restart aiccu.  I would restart it when I needed it.

At some point, I started neglecting the IPv6 tunnel.  I didn’t need to use it, and I just didn’t bother to restart it.  At the same time, I noticed that the SIP gateway would stay logged in without dropping out for much longer than usual.  This state remained for about two weeks, until I needed to reinstate the IPv6 tunnel.  Right after doing that, I walked over to the SIP gate and… noticed that it had dropped out.  Correlation does not imply causation, but you know… it raised my suspicion.  What is it that these two devices have in common?  The router!

A search on Google for “zyxel sixxs sip” revealed a forum post, in which someone described the same symptoms I had, with a bit of diagnostics.  Both the IPv6 tunnel and the SIP service are using UDP, which is harder to NAT than TCP.  The Zyxel router would repeatedly get confused and misinterpret the IPv6 related UDP packets as SIP packets and vice versa.

The solution was to take away the logic out of the Zyxel router and make it act as a DSL modem only. I’ve reconfigured it to the bridge / transparent mode, and moved the NAT logic to OpenWRT.  I initially wasn’t sure how the bridging mode works, but it turned out to be simple enough.  What’s nice about my particular setup is that I have a static IP address.  The setup uses a /30 network block, so it’s effectively using up 4 of the IPv4 address space.  It’s essentially a 2-bit netblock, so we can use 0, 1, 2, and 3 as the addresses.  In practice it can be something like 83.251.44.193, and any CIDR calculator will tell you, that if your netmask is /30 (or 255.255.255.252), then it’s a 4-address network starting at 83.251.44.192 and ending at 83.251.44.195. Let’s consider the NAT mode first.

  • 0: netblock address
  • 1: the router tells you it’s the the remote side (the gateway)
  • 2: the router’s public IP address
  • 3: the broadcast address
It might look like the 1 address is remote, at the ISP side.  But if you configure your router in a bridging mode, you have 2 devices, and they both have public IP addresses.  Let’s call them Zyxel (acting as a DSL modem) and OpenWRT (doing NAT).
  • 0: netblock address
  • 1: the Zyxel router’s address (gateway)
  • 2: the OpenWRT router’s address
  • 3: the broadcast address
So what you might have thought of as the remote IP address, is your local router’s address.  What was there left to do, was configuring NAT on OpenWRT.  Linux knows how to interpret incoming UDP packets, and both my SIP gate and IPv6 tunnel are working correctly now.  Plus, I have more control.
Advertisements

Author: automatthias

You won't believe what a skeptic I am.