#1  
Old 16th February 2008, 17:45
mfaridi mfaridi is offline
Junior Member
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mfaridi
Default debian 4 and NAT

I use this link for configure NAT on Debian 4 and do everything this link said

http://www.howtoforge.org/nat_iptables

but after reboot system I have to do all of this command for run
how I can save this rules and use them in reboot ???

How I can make script from rule and put them in /init.d/

Last edited by mfaridi; 16th February 2008 at 17:59.
Reply With Quote
Sponsored Links
  #2  
Old 16th February 2008, 18:25
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Code:
iptables-save > /etc/iptables-rules
Edit /etc/network/interfaces under your main interface add
Code:
pre-up /sbin/iptables-restore < /etc/iptables-rules
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #3  
Old 17th February 2008, 06:29
mfaridi mfaridi is offline
Junior Member
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mfaridi
Default

Quote:
Originally Posted by topdog
Code:
iptables-save > /etc/iptables-rules
Edit /etc/network/interfaces under your main interface add
Code:
pre-up /sbin/iptables-restore < /etc/iptables-rules

Thanks
first I type this command step by step
Code:
iptables --flush
Code:
iptables --table nat --flush
Code:
iptables --delete-chain
Code:
iptables --table nat --delete-chain
Code:
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
Code:
iptables --append FORWARD --in-interface eth1 -j ACCEPT
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
after that I run this command
Code:
iptables-save > /etc/iptables-rules
and then I put this line

Code:
pre-up /sbin/iptables-restore < /etc/iptables-rules
in

Code:
/etc/network/interfaces
before

Code:
auto eth0
and after description of eth0 , but after that I can not ssh to system and NAT does not work


Reply With Quote
  #4  
Old 17th February 2008, 08:21
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
 
Default

That goes under iface eth0 ....
Note that the rules provided there are just for NAT no firewalling rules are entered.

what is the output of the file ? To see why you cannot ssh in
Code:
cat /etc/iptables-rules
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
vmware on dapper drake -missing NAT connection radox HOWTO-Related Questions 3 5th January 2007 15:58
Need help ISPConfig and NAT weird domain problems nightshade2109 Installation/Configuration 11 16th November 2006 14:49
The Perfect Xen 3.0 Setup For Debian - NAT problem amussa HOWTO-Related Questions 9 28th September 2006 21:27
The Perfect Xen 3.0 Setup For Debian - Virtual Networking Mito HOWTO-Related Questions 9 27th April 2006 16:33
The Perfect Xen 3.0 Setup For Debian - virtual network problem rsacon HOWTO-Related Questions 11 21st April 2006 21:24


All times are GMT +2. The time now is 18:07.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.