Add new comment

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by Tim Martin (not registered) on Wed, 2009-03-18 05:23.
Step 8 is completely useless--don't try this at home kids...or at work for that matter.  

"iptables --table nat --flush"
This will remove all chains from your current running netfilter table (firewall rules)...you just dropped your pants.

"iptables --delete-chain"
This will remove all chains from your current running nat table

"iptables --delete-chain"
No need to do this after a flush!  There are no chains in your current running netfilter table because you already flushed it.

"iptables --table nat --delete-chain"
No need to do this after a flush!  There are no chains in your current running nat table because you already flushed it.

"iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE"
This will enable nat in your current running nat table until we get down to the restart below.

"iptables --append FORWARD --in-interface eth1 -j ACCEPT"
This is useless because forwarding is accepted because you flushed your netfilter table

"echo 1 > /proc/sys/net/ipv4/ip_forward"
This will turn on routing.  To bad next time you boot, it will not be enabled.  Use sysctl!!!!

"service iptables restart"
I love this one.  This command will un-do every "iptable" command above.  Now NAT is no longer running.  When the iptables service is restarted, it reads the saved config and anything was in "current running" is gone.  Instead, use iptables-save!


Congratulations, you have a router with no NAT.  But don't worry, it will no longer be a router after you reboot it.  It will go back to the way it was before you started...thankfully

Tim Martin, RHCE 
Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.