LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-15-2003, 08:58 AM   #1
WorldBuilder
Member
 
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Rep: Reputation: 30
NAT startup question


Hi all,

I have an RH 8 box acting as my gateway, DNS server, sendmail server, Samba server, etc.). One thing that I find annoying is that if I happen to reboot this machine, I lose internet access from all the other Windows machines until I run the following 2 commands:

# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# echo 1 > /proc/sys/net/ipv4/ip_forward

After that, internet access from all the other computers on the network runs fine. My question is this. How can I get these two things to startup when the computer is booted so I won't have to manually run the commands every time? Thanks all!

Chris
 
Old 05-15-2003, 09:30 AM   #2
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
AFAIR one of the /etc/rc.d/init.d scripts is responsible for firewall setting (look for a script with a name like 'firewall' or something like this:)
next if you found it you see the script executes command 'iptables-restore <file_name'
this is the files name which need to be changed with the command 'iptables-save>file_name'
regarding the "echo..." put it anywhere in the booting scripts, for instance in the same 'firewall' script.
 
Old 05-15-2003, 10:17 AM   #3
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Short of that not working you can place commands in an rc.local file (usually located in /etc/rc.d but sometimes symlinked in /etc/rc.local). They will be executed before anyone logs in, during system startup.

Cool
 
Old 05-15-2003, 10:34 AM   #4
WorldBuilder
Member
 
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Original Poster
Rep: Reputation: 30
Thanks guys,

I'll check that stuff out and let you know here. MasterC, good seeing you again!

Chris
 
Old 05-15-2003, 10:47 AM   #5
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
What I did was I created a full router/firewall script and put it into my root dir and then edited the /etc/init.d/network script which is where the NICs are loaded on setup to lauch my script. However since you are running only two commands I would suggest just editing that file and putting the two lines before the stop command. This way as soon as the NICs are loaded so is the internet for the rest of your network.
 
  


Reply



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
Nat Question keefaz Linux - Networking 3 08-25-2008 03:55 AM
NAT and DNS Question whohasit Linux - Networking 1 07-19-2005 10:29 PM
nat question gubak Linux - Networking 2 03-01-2005 06:54 AM
a simple (?) NAT question Sarinyo Linux - Security 2 10-20-2004 02:50 AM
please confirm NAT question. musicman_ace Linux - Networking 3 06-02-2004 02:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

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