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.
5 This target is to be used inside the mangle table, in the PREROUTING,
6 POSTROUTING or FORWARD hooks.
8 .BI "--addr " "src/dst"
9 Use source or destination IP address.
11 .BI "--and-mask " "mask"
12 Perform bitwise `and' on the IP address and this mask.
14 .BI "--or-mask " "mask"
15 Perform bitwise `or' on the IP address and this mask.
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
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.
27 We have one classifier rule:
29 tc filter add dev eth3 parent 1:0 protocol ip fw
31 Earlier we had many rules just like below:
33 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.2 -j MARK
36 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.3 -j MARK
39 Using IPMARK target we can replace all the mangle/mark rules with only one:
41 iptables -t mangle -A POSTROUTING -o eth3 -j IPMARK --addr=dst
42 --and-mask=0xffff --or-mask=0x10000
44 On the routers with hundreds of users there should be significant load
45 decrease (e.g. twice).