Results 1 to 4 of 4

Thread: Linux: Explain NAT/Firewall to me shortly and clearly with examples

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Linux: Explain NAT/Firewall to me shortly and clearly with examples

    Hello people. I've been looking to learn about NAT but all the guides ive found are very long and go in depth; not so easy to read. Im sure its not that complicated. Can some nice person please explain it to me "in a nutshell"? Lets say I have a small LAN of about 3 pcs and a NAT/firewall pc connecting them to the internet. What commands would I need to run to set up network address translation so that those pcs could communicate with the outside world?

  2. #2
    Senior Member Rahul.Patil's Avatar
    Join Date
    Feb 2012
    Location
    Mumbai india
    Posts
    486
    Thanks
    10
    Thanked 50 Times in 47 Posts
    Rep Power
    8

    Default

    NAT :-
    Network Address Translation generally involves "re-writing the source and/or destination addresses of IP packets as they pass through a router or firewall"

    Refer this page for more info about nat.

    TO share internet to other pc you need to add
    MASQUERADE rule in NAT, go through this page for the same

    For more info:
    Code:
    man iptables
    Rahul Patil <http://www.linuxian.com>

  3. The Following User Says Thank You to Rahul.Patil For This Useful Post:

    fedoraman (24th February 2013)

  4. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    23
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    thanks i read those links and they are very useful.

    I have a little LAN now im trying to do a rule to forward all dns traffic from outside world to my DNS server: I think this:

    Code:
    iptables -t nat -A PREROUTING -p udp --dport 53 -s ! 10.35.13.0/8 -j DNAT --to-destination 10.35.13.4:53
    iptables -t nat -A POSTROUTING -j MASQUERADE
    should work, but the first command is for some reason not working. If I remove the exclamation mark it works but Im pretty sure its the right syntax because this syntax I found on many guides and websites. I get error: Bad argument `10.35.13.0/8'. once again, without the "!" the command runs perfectly

  5. #4
    Senior Member Rahul.Patil's Avatar
    Join Date
    Feb 2012
    Location
    Mumbai india
    Posts
    486
    Thanks
    10
    Thanked 50 Times in 47 Posts
    Rep Power
    8

    Default

    May be you are using old version of iptables that's why it is not accepting "!" .


    What you want to achieve in dns ? can you explain more.
    Rahul Patil <http://www.linuxian.com>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Resume Examples NOT TECHNICAL
    By jaysunn in forum The Hangout
    Replies: 6
    Last Post: 19th April 2011, 07:09 PM
  2. Sed label branching examples
    By meta in forum Shell scripting
    Replies: 5
    Last Post: 5th April 2010, 09:03 PM
  3. UNIX / Linux echo command examples
    By raj in forum Getting started tutorials
    Replies: 8
    Last Post: 15th November 2009, 03:18 AM
  4. Can someone please explain this to me
    By gyterpena in forum Shell scripting
    Replies: 2
    Last Post: 29th December 2007, 01:25 AM
  5. nmap howto and examples
    By sgmsara in forum Linux software
    Replies: 2
    Last Post: 12th February 2007, 08:59 PM

Tags for this Thread

Posting Permissions

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