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!

how can i load this on boot up

Status
Not open for further replies.

dekcool

Programmer
Oct 2, 2002
231
PH
hi!

how can i load this on boot up

------------
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
---------

any inputs will appreciate, thanks in advance

____________________________________________________
Invest your time in learning, Not just practicing.

DEK
 
It depends on your distribution. Check /etc/rc.d and/or /etc/init.d directories.
 
Ok if your Red Hat 7.2 -> then:

Add the following lines to the bottom of the /etc/rc.local file

# turn on ip forwarding to enable masquarade to work
/bin/echo 1 > /proc/sys/net/ipv4/ip_forward

look in /etc/sysconfig/ for a file "firewall" or "iptables" and add the iptables rule there.

Make sure that iptables is enabled a init with: chkconfig --list iptables.

Good Luck
Laurie.
 
Depending on which distro, make sure that the network script is not doing something also.

On RH9 I wanted to do the same thing, so I put the echo in rc.local but would not take. After examing the /etc/rc.d/init.d/network script I found that the script was always putting a 0 to turn off forwarding.
 
hi!

tarn thanks

but i dont get what you mean could you more elaborate thanks again iam very new with linux
-----
look in /etc/sysconfig/ for a file "firewall" or "iptables" and add the iptables rule there.

Make sure that iptables is enabled a init with: chkconfig --list iptables.

------



____________________________________________________
Invest your time in learning, Not just practicing.

DEK
 
Sorry I should have been more specific 'maybe'

In /etc/sysconfig/ there may be a file called iptables (sorry in my test server firewall is a sym link to iptables), now in /etc/rc.d/init.d/ there is a start script for iptables that uses that file for iptables configuration: see `more /etc/rc.d/init.d/iptables` (so when iptables is started then it looks for /etc/sysconfig/iptables and uses(implements) the rules from within there).

So if it does not exist then create it, add in your rule and restart iptables with `/etc/rc.d/init.d/iptables restart`

Now on Red Hat there is a script that will setup your start scripts called chkconfig, its simple to use but too long for me to document here see `man chkconfig`

I hope that clears it up?

Good Luck
Laurie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top