Find the answer to your Linux question:
Results 1 to 2 of 2
fedora core -2. i have 2 NIC on my system. suppose, eth0 is 60.61.62.63 (public IP ) and eth1 is 192.168.239.20 (for internal users). i want to configure nat as ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Location
    india
    Posts
    87

    nat & firewall thru iptables


    fedora core -2.

    i have 2 NIC on my system. suppose,
    eth0 is 60.61.62.63 (public IP ) and
    eth1 is 192.168.239.20 (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 ??

    FLUSH

    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 192.168.239.0/255.255.255.0 -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
    Just Joined!
    Join Date
    May 2005
    Posts
    6

    Nat

    www.tldp.org
    guides...
    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
  •