Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I have a linux box with two network interfaces, one of which is connected to the Internet and the other to my internal network. I enabled IP forwarding and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Location
    Malta
    Posts
    41

    Question on iptables


    Hi,

    I have a linux box with two network interfaces, one of which is connected to the Internet and the other to my internal network.

    I enabled IP forwarding and set the following iptable rule:
    Code:
    iptables -t nat -A POSTROUTING -j MASQUERADE
    Now this works and am able to connect to the internet from PCs on my internal network.

    Can anyone please tell me how to save the iptables rule so that it gets added automatically when the box is rebooted?

    Thanks
    is-serp

  2. #2
    Urb
    Urb is offline
    Just Joined!
    Join Date
    Feb 2005
    Posts
    5
    See the script /etc/init.d/iptables with "save active|inactive" argument
    more information to use it in /etc/default/iptables

    but if you have only this rule, the simplest way is to add it directly to the script /etc/ppp/ip-up, this will be executed when pppd start.

  3. #3
    Just Joined!
    Join Date
    May 2004
    Location
    Malta
    Posts
    41
    Quote Originally Posted by Urb
    See the script /etc/init.d/iptables with "save active|inactive" argument
    more information to use it in /etc/default/iptables
    Both the script and the file are missing in Debian Sarge. When I ran Fedora Core 3 on the gatway i used:
    Code:
    service iptables save
    Is there a similiar command in Debian?

  4. $spacer_open
    $spacer_close
  5. #4
    Urb
    Urb is offline
    Just Joined!
    Join Date
    Feb 2005
    Posts
    5
    Both the script and the file are missing in Debian Sarge.
    yes, i saw that this script was installed there is a long time
    starting from Woody and were never removed from my /etc/init.d/ directory.

    In the current iptables package in Sid and also Sarge, there is an example of this old initd script:
    /usr/share/doc/iptables/examples/

    When I ran Fedora Core 3 on the gatway i used:
    Code:
    service iptables save
    Is there a similiar command in Debian?
    iptables-save and iptables-restore, the script use these executables for save and load a rules state at boot.

    Isn't to set your rules in a file, make it executable and add to /etc/ppp/ip-up.d/
    appropriate ?

    (sorry for my poor English)

  6. #5
    Just Joined!
    Join Date
    May 2004
    Location
    Malta
    Posts
    41
    Quote Originally Posted by Urb
    Isn't to set your rules in a file, make it executable and add to /etc/ppp/ip-up.d/
    appropriate ?
    Yeah I can do that... just wanted to check whether there is something that will do it automitically for me.

    Quote Originally Posted by Urb
    (sorry for my poor English)
    Don't worry mate. I'm not a native English speaker either. Thanks for your help.

Posting Permissions

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