xref: /dflybsd-src/sbin/natd/samples/natd.cf.sample (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino#
286d7f5d3SJohn Marino# $FreeBSD: src/sbin/natd/samples/natd.cf.sample,v 1.5 1999/09/13 18:18:33 ru Exp $
386d7f5d3SJohn Marino# $DragonFly: src/sbin/natd/samples/natd.cf.sample,v 1.2 2003/06/17 04:27:34 dillon Exp $
486d7f5d3SJohn Marino#
586d7f5d3SJohn Marino#
686d7f5d3SJohn Marino# Configuration file for natd.
786d7f5d3SJohn Marino#
886d7f5d3SJohn Marino#
986d7f5d3SJohn Marino# Enable logging to file /var/log/alias.log
1086d7f5d3SJohn Marino#
1186d7f5d3SJohn Marinolog		no
1286d7f5d3SJohn Marino#
1386d7f5d3SJohn Marino# Incoming connections.  Should NEVER be set to "yes" if redirect_port
1486d7f5d3SJohn Marino# or redirect_address statements are activated in this file!
1586d7f5d3SJohn Marino#
1686d7f5d3SJohn Marino# Setting to yes provides additional anti-crack protection
1786d7f5d3SJohn Marino#
1886d7f5d3SJohn Marinodeny_incoming	no
1986d7f5d3SJohn Marino#
2086d7f5d3SJohn Marino# Use sockets to avoid port clashes.  Uses additional system resources, but
2186d7f5d3SJohn Marino# guarantees successful connections when port numbers conflict
2286d7f5d3SJohn Marino#
2386d7f5d3SJohn Marinouse_sockets	no
2486d7f5d3SJohn Marino#
2586d7f5d3SJohn Marino# Avoid port changes if possible when altering outbound packets. Makes rlogin
2686d7f5d3SJohn Marino# work in most cases.
2786d7f5d3SJohn Marino#
2886d7f5d3SJohn Marinosame_ports	yes
2986d7f5d3SJohn Marino#
3086d7f5d3SJohn Marino# Verbose mode. Enables dumping of packets and disables
3186d7f5d3SJohn Marino# forking to background.  Only set to yes for debugging.
3286d7f5d3SJohn Marino#
3386d7f5d3SJohn Marinoverbose		no
3486d7f5d3SJohn Marino#
3586d7f5d3SJohn Marino# Divert port. Can be a name in /etc/services or numeric value.
3686d7f5d3SJohn Marino#
3786d7f5d3SJohn Marinoport		32000
3886d7f5d3SJohn Marino#
3986d7f5d3SJohn Marino# Interface name or address being aliased. Either one,
4086d7f5d3SJohn Marino# not both is required.
4186d7f5d3SJohn Marino#
4286d7f5d3SJohn Marino# Obtain interface name from the command output of "ifconfig -a"
4386d7f5d3SJohn Marino#
4486d7f5d3SJohn Marino# alias_address	192.168.0.1
4586d7f5d3SJohn Marinointerface	ep0
4686d7f5d3SJohn Marino#
4786d7f5d3SJohn Marino# Alias unregistered addresses or all addresses.  Set this to yes if
4886d7f5d3SJohn Marino# the inside network is all RFC1918 addresses.
4986d7f5d3SJohn Marino#
5086d7f5d3SJohn Marinounregistered_only	no
5186d7f5d3SJohn Marino#
5286d7f5d3SJohn Marino# Configure permanent links. If you use host names instead
5386d7f5d3SJohn Marino# of addresses here, be sure that name server works BEFORE
5486d7f5d3SJohn Marino# natd is up - this is usually not the case. So either use
5586d7f5d3SJohn Marino# numeric addresses or hosts that are in /etc/hosts.
5686d7f5d3SJohn Marino#
5786d7f5d3SJohn Marino# Note:  Current versions of FreeBSD all call /etc/rc.firewall
5886d7f5d3SJohn Marino# BEFORE running named, so if the DNS server and NAT are on the same
5986d7f5d3SJohn Marino# machine, the nameserver won't be up if natd is called from /etc/rc.firewall
6086d7f5d3SJohn Marino#
6186d7f5d3SJohn Marino# Map connections coming to port 30000 to telnet in my_private_host.
6286d7f5d3SJohn Marino# Remember to allow the connection /etc/rc.firewall also.
6386d7f5d3SJohn Marino#
6486d7f5d3SJohn Marino#redirect_port		tcp my_private_host:telnet 30000
6586d7f5d3SJohn Marino#
6686d7f5d3SJohn Marino# Map connections coming from host.xyz.com to port 30001 to
6786d7f5d3SJohn Marino# telnet in another_host.
6886d7f5d3SJohn Marino#redirect_port		tcp another_host:telnet 30001 host.xyz.com
6986d7f5d3SJohn Marino#
7086d7f5d3SJohn Marino# Static NAT address mapping:
7186d7f5d3SJohn Marino#
7286d7f5d3SJohn Marino#  ipconfig must apply any legal IP numbers that inside hosts
7386d7f5d3SJohn Marino# will be known by to the outside interface.  These are sometimes known as
7486d7f5d3SJohn Marino# virtual IP numbers.  It's suggested to use the "interface" directive
7586d7f5d3SJohn Marino# instead of the "alias_address" directive to make it more clear what is
7686d7f5d3SJohn Marino# going on. (although both will work)
7786d7f5d3SJohn Marino#
7886d7f5d3SJohn Marino# DNS in this situation can get hairy.  For example, an inside host
7986d7f5d3SJohn Marino# named aweb.company.com is located at 192.168.1.56, and needs to be
8086d7f5d3SJohn Marino# accessible through a legal IP number like 198.105.232.1.  If both
8186d7f5d3SJohn Marino# 192.168.1.56 and 198.105.232.1 are set up as address records in the DNS
8286d7f5d3SJohn Marino# for aweb.company.com, then external hosts attempting to access
8386d7f5d3SJohn Marino# aweb.company.com may use address 192.168.1.56 which is inaccessible to them.
8486d7f5d3SJohn Marino#
8586d7f5d3SJohn Marino# The obvious solution is to use only a single address for the name, the
8686d7f5d3SJohn Marino# outside address.  However, this creates needless traffic through the
8786d7f5d3SJohn Marino# NAT, because inside hosts will go through the NAT to get to the legal
8886d7f5d3SJohn Marino# number, even when the inside number is on the same subnet as they are!
8986d7f5d3SJohn Marino#
9086d7f5d3SJohn Marino# It's probably not a good idea to use DNS names in redirect_address statements
9186d7f5d3SJohn Marino#
9286d7f5d3SJohn Marino#The following mapping points outside address 198.105.232.1 to 192.168.1.56
9386d7f5d3SJohn Marino#redirect_address  192.168.1.56		198.105.232.1
94