+ Post New Thread
Results 1 to 10 of 10
*nix Thread, openvpn / iptables in Technical; Every time I restart my openvpn server, I need to manually type the following command, so that the VPN clients ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200

    openvpn / iptables

    Every time I restart my openvpn server, I need to manually type the following command, so that the VPN clients can see other devices on the remote network.

    Code:
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
    Is there anything I can set so that it will remember this setting, or is the only option to just add it to a startup script or something

  2. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    iptables-save ?

  3. Thanks to kmount from:

    RabbieBurns (4th August 2009)

  4. #3

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    I do
    Code:
    iptables-save > /etc/iptables.save
    and then in rc.local (earlier would be better, but I'm lazy)

    Code:
    iptables-restore < /etc/iptables.save

  5. Thanks to powdarrmonkey from:

    RabbieBurns (4th August 2009)

  6. #4


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    shorewall really is iptables made easy

    Shoreline Firewall

  7. Thanks to CyberNerd from:

    RabbieBurns (4th August 2009)

  8. #5

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Quote Originally Posted by kmount View Post
    iptables-save ?
    Is that all i need to do? hah, this has been bugging me for about a year. ..

    powdarrrmonkey, Is that necessary or will kmonts suggestion do?

    Cybernerd, I dont even use iptables as a firewall, i just found that the only way to do what I wanted with openvpn was to envoke that command...

  9. #6


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    On gentoo, you should be able to use /etc/init.d/iptables save which will dump it into /var/lib/iptables/rules-save and then when /etc/init.d/iptables start is ran on boot up it should load them back as below.

    Code:
    /etc/init.d/iptables save
    * Saving iptables state 
    
    /etc/init.d/iptables stop
    * Saving iptables state  
    * Stopping firewall 
    
    /etc/init.d/iptables start
    * Loading iptables state and starting firewall

  10. Thanks to kmount from:

    RabbieBurns (4th August 2009)

  11. #7

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    I thought there might be some gentoo magic.

    @RB: it's the same thing: iptables-save just spits out a machine-interpreted dump of the current state. You have to put it somewhere though.

  12. Thanks to powdarrmonkey from:

    RabbieBurns (4th August 2009)

  13. #8

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    thanks very much for your help... I think I must owe you both a crate of beer for all the continued help

  14. #9

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Sounds like a plan

  15. #10


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    I'm a tennants man; remember that when you're next home

SHARE:
+ Post New Thread

Similar Threads

  1. [Ubuntu] IPTables Port Forwarding
    By localzuk in forum *nix
    Replies: 17
    Last Post: 3rd June 2009, 10:18 PM
  2. iptables firewall rules
    By Jackd in forum *nix
    Replies: 4
    Last Post: 28th April 2009, 07:07 PM
  3. IPTables - Port rules
    By ahuxham in forum *nix
    Replies: 2
    Last Post: 17th September 2008, 02:56 PM
  4. iptables multiple ports
    By Jackd in forum *nix
    Replies: 1
    Last Post: 23rd December 2007, 10:19 PM
  5. Setting up NAT using IPTABLES
    By ChrisH in forum *nix
    Replies: 23
    Last Post: 9th November 2005, 01:54 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •