xref: /titanic_44/usr/src/cmd/ipf/examples/BASIC.NAT (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate#!/sbin/ipnat -f -
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# THIS EXAMPLE IS WRITTEN FOR IP FILTER 3.3
4*7c478bd9Sstevel@tonic-gate#
5*7c478bd9Sstevel@tonic-gate# ppp0 - (external) PPP connection to ISP, address a.b.c.d/32
6*7c478bd9Sstevel@tonic-gate#
7*7c478bd9Sstevel@tonic-gate# ed0 - (internal) network interface, address w.x.y.z/32
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# If we have only 1 valid IP address from our ISP, then we do this:
10*7c478bd9Sstevel@tonic-gate#
11*7c478bd9Sstevel@tonic-gate# To make ftp work, using the internal ftp proxy, use:
12*7c478bd9Sstevel@tonic-gate#
13*7c478bd9Sstevel@tonic-gatemap ppp0 w.x.y.z/24 -> a.b.c.d/32 proxy port ftp ftp/tcp
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate# For normal TCP/UDP and other IP protocols
16*7c478bd9Sstevel@tonic-gate#
17*7c478bd9Sstevel@tonic-gatemap ppp0 w.x.y.z/24 -> a.b.c.d/32 portmap tcp/udp 40000:60000
18*7c478bd9Sstevel@tonic-gatemap ppp0 w.x.y.z/24 -> a.b.c.d/32
19*7c478bd9Sstevel@tonic-gate#
20*7c478bd9Sstevel@tonic-gate# if we get a different dialup IP address each time, then we would use:
21*7c478bd9Sstevel@tonic-gate#
22*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.z/24 -> 0/32 portmap tcp/udp 40000:60000
23*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.z/24 -> 0/32
24*7c478bd9Sstevel@tonic-gate#
25*7c478bd9Sstevel@tonic-gate# If we have a class C address space of valid IP#'s from our ISP, then we can
26*7c478bd9Sstevel@tonic-gate# do this:
27*7c478bd9Sstevel@tonic-gate#
28*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.z/24 -> a.b.c.d/24 portmap tcp/udp 40000:60000
29*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.z/24 -> a.b.c.d/24
30*7c478bd9Sstevel@tonic-gate#
31*7c478bd9Sstevel@tonic-gate# or, if we only have a small number of PC's, this:
32*7c478bd9Sstevel@tonic-gate#
33*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.v/32 -> a.b.c.E/32 portmap tcp/udp 40000:60000
34*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.v/32 -> a.b.c.E/32
35*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.u/32 -> a.b.c.F/32 portmap tcp/udp 40000:60000
36*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.u/32 -> a.b.c.F/32
37*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.t/32 -> a.b.c.G/32 portmap tcp/udp 40000:60000
38*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.t/32 -> a.b.c.G/32
39*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.s/32 -> a.b.c.H/32 portmap tcp/udp 40000:60000
40*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.s/32 -> a.b.c.H/32
41*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.r/32 -> a.b.c.I/32 portmap tcp/udp 40000:60000
42*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.r/32 -> a.b.c.I/32
43*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.q/32 -> a.b.c.J/32 portmap tcp/udp 40000:60000
44*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.q/32 -> a.b.c.J/32
45*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.p/32 -> a.b.c.K/32 portmap tcp/udp 40000:60000
46*7c478bd9Sstevel@tonic-gate#map ppp0 w.x.y.p/32 -> a.b.c.K/32
47