Specifications

Chapter 14 Configuring and Managing Network Services 239
NAT serveradmin Commands
To manage NAT service, use the following commands with the serveradmin tool.
Port Mapping
You can configure port mapping by adding a redirect_port directive to the
configuration file passed to the natd process. You can accomplish this by editing the
plist version of the configuration file /etc/nat/natd.plist. This file is then processed by
the serveradmin tool, and is used to create the configuration file /etc/nat/
natd.conf.apple, which is passed to the natd process. For details about configuring
natd, see the natd man page.
Note: Don’t edit the /etc/nat/natd.conf.apple file directly, because it is regenerated
every time the serveradmin start nat command is executed.
To configure NAT to use the port mapping rule redirect_port tcp 1.2.3.4:80 80,
add the following lines to /etc/nat/natd.plist, inside the configuration dictionary:
<key>redirect_port</key>
<array>
log yes|no
Default = yes
proxy_only yes|no
Default = no
dynamic yes|no
Default = yes
use_sockets yes|no
Default = yes
interface
The network port.
Default =
"en0"
unregistered_only yes|no
Default = no
same_ports yes|no
Default = yes
Parameter (nat:) Description
Command
(
nat:command=) Description
getLogPaths Find the location of the log used by the NAT service. See “Viewing
the NAT Service Log and Log Path” on this page.
updateNATRuleInIpfw Update the firewall rules defined in the ipfilter service to reflect
changes in NAT settings.
writeSettings Equivalent to the standard serveradmin settings command,
but also returns a setting indicating whether the service must be
restarted. See “Using the serveradmin Tool” on page 50.