OpenVPN howto forgets to mention net.ipv4.ip_forward = 1

Bug #1354657 reported by brjhaverkamp
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Server Guide
Fix Released
Undecided
Ian Nicholson

Bug Description

I followed the official ubuntu howto to install an openvpn
https://help.ubuntu.com/14.04/serverguide/openvpn.html

The guide is very good and helped me to set everything up correctly.
However after finishing, I was not able to ping to other servers in my LAN or to connect to the internet.
After long searching in other manuals I found that I needed to

sysctl -w net.ipv4.ip_forward = 1

After that all worked like a charm.

This small step seems to be missing from the official ubuntu howto.

Kind regards,

Bert

Related branches

Revision history for this message
xtsbdu3reyrbrmroezob (xtsbdu3reyrbrmroezob) wrote :

This is also something I noticed that failed to be mentioned. The documentation should be updated to include that bit of information. Some detailed info that could be included into the next release of the server guide should be per below:

http://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/
"""
By default any modern Linux distributions will have IP Forwarding disabled. This is normally a good idea, as most peoples will not need IP Forwarding, but if we are setting up a Linux router/gateway or maybe a VPN server (pptp or ipsec) or just a plain dial-in server then we will need to enable forwarding. This can be done in several ways that I will present bellow.

Check if IP Forwarding is enabled

We have to query the sysctl kernel value net.ipv4.ip_forward to see if forwarding is enabled or not: Using sysctl:

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
or just checking out the value in the /proc system:

cat /proc/sys/net/ipv4/ip_forward
0
As we can see in both the above examples this was disabled (as show by the value 0).

Enable IP Forwarding on the fly

As with any sysctl kernel parameters we can change the value of net.ipv4.ip_forward on the fly (without rebooting the system):

sysctl -w net.ipv4.ip_forward=1
or

echo 1 > /proc/sys/net/ipv4/ip_forward
the setting is changed instantly; the result will not be preserved after rebooting the system.

Permanent setting using /etc/sysctl.conf

If we want to make this configuration permanent the best way to do it is using the file /etc/sysctl.conf where we can add a line containing net.ipv4.ip_forward = 1

/etc/sysctl.conf:
net.ipv4.ip_forward = 1
if you already have an entry net.ipv4.ip_forward with the value 0 you can change that 1.

To enable the changes made in sysctl.conf you will need to run the command:

sysctl -p /etc/sysctl.conf
On RedHat based systems this is also enabled when restarting the network service:

service network restart
and on Debian/Ubuntu systems this can be also done restarting the procps service:

/etc/init.d/procps.sh restart
"""

Revision history for this message
xtsbdu3reyrbrmroezob (xtsbdu3reyrbrmroezob) wrote :

This bug is confirmed and requires a simple fix, about 3-5 minutes of someone's time with commit access to the server guide.

Changed in serverguide:
status: New → Confirmed
Ian Nicholson (imnichol)
Changed in serverguide:
assignee: nobody → Ian Nicholson (imnichol)
Changed in serverguide:
status: Confirmed → Fix Committed
Revision history for this message
xtsbdu3reyrbrmroezob (xtsbdu3reyrbrmroezob) wrote : Re: [Bug 1354657] Re: OpenVPN howto forgets to mention net.ipv4.ip_forward = 1

Awesome! :)

On Sat, Dec 20, 2014, 12:45 PM Doug Smythies <email address hidden>
wrote:

> ** Changed in: serverguide
> Status: Confirmed => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1354657
>
> Title:
> OpenVPN howto forgets to mention net.ipv4.ip_forward = 1
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/serverguide/+bug/1354657/+subscriptions
>

Changed in serverguide:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.