Deleted Added
full compact
ng_nat.4 (145968) ng_nat.4 (147432)
1.\" Copyright (c) 2005 Gleb Smirnoff <glebius@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 2005 Gleb Smirnoff <glebius@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: head/share/man/man4/ng_nat.4 145968 2005-05-06 15:33:12Z glebius $
25.\" $FreeBSD: head/share/man/man4/ng_nat.4 147432 2005-06-16 18:46:17Z ru $
26.\"
27.Dd May 6, 2005
28.Dt NG_NAT 4
29.Os
30.Sh NAME
31.Nm ng_nat
26.\"
27.Dd May 6, 2005
28.Dt NG_NAT 4
29.Os
30.Sh NAME
31.Nm ng_nat
32.Nd NAT netgraph node type
32.Nd "NAT netgraph node type"
33.Sh SYNOPSIS
34.In netgraph/ng_nat.h
35.Sh DESCRIPTION
36An
37.Nm
38node performs network address translation (NAT) of packets
39passing through it.
33.Sh SYNOPSIS
34.In netgraph/ng_nat.h
35.Sh DESCRIPTION
36An
37.Nm
38node performs network address translation (NAT) of packets
39passing through it.
40An
41.Nm
40A
41.Nm nat
42node uses
43.Xr libalias 3
44engine for packet aliasing.
42node uses
43.Xr libalias 3
44engine for packet aliasing.
45At this moment it supports the basic functionality of the library.
45At this moment it supports only the basic functionality of the library.
46.Sh HOOKS
47This node type has two hooks:
46.Sh HOOKS
47This node type has two hooks:
48.Pp
49.Bl -tag -width foobar
50.It Dv out
51Packets received on this hook are considered outgoing and would be
52masqueraded to configured address.
53.It Dv in
54Packets coming on this hook are considered incoming and would be
48.Bl -tag -width indent
49.It Va out
50Packets received on this hook are considered outgoing and will be
51masqueraded to a configured address.
52.It Va in
53Packets coming on this hook are considered incoming and will be
55dealiased.
56.El
57.Sh CONTROL MESSAGES
58This node type supports the generic control messages, plus the following:
54dealiased.
55.El
56.Sh CONTROL MESSAGES
57This node type supports the generic control messages, plus the following:
59.Bl -tag -width foo
58.Bl -tag -width indent
60.It Dv NGM_NAT_SET_IPADDR Pq Li setaliasaddr
59.It Dv NGM_NAT_SET_IPADDR Pq Li setaliasaddr
61Configure aliasing address for node.
62After both hooks are connected and aliasing address configured,
63node is ready for aliasing operation.
60Configure aliasing address for a node.
61After both hooks have been connected and aliasing address was configured,
62a node is ready for aliasing operation.
64.El
65.Sh SHUTDOWN
66This node shuts down upon receipt of a
67.Dv NGM_SHUTDOWN
68control message, or when both hooks are disconnected.
69.Sh EXAMPLES
63.El
64.Sh SHUTDOWN
65This node shuts down upon receipt of a
66.Dv NGM_SHUTDOWN
67control message, or when both hooks are disconnected.
68.Sh EXAMPLES
70In the following example packets are injected into
71.Nm
72node with help of
69In the following example, the packets are injected into a
70.Nm nat
71node using the
73.Xr ng_ipfw 4
74node.
75.Bd -literal -offset indent
76# Create NAT node
77ngctl mkpeer ipfw: nat 60 out
78ngctl name ipfw:60 nat
79ngctl connect ipfw: nat: 61 in
80ngctl msg nat: setaliasaddr x.y.35.8
81
82# Divert traffic into NAT node
83ipfw add 300 netgraph 61 all from any to any in via fxp0
84ipfw add 400 netgraph 60 all from any to any out via fxp0
85
86# Let packets continue with after being (de)aliased
87sysctl net.inet.ip.fw.one_pass=0
88.Ed
89.Pp
72.Xr ng_ipfw 4
73node.
74.Bd -literal -offset indent
75# Create NAT node
76ngctl mkpeer ipfw: nat 60 out
77ngctl name ipfw:60 nat
78ngctl connect ipfw: nat: 61 in
79ngctl msg nat: setaliasaddr x.y.35.8
80
81# Divert traffic into NAT node
82ipfw add 300 netgraph 61 all from any to any in via fxp0
83ipfw add 400 netgraph 60 all from any to any out via fxp0
84
85# Let packets continue with after being (de)aliased
86sysctl net.inet.ip.fw.one_pass=0
87.Ed
88.Pp
89The
90.Nm
90.Nm
91node can simply be inserted right after
92.Xr ng_iface
93node.
94In the following example we perform masquerading on a
91node can be inserted right after the
92.Xr ng_iface 4
93node in the graph.
94In the following example, we perform masquerading on a
95serial line with HDLC encapsulation.
96.Bd -literal -offset indent
97/usr/sbin/ngctl -f- <<-SEQ
98 mkpeer cp0: cisco rawdata downstream
99 name cp0:rawdata hdlc
100 mkpeer hdlc: nat inet in
101 name hdlc:inet nat
102 mkpeer nat: iface out inet
103 msg nat: setaliasaddr x.y.8.35
104SEQ
105ifconfig ng0 x.y.8.35 x.y.8.1
106.Ed
107.Sh SEE ALSO
108.Xr libalias 3 ,
95serial line with HDLC encapsulation.
96.Bd -literal -offset indent
97/usr/sbin/ngctl -f- <<-SEQ
98 mkpeer cp0: cisco rawdata downstream
99 name cp0:rawdata hdlc
100 mkpeer hdlc: nat inet in
101 name hdlc:inet nat
102 mkpeer nat: iface out inet
103 msg nat: setaliasaddr x.y.8.35
104SEQ
105ifconfig ng0 x.y.8.35 x.y.8.1
106.Ed
107.Sh SEE ALSO
108.Xr libalias 3 ,
109.Xr natd 8 ,
110.Xr ng_ipfw 4 ,
109.Xr ng_ipfw 4 ,
110.Xr natd 8 ,
111.Xr ngctl 8
112.Sh HISTORY
113The
114.Nm
115node type was implemented in
116.Fx 6.0 .
117.Sh AUTHORS
118.An Gleb Smirnoff Aq glebius@FreeBSD.org
111.Xr ngctl 8
112.Sh HISTORY
113The
114.Nm
115node type was implemented in
116.Fx 6.0 .
117.Sh AUTHORS
118.An Gleb Smirnoff Aq glebius@FreeBSD.org