Skip to content

Instantly share code, notes, and snippets.

@fcharlier
Created April 20, 2012 14:31
Show Gist options
  • Save fcharlier/2429088 to your computer and use it in GitHub Desktop.
Save fcharlier/2429088 to your computer and use it in GitHub Desktop.
Activate IP forwarding
# Activate ip forwarding
exec { '/sbin/sysctl -w net.ipv4.ip_forward=1':
unless => "/sbin/sysctl net.ipv4.ip_forward | /bin/grep -q ' = 1$'",
}
exec { "persist ip forwarding":
command => "/bin/echo 'net.ipv4.ip_forward=1' > /etc/sysctl.conf",
unless => "/bin/grep -q '^net.ipv4.ip_forward=1$' /etc/sysctl.conf",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment