Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nat problem

Status
Not open for further replies.

QatQat

IS-IT--Management
Nov 16, 2001
1,031
IT
Hi there,

I want to share a dialup connection on my home lan.

I have ppp0 working correctly

I have set

/proc/sys/net/ipv4/ip_forward = 1

I have started iptables and done the following

iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I have set the gateway on my windoz boxes to the linux eth0 address.

It does not work.

What am I missing?

Thank you.


Qatqat


The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
Found the solution

I had a badly configured /etc/sysconfig/network

so my DNS was not working correctly


But now how do I make so that my Linux box boots up
and loads this two lines automatically


iptables -t nat -P POSTROUTING DROP
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I wrote a script called nat-start and saved it into etc/rc.d/init.d/
but if I do a

chkconfig --level 2345 nat-start on

it comes back with
nat-start does not support chkconfig

Please help


Bye

Qatqat


The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
You should put all iptables rules in [tt]/etc/sysconfig/iptables[/tt].

To create a init script which should be controlled with [tt]chkconfig[/tt], you should have these lines somewhere near the top of the script (I have them after the shebang line):
[tt]# chkconfig: <default levels> <start number> <kill number>
# description: <description>[/tt]


//Daniel
 
Cheers danielhozac,

thank you for your reply.
I am using Mandrake 8.2 as it was installed on this system before.
I don't have a /etc/sysconfig/iptables directory

If I create it, would the script be executed al boot?

What do you mean by shebang? Is it the

#!/bin/sh line?


Thank you

Qatqat





The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
Yes, the shebang line is the [tt]#!/bin/sh[/tt] line.
If you don't have the [tt]/etc/sysconfig/iptables[/tt] file, I doubt that the rules would get applied at boot.

//Daniel
 
Hi Daniel,

I sorted everythign out.

I put in all my rules and then, at the end i run

service iptables save

and the system writes directly into

etc/sysconfig/iptables

I have started now with IPTABLES as I never had a need for it before. It does not seem to complicated though.
Thank you for your time.


Bye


Qatqat


The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top