[SOLVED] ip_forwarding not working after iptables-restore

This forum is for discussion about general software issues.

[SOLVED] ip_forwarding not working after iptables-restore

Postby dgbaley27 » Tue Apr 21, 2015 7:20 am

Hey. I'm using an rpi2 as an OpenVPN bridge, so I have ip_forwarding enabled and a MASQUERADE target for packets leaving the tun interface. I have an entry in /etc/sysctl.d, rules in /etc/iptables/iptables.rules, and iptables.service enabled which calls iptables-restore.

I found this old thread which may be related. At first glance, on my system, ip_forwarding isn't working. Eventually I realized it stops working after iptables rules are reloaded.

A fix is simply to disable (write 0 to ip_forward) and then re-enable (write 1). I haven't encountered this issue on any other system, so I don't know if it's a race condition that I'm only seeing now on the pi, or there's something specific to this system.
Last edited by dgbaley27 on Thu Apr 30, 2015 5:33 am, edited 1 time in total.
dgbaley27
 
Posts: 4
Joined: Tue Apr 21, 2015 6:58 am

Re: ip_forwarding not working after iptables-restore

Postby dgbaley27 » Thu Apr 30, 2015 5:33 am

Turns out to be a systemd change that's "under documented". IPForward=yes is required in *.network files now.
dgbaley27
 
Posts: 4
Joined: Tue Apr 21, 2015 6:58 am

Re: [SOLVED] ip_forwarding not working after iptables-restor

Postby Geoff » Sat May 02, 2015 7:10 pm

Thank you for this. It was driving me crazy a couple of weeks ago, as I too was using my cubox as a vpn/wifi/ethernet router and it stopped routing.
Last edited by Geoff on Sat May 02, 2015 7:18 pm, edited 1 time in total.
Geoff
 
Posts: 231
Joined: Wed Mar 09, 2011 5:14 pm

Re: [SOLVED] ip_forwarding not working after iptables-restor

Postby dgbaley27 » Sat May 02, 2015 7:18 pm

No problem. I'll add here for completeness that the ip_forward sysctl setting is not needed in addition to the per-device settings; AFAIK it's equivalent to setting conf/all/forwarding and conf/default/forwarding to on. But now netword is setting conf/<DEV>/forwarding individually.
dgbaley27
 
Posts: 4
Joined: Tue Apr 21, 2015 6:58 am


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests