iptables-1.3.2-20050720
[iptables.git] / extensions / libipt_IPMARK.man
1 Allows you to mark a received packet basing on its IP address. This
2 can replace many mangle/mark entries with only one, if you use
3 firewall based classifier.
4
5 This target is to be used inside the mangle table, in the PREROUTING,
6 POSTROUTING or FORWARD hooks.
7 .TP
8 .BI "--addr " "src/dst"
9 Use source or destination IP address.
10 .TP
11 .BI "--and-mask " "mask"
12 Perform bitwise `and' on the IP address and this mask.
13 .TP
14 .BI "--or-mask " "mask"
15 Perform bitwise `or' on the IP address and this mask.
16 .P
17 The order of IP address bytes is reversed to meet "human order of bytes":
18 192.168.0.1 is 0xc0a80001. At first the `and' operation is performed, then
19 `or'.
20
21 Examples:
22
23 We create a queue for each user, the queue number is adequate
24 to the IP address of the user, e.g.: all packets going to/from 192.168.5.2
25 are directed to 1:0502 queue, 192.168.5.12 -> 1:050c etc.
26
27 We have one classifier rule:
28 .IP
29 tc filter add dev eth3 parent 1:0 protocol ip fw
30 .P
31 Earlier we had many rules just like below:
32 .IP
33 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.2 -j MARK
34 --set-mark 0x10502
35 .IP
36 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.3 -j MARK
37 --set-mark 0x10503
38 .P
39 Using IPMARK target we can replace all the mangle/mark rules with only one:
40 .IP
41 iptables -t mangle -A POSTROUTING -o eth3 -j IPMARK --addr=dst
42 --and-mask=0xffff --or-mask=0x10000
43 .P
44 On the routers with hundreds of users there should be significant load
45 decrease (e.g. twice).