Operating System - Linux
1752482 Members
5847 Online
108788 Solutions
New Discussion юеВ

Put this where? : /sbin/iptables -t nat -A POSTROUTING -o p1p1 -j MASQUERADE

 
SOLVED
Go to solution
tony j. podrasky
Valued Contributor

Put this where? : /sbin/iptables -t nat -A POSTROUTING -o p1p1 -j MASQUERADE

Good Morning Ladies & Gentlemen;

I have a small network in my house (16 hosts). I connected the cable MODEM to "blacktower" on the p1p1 intf.

Blacktower's em1 intf is on the local net. All the hosts can ping/telnet/ssh etc, to each other.

I want the other 15 hosts to go thru blacktower to access the internet.

I did some (actually A LOT) of searching and found what I needed to do. I edited the /etc/sysctl.conf file and then executed the command:  "/sbin/iptables -t nat -A POSTROUTING -o p1p1 -j MASQUERADE". Everything worked.

And my question is: Where do I put that command so that it is executed during boot time (I put it in the /etc/rc..local and that worked - but I'd like to put it where it should be)?

Thank you in advance for any and all help

regards, tonyp

REMEMBER: Once you eliminate your #1 problem, #2 gets a promotion.
2 REPLIES 2
medosena
New Member
Solution

Re: Put this where? : /sbin/iptables -t nat -A POSTROUTING -o p1p1 -j MASQUERADE

After executing the command "/sbin/iptables -t nat -A ....", save iptables rules, by running:

# service iptables save

this will write changes into /etc/sysconfig/iptables, and this will survive reboots.

tony j. podrasky
Valued Contributor

Re: Put this where? : /sbin/iptables -t nat -A POSTROUTING -o p1p1 -j MASQUERADE

Hello medosena;

Thank you for your suggestion. It worked great!

 

REMEMBER: Once you eliminate your #1 problem, #2 gets a promotion.