LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-01-2014, 04:10 AM   #1
Shkel
LQ Newbie
 
Registered: Apr 2014
Posts: 25

Rep: Reputation: 1
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.
 
Old 05-01-2014, 04:38 AM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,795

Rep: Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883Reputation: 1883
rc.local is a good place
 
Old 05-01-2014, 04:56 AM   #3
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116Reputation: 8116
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

Last edited by Alien Bob; 05-01-2014 at 04:57 AM.
 
Old 05-01-2014, 05:17 AM   #4
Shkel
LQ Newbie
 
Registered: Apr 2014
Posts: 25

Original Poster
Rep: Reputation: 1
Thank you everybody for your replies
 
Old 05-01-2014, 05:29 AM   #5
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Don't forget to activate rc.ip_forward, by the way.

Code:
# chmod +x /etc/rc.d/rc.ip_forward
 
Old 05-01-2014, 08:01 AM   #6
Shkel
LQ Newbie
 
Registered: Apr 2014
Posts: 25

Original Poster
Rep: Reputation: 1
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 ?

Last edited by Shkel; 05-01-2014 at 08:02 AM.
 
Old 05-01-2014, 09:11 AM   #7
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Quote:
Originally Posted by Shkel View Post
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.
 
Old 05-01-2014, 09:20 AM   #8
Shkel
LQ Newbie
 
Registered: Apr 2014
Posts: 25

Original Poster
Rep: Reputation: 1
Well fine, thank you kikinovak
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware crashes on every other startup tfnc99 Slackware 7 09-14-2012 10:21 AM
slackware 10 startup script jonc Linux - Newbie 2 12-04-2004 06:02 PM
Slackware 9.0 startup keystone Linux - Newbie 2 10-31-2003 04:02 PM
Slackware StartUp skate Linux - Newbie 2 10-14-2003 06:04 AM
Slackware Startup shortbill Linux - General 1 11-21-2002 03:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration