Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005

    nat & firewall thru iptables

    fedora core -2.

    i have 2 NIC on my system. suppose,
    eth0 is (public IP ) and
    eth1 is (for internal users).
    i want to configure nat as well as firewall. following are the commands which i am planning to run. will it be ok ??


    iptables -t filter -F INPUT
    iptables -t filter -F OUTPUT
    iptables -t filter -F FORWARD
    iptables -t nat -F PREROUTING
    iptables -t nat -F POSTROUTING
    iptables -t nat -F OUTPUT

    DEFAULT policies
    iptables -t filter -P INPUT DROP
    iptables -t filter -P OUTPUT ACCEPT
    iptables -t filter -P FORWARD DROP
    iptables -t nat -P PREROUTING ACCEPT
    iptables -t nat -P POSTROUTING ACCEPT
    iptables -t nat -P OUTPUT ACCEPT

    Set up the firewall rules
    iptables -t filter -A INPUT -i ${LOOPBACK} -j ACCEPT
    iptables -t filter -A INPUT -i eth1 -j ACCEPT
    iptables -t filter -A INPUT -i eth0 state --state RELATED,ESTABLISHED -j ACCEPT
    iptables -t filter -A FORWARD -i eth1 -o eth0 -j ACCEPT
    iptables -t filter -A FORWARD -i eth0 -o eth1 state --state RELATED,ESTABLISHED -j ACCEPT

    Set up ip masquerading
    iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

    i can understand this is a lengthy post . but i have been trying this since 2 days. Is this OK ?? pliz help....

  2. #2


    securing and optimizing linux
    Nat section..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts