EXAMPLES
In the following example, the packets are injected into a nat node using the ng_ipfw (4) node.
# Create NAT node
ngctl mkpeer ipfw: nat 60 out
ngctl name ipfw:60 nat
ngctl connect ipfw: nat: 61 in
ngctl msg nat: setaliasaddr x.y.35.8
# Divert traffic into NAT node
ipfw add 300 netgraph 61 all from any to any in via fxp0
ipfw add 400 netgraph 60 all from any to any out via fxp0
# Let packets continue with after being (de)aliased
sysctl net.inet.ip.fw.one_pass=0
The ng_nat node can be inserted right after the ng_iface (4) node in the graph. In the following example, we perform masquerading on a serial line with HDLC encapsulation.
/usr/sbin/ngctl -f- <<-SEQ
mkpeer cp0: cisco rawdata downstream
name cp0:rawdata hdlc
mkpeer hdlc: nat inet in
name hdlc:inet nat
mkpeer nat: iface out inet
msg nat: setaliasaddr x.y.8.35
SEQ
ifconfig ng0 x.y.8.35 x.y.8.1
SEE ALSO
libalias (3), ng_ipfw (4), natd (8), ngctl (8)
HISTORY
AUTHORS