LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 14.1 IP-Masquerading : On startup (https://www.linuxquestions.org/questions/slackware-14/slackware-14-1-ip-masquerading-on-startup-4175503548/)

Shkel 05-01-2014 03:10 AM

Slackware 14.1 IP-Masquerading : On startup
 
Hi,

How configure IP-Masquerading on startup without firewall.
Add this stance :
Code:

iptables -t nat -A POSTROUTING -o eth* -s *.*.*.*/24 -j MASQUERADE
I would like to configure it in rc.local or rc.ip_forward, is it possible or the solution is somewhere else ?

Thanks.

willysr 05-01-2014 03:38 AM

rc.local is a good place

Alien Bob 05-01-2014 03:56 AM

If you add your firewall commands in a (new) file "/etc/rc.d/rc.firewall" and make it executable, then Slackware will run that script on boot and you don't have to change anything - it's automatic.
Code:

cat <<EOF > /etc/rc.d/rc.firewall
#!/bin/sh
# Use full path to binaries in a r script:
/usr/sbin/iptables -t nat -A POSTROUTING -o eth* -s *.*.*.*/24 -j MASQUERADE
EOF
chmod +x /etc/rc.d/rc.firewall

Note that the above instructions will overwrite an existing rc.firewall file, so be careful! If the file exists already, just add your iptables commandline to the end.

Eric

Shkel 05-01-2014 04:17 AM

Thank you everybody for your replies ;)

kikinovak 05-01-2014 04:29 AM

Don't forget to activate rc.ip_forward, by the way.

Code:

# chmod +x /etc/rc.d/rc.ip_forward

Shkel 05-01-2014 07:01 AM

It works on boot after have activated rc.ip_fordward and created/activated the rc.firewall file with Alien Bob's data.

But if I want to use the rc.local file only, I must just add the stance of my initial post and active rc.ip_forward file ?

kikinovak 05-01-2014 08:11 AM

Quote:

Originally Posted by Shkel (Post 5162538)
It works on boot after have activated rc.ip_fordward and created/activated the rc.firewall file with Alien Bob's data.

But if I want to use the rc.local file only, I must just add the stance of my initial post and active rc.ip_forward file ?

Yes, that's a possibility.

Shkel 05-01-2014 08:20 AM

Well fine, thank you kikinovak ;)


All times are GMT -5. The time now is 05:42 PM.