Forum Moderators: bakedjake

Message Too Old, No Replies

Iptables

Iptables

         

dcool86

4:35 am on Feb 21, 2012 (gmt 0)

10+ Year Member



Hello,


I have a server behind a proxy. I need to whitelist the proxy ip. I'm new at this.


I have tried the code below

/sbin/iptables -I INPUT -i eth0 -s 111.11.11.11 -j ACCEPT

The Ip isn't real just example.

I think it worked i'm not sure if thats permanent solution.
If I restart the server will it stay whitelisted?


Thank you

lammert

4:44 am on Feb 21, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Normally rules which you add by hand will only stay active until the next reboot. To be sure that the rule is permanent, you have to add it to the list of iptables rules which is read on startup. On RedHat/Centos/Fedora family of distributions, the startup configuration is stored in the file /etc/sysconfig/iptables

You can add the new rule there by hand (not recommended) or store your current iptables configuration in the file with the following command:

/sbin/iptables-save > /etc/sysconfig/iptables

dcool86

5:03 am on Feb 21, 2012 (gmt 0)

10+ Year Member



I forgot to mention the OS it's ubuntu 11.10 sorry

dcool86

5:05 am on Feb 21, 2012 (gmt 0)

10+ Year Member



What would be the command once I put in

/sbin/iptables -I INPUT -i eth0 -s 111.11.11.11 -j ACCEPT

Then to save it for ubuntu 11.10


Thank you for your help!

lammert

5:35 am on Feb 21, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have no recent Ubuntu installation to test, but I remember that Ubuntu saves the iptables configuration in /etc/iptables.rules You may want to check if that file exists on your server.

dcool86

5:38 am on Feb 21, 2012 (gmt 0)

10+ Year Member



Will do thank you