+ 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
    4,747
    Blog Entries
    6
    Thank Post
    1,015
    Thanked 427 Times in 272 Posts
    Rep Power
    141

    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. IDG Tech News

  3. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,431
    Thank Post
    327
    Thanked 726 Times in 654 Posts
    Rep Power
    201
    iptables-save ?

  4. Thanks to kmount from:

    RabbieBurns (4th August 2009)

  5. #3

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,855
    Thank Post
    412
    Thanked 774 Times in 647 Posts
    Rep Power
    168
    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

  6. Thanks to powdarrmonkey from:

    RabbieBurns (4th August 2009)

  7. #4


    Join Date
    Jan 2006
    Posts
    6,456
    Thank Post
    324
    Thanked 740 Times in 557 Posts
    Rep Power
    201
    shorewall really is iptables made easy

    Shoreline Firewall

  8. Thanks to CyberNerd from:

    RabbieBurns (4th August 2009)

  9. #5

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    4,747
    Blog Entries
    6
    Thank Post
    1,015
    Thanked 427 Times in 272 Posts
    Rep Power
    141
    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...

  10. #6


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,431
    Thank Post
    327
    Thanked 726 Times in 654 Posts
    Rep Power
    201
    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

  11. Thanks to kmount from:

    RabbieBurns (4th August 2009)

  12. #7

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,855
    Thank Post
    412
    Thanked 774 Times in 647 Posts
    Rep Power
    168
    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.

  13. Thanks to powdarrmonkey from:

    RabbieBurns (4th August 2009)

  14. #8

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    4,747
    Blog Entries
    6
    Thank Post
    1,015
    Thanked 427 Times in 272 Posts
    Rep Power
    141
    thanks very much for your help... I think I must owe you both a crate of beer for all the continued help

  15. #9

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,855
    Thank Post
    412
    Thanked 774 Times in 647 Posts
    Rep Power
    168
    Sounds like a plan

  16. #10


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,431
    Thank Post
    327
    Thanked 726 Times in 654 Posts
    Rep Power
    201
    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, 11:19 PM
  5. Setting up NAT using IPTABLES
    By ChrisH in forum *nix
    Replies: 23
    Last Post: 9th November 2005, 02: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
  •