Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Dec 1998 08:16:08 -0700 (MST)
From:      wildcardus freakis <wildcard@dax.belen.k12.nm.us>
To:        Mark Mayo <mark@vmunix.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: NATD + firewall - I'm stumped..
Message-ID:  <Pine.BSF.3.96.981208080110.10172A-101000@dax.belen.k12.nm.us>
In-Reply-To: <19981208030926.A25214@vmunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-1238522451-913130168=:11752
Content-Type: TEXT/PLAIN; charset=US-ASCII



Ok I have had alot of experience with NAT and I remember that there are a
couple of things that helped me a whole lot, ( I even called one of the
origional programmers...once you know these things nat is so cake to set
up....the first thing is...

Get rid of the second card...I must have burnt up three weekends trying to
get it to work with the duel card deal...once I removed the second card
everything was cake...and a duel card is not really needed...all class B
addresses must have a AT device to work.

Also for some reason the magic port for NAT is 50000 

Also from the nat machine you cannot telnet directly to inside machines,
if you want to, you either have to set up a internal DNS name (i.e. in-dax
v.s. dax) or go by IP, this is from the NAT machine only...you can telnet
from outside to inside machines regularly once you have the alias in place
and from inside to inside machines normally.

also you need some alias options in natd.conf

I have included my conf files...so please contact me if you need any
clarifications.


Sasha

On Tue, 8 Dec 1998, Mark Mayo wrote:

> Hi all. I've been trying to get what I thought would be a trivial
> gateway to the net setup. I have a very simple setup - a P133 with
> two interface: ed1 and de0
> 
> ed1 is plugged into my cable modem with a static IP - 24.112.137.146
> de0 is plugged into my hub on the internal network - 192.168.4.1
> 
> Naturally, I want my internal machines on the 192.168.4.1/24 network
> to be able to use the FreeBSD box as their NAT gateway. This is a
> 3.0-RELEASE box, with IPDIVERT, IPFIREWALL kernel options. GATEWAY=YES
> 
> Using a very simple ruleset like:
> 
> 	/sbin/ipfw add divert natd all from any to any via ed1
> 	/sbin/ipfw add 100 pass all from any to any via lo0
> 	/sbin/ipfw add 200 deny all from any to 127.0.0.0/8
> 	/sbin/ipfw add 65000 pass all from any to any
> 
> Accompanied by "natd -n ed1" works nicely, and the NAT functions.
> The actual NAT box can get to both networks fine, and the internal
> machines also get access as expected. Naturally, I'd like to give
> a little more protection to the "router" box, but as soon as I try
> to do anything without the "add 65000 pass all from any to any" rule
> NAT just doesn't seem to want to go. Obviously, I'm doing something wrong
> and missing some key fundamental here, but no matter how many ways I
> play with the rules it beats me everytime. Using the ruleset below, which
> makes sense at least in my mind, I can get to the point where the router
> is open on the inside, and from the actual router I can make connections
> to the outsid world just fine, and incoming connections are rejected.
> In short everything is just how I'd like and expect it to be,
> with the one notable exception that packets simply aren't getting
> through the NAT part so my internal machines can't get to the internet.
> the "65534 deny all from any to any" ruleset is killing the packets..
> 
> I'm stumped. What do I need to get this thing running correctly?  :-)
> 
> TIA to anyone that can lift my ignorance..  
> 
> -Mark
> 
> #---------------------------------------------------------------------
> # Firewall by Mark...
> # summary: allow all traffic on the inside net, block nearly all
> # incoming traffic on the outside interface (internet), do NAT for
> # internal machine to access internet
> #
> # inside interface: de0
> # outside interfance: ed1
> 
> # outside and inside IPs
> oip="24.112.137.146"
> iip="192.168.4.1"
> 
> /sbin/ipfw -f flush
> 
> # Allow NAT to examine packets first
> /sbin/ipfw add divert natd all from any to any via ed1
> 
> # Setup loopback interface + interior interface
> /sbin/ipfw add 100 pass all from any to any via lo0
> /sbin/ipfw add 200 deny all from any to 127.0.0.0/8
> 
> # Stop RFC1918 nets on the outside interface
> /sbin/ipfw add deny all from 192.168.0.0:255.255.0.0 to any via ed1
> /sbin/ipfw add deny all from any to 192.168.0.0:255.255.0.0 via ed1
> /sbin/ipfw add deny all from 172.16.0.0:255.240.0.0 to any via ed1
> /sbin/ipfw add deny all from any to 172.16.0.0:255.240.0.0 via ed1
> /sbin/ipfw add deny all from 10.0.0.0:255.0.0.0 to any via ed1
> /sbin/ipfw add deny all from any to 10.0.0.0:255.0.0.0 via ed1
> 
> # Allow all traffic to pass - i.e. open the door!
> #/sbin/ipfw add 65000 pass all from any to any
> 
> # Allow established connections through (i.e. setup from the inside)
> # TCP goes through if setup succeeded
> /sbin/ipfw add pass all from any to any out xmit ed1
> /sbin/ipfw add pass tcp from any to any established
> 
> # Allow traffic on my own net
> /sbin/ipfw add pass all from 192.168.4.0/24 to ${iip}
> /sbin/ipfw add pass all from ${iip} to 192.168.4.0/24
> 
> # Allow access to my SSH port for remote access
> /sbin/ipfw add pass tcp from any to ${oip} 22 setup
> 
> # Reset connections on the ident ports to prevent timeouts
> /sbin/ipfw add reset tcp from any to ${oip} 113
> 
> # Reject & Log all setup of incoming connections from the outside
> #/sbin/ipfw add deny log tcp from any to any in via ed1 setup
> #/sbin/ipfw add deny log tcp from any to any in recv ed1 setup
> /sbin/ipfw add deny log tcp from any to ${oip} setup
> 
> # Allow DNS queries out into the world
> /sbin/ipfw add pass udp from any 53 to ${oip}
> /sbin/ipfw add pass udp from ${oip} to any 53
> 
> 
> # Everything else is denied by default
> 
> 
> -- 
> ------------------------------------------------------------------------
>  Mark Mayo		  				mark@vmunix.com       
>  RingZero Comp.  	  		    http://www.vmunix.com/mark 
> ------------------------------------------------------------------------
>  "The Church says the earth is flat. But I know it's round, for I have
>   seen the shadow on the moon. And I have more faith in a shadow than
>   in the Church."  - Ferdinand Magellan
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 


--0-1238522451-913130168=:11752
Content-Type: APPLICATION/octet-stream; name="natdconf.tar"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.BSF.3.96.981208081608.11752A@dax.belen.k12.nm.us>
Content-Description: 

H4sIAKtAbTYAA+08a3PbRpL5Kv6KCa2KrZQIEnxIsq70QbblWtXZkkpy1sld
XTFDYECOBWJgDECK8fq/X/c88CJIyus4e1tnpByTmOnH9PT0a5pOPCfgCVvS
MPzhWz1ur3c0HJIfCHGPR73y3/i4o/5gSMjR0WDQHxwf947g1cAdH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C8iHzJ0gMApKhTJkohwLDIFIFAwvUldnOqlrXqfapzdKQ51ZUTv
gaGUJt2ra5WiSDj4ujJo69r4G6uIxHSq26LMNcOz0YH+ldeC8lAZIvOLY5mj
wUj8rN312aLrZZT2VElC2yF176GmmfzEtuKg9VXv7Y/JDnJ0ZXN0HqniN69n
9nrqn2VQ3pbLIkBvzsFdp3iqFtvNy1cbFC8RUdVlljIjlkBOC373g5jkFjhs
jqT17+YjAEpUalCZ3xhthGuBs4QUBzu5N/Fjx9cLQBYwr5T4pPPRnaMe4Gdw
+XECSrNCBYP8QGB9ClvOQGMK36mrlOpSBy9TEipnOAe/VPn0Zsy7H+O1GJVW
e1/iO6LflaoYnofZNihrfU3v8DDBGsCbqUbxYmapxDTxZL8W7l3iO/Ls7uX1
AUQ+ma5Wq3+IhKnIz96NFNcsPMoeakje4LvHgScgsDFPPsrCwac8yf91EhGv
4FxhtsSmp6Q9Iq7bJhb2zzgaukqu7oVqlzICbE2CpQiqW1ewnZpgkoxtMeTr
j4Zqu+4E1X8hRzOS91Q7DaPqn5T4V982f3++P9+f78/35//K87+MtjnSAFAA
AA==
--0-1238522451-913130168=:11752--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.981208080110.10172A-101000>