OpenWrt Forum Archive

Topic: Using NetNS to assign WAN IP to device on LAN

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

A question commonly asked by Verizon FiOS users is "can I use my own router?"  For the most part the answer is yes, but certain features (on-screen caller ID and remote DVR access) require that the Verizon-branded router be configured with your public IP address.  If you want to use your own router and still keep all features, that generally means running your router secondary... which makes your LAN "double NAT'ed".

One way to run your own router "primary" and still keep Caller ID and Remote DVR is the elaborate "three router" setup described here: http://www.dslreports.com/faq/16710  The key to that setup is to insert a third router -- between your router and the Verizon-branded router -- as a NAT so they can both share the same public IP.

Now I think that's silly and a waste of electricity, so I instead came up with a way with OpenWRT (using Linux Network Namespaces and the Virtual Ethernet driver), to accomplish the same thing without the third router.

My scripts are up on github: https://github.com/Voltara/openwrt-fakewan

They consist of an init.d script that sets up the namespaced interfaces, and a udhcpc.user script that reconfigures the namespaced network (IP addresses, SNAT's, dnsmasq) whenever the public IP changes.  It can also cycle disable/enable a switch port to force the secondary device to renew DHCP (the switch port needs to be on a separate SNMP managed switch; OpenWRT's "swconfig" currently does not expose the "enable_port" function in the driver.)

The big downside of this is you need your own custom build of OpenWRT because the stock build does not enable CONFIG_KERNEL_NET_NS.  (And I'm not sure what the proper way is to ask for it.)

But the code is out there if you want to play with it!

I uploaded the binaries from my custom build of r42853 (ar71xx-generic): http://voltara.org/openwrt/

The only files you really need from my build are the firmware image and any kernel modules you use (the kmod packages from the official build won't work.)  Everything else can come from the official packages.

No guarantees that my build won't brick you (it works fine on my Netgear WNDR3800, though.)

The discussion might have continued from here.