ipfw.8 revision 6275
1.Dd November 16, 1994
2.Dt IPFW 8
3.Os
4.Sh NAME
5ipfw - controlling utility for ipfw/ipacct facilities. 
6
7.Sh SYNOPSIS
8
9 ipfw [-n]   <entry-action>  <chain entry pattern>
10 ipfw [-ans] <chain-action>  <chain[s] type>
11
12.Sh DESCRIPTION
13 In the first synopsis form, the ipfw utility allows control of firewall
14and accounting chains.
15 In the second synopsis form, the ipfw utility allows setting of global
16firewall/accounting properties and listing of chain contents.
17
18The following options are available:
19
20-a   While listing,show counter values-this option is the only way to
21     see accounting records.Works only with -s.
22
23-n   Do not resolve anything.  When setting entries, do not try to resolve
24     a given address.   When listing, display addresses in numeric form.
25
26-s   Short listing form.By default listing format is compatible with ipfw
27     input string format,so you can save listings to file and then reuse
28     them. With this option list format is much more short but 
29     incompatible with ipfw syntacs.
30
31These are <entry-actions>:
32	
33  addf[irewall] - add entry to firewall chain.
34  delf[irewall] - remove entry from firewall chain.
35  adda[ccounting] - add entry to accounting chain.
36  dela[ccounting] - remove entry from accounting chain.
37  clr[accounting] - clear counters for accounting chain entry.
38
39These are <chain-actions>:
40  f[lush] - remove all entries in firewall/accounting chains.
41  l[ist] - show all entries in firewall/accounting chains.
42  z[ero] - clear chain counters(accounting only).
43  p[olicy] - set default policy properties.
44
45This is <chain-entry pattern> structure:
46 For forwarding/blocking chains:
47  vr[eject] <proto/addr pattern>    reject packet,send ICMP unreachable and log.
48  r[eject]  <proto/addr pattern>    reject packet,send ICMP unreachable.
49  vd[eny]   <proto/addr pattern>    reject packet,log it.
50  d[eny]    <proto/addr pattern>    reject packet.
51  l[og]     <proto/addr pattern>    allow packet,log it.
52  va[ccept] <proto/addr pattern>    allow packet,log it.
53  a[ccept]  <proto/addr pattern>    allow packet.
54 For accounting chain:
55  s[ingle]        <proto/addr pattern>   log packets matching entry.
56  b[idirectional] <proto/addr pattern>   log packets matching entry and 
57                  those going in opposite direction (from entry
58                  "dst" to "src").
59                                           
60The <proto/addr pattern> is:
61  all|icmp        from  <src addr/mask>         to <dst addr/mask>
62  tcp|tcpsyn|udp  from  <src addr/mask> [ports] to <dst addr/mask> [ports]
63all matches any IP packet.
64icmp,tcp and udp - packets for corresponding protocols.
65tcpsyn - tcp SYN packets (which used when initiating connection).
66    
67The <src addr/mask>:
68 <INET IP addr | domain name> [/mask bits | :mask pattern]
69  Mask bits is a decimal number of bits set in the address  mask.
70  Mask pattern has form of IP address and AND'ed logically with address given.
71 [ports]: [ port,port....|port:port] 
72  Name of service can be used instead of port numeric value.
73   
74To l[ist] command may be passed:
75 f[irewall] | a[ccounting] to list specific chain or none to list
76all of chains.Long output format compatible with utility input syntacs.
77
78To f[lush] command may be passed:
79 f[irewall] | a[ccounting] to remove all entries from firewall or
80from accounting chain.Without arguments removes all chain entries.
81 
82To z[ero] command no arguments needed,this command clears counters for
83whole accounting chain.
84
85The p[olicy] command can be given a[ccept]|d[eny] to set  default policy
86as denial/accepting.Without arguments current default policy displayed.
87
88.Sh EXAMPLES
89
90 This command add entry which denies all tcp packets from
91hacker.evil.org to telnet port of wolf.tambov.su from being
92forwarded by the host:
93  ipfw addf deny tcp from hacker.evil.org to wolf.tambov.su telnet
94 
95 This one disallows any connection from entire hackers network
96to my host:
97  ipfw addf deny all from 123.45.67.8/24 to my.host.org
98
99 Here is good usage of list command to see accounting records:
100  ipfw -sa list accounting (or in short form ipfw -sa l a ).
101 
102 Much more examples can be found in files:
103  /usr/share/FAQ/ipfw.FAQ (missing for the moment)
104
105.Sh SEE ALSO
106ip(4),ipfirewall(4),ipaccounting(4),reboot(8)
107
108.Sh BUGS
109 WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!WARNING!!
110 This programm can put your computer in rather unusable state.
111First time try using it from console and do *NOT* do anything
112you don't understand.
113 Remember that "ipfw flush" can solve all the problemms.
114Also take in your mind that "ipfw policy deny" combined with
115some wrong chain entry(possible the only entry which designed
116to deny some external packets), can close your computer from
117outer world for good.
118
119.Sh HISTORY
120 Initially this utility was written for BSDI by:
121  Daniel Boulet    <danny@BouletFermat.ab.ca> 
122 The FreeBSD version is written completely by: 
123  Ugen J.S.Antsilevich <ugen@NetVision.net.il> 
124 while synopsis partially compatible with old one.
125