MARK and ! question: one more question
Hello.
Yesterday you helped me with my question:
iptables -t mangle -N setmark
iptables -t mangle -A setmark -s 193.220.70.0/27 -j RETURN
iptables -t mangle -A setmark -s 193.108.240.0/22 -j RETURN
iptables -t mangle -A setmark -d ! 193.220.70.32/27 -j RETURN iptables -t mangle -A setmark -j MARK --set-mark 107 iptables -t mangle -A POSTROUTING -j setmark
It makes logic: NOT from src1 AND NOT from src2 AND dst=some_dst_addr THEN mark packet with 107
Can you help me to construct logic: (from src1 OR from src2) AND dst=some_dst_addr THEN mark packet with 108 Possible form: (from src1 OR from src2 OR from src3 OR ... and so on) AND dst=some_dst_addr THEN mark packet with 108
Can you give me an example with above networks? - i mean packets with (src=193.220.70.0/27 or with src=193.108.240.0/22) and dst=193.220.70.32/27 will be marked with 108.
Your help is very, very appreciated.
Thanks in advance.
Best regards,
Ruslan
Hi Ruslan,
Quoted 4 lines
Can you help me to construct logic: (from src1 OR from src2) AND dst=some_dst_addr THEN mark packet with 108
Possible form: (from src1 OR from src2 OR from src3 OR ... and so on) AND dst=some_dst_addr THEN mark packet with 108
That's easy:
iptables -
iptables -t mangle -N setmark
iptables -t mangle -A setmark -j MARK --set-mark 107 iptables -t mangle -A POSTROUTING -s src1 -d dst1 -j setmark iptables -t mangle -A POSTROUTING -s src2 -d dst1 -j setmark iptables -t mangle -A POSTROUTING -s src3 -d dst1 -j setmark
Quoted 3 lines
Can you give me an example with above networks? - i mean packets with (src=193.220.70.0/27 or with src=193.108.240.0/22) and dst=193.220.70.32/27 will be marked with 108.
Just substitute whatever addresses you want into the above.
Cheers, Chris.
Signature · 4 lines
___ __ _ / __// / ,__(_)_ | Chris Wilson -- UNIX Firewall Lead Developer | / (_ / ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk | \ _//_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |
Quoted 21 lines · Chris Wilson
Hi Ruslan,
Quoted 4 lines
Can you help me to construct logic: (from src1 OR from src2) AND dst=some_dst_addr THEN mark packet with 108 Possible form: (from src1 OR from src2 OR from src3 OR ... and so on) AND dst=some_dst_addr THEN mark packet with 108
That's easy:
iptables -
iptables -t mangle -N setmark
iptables -t mangle -A setmark -j MARK --set-mark 107 iptables -t mangle -A POSTROUTING -s src1 -d dst1 -j setmark iptables -t mangle -A POSTROUTING -s src2 -d dst1 -j setmark iptables -t mangle -A POSTROUTING -s src3 -d dst1 -j setmark
Quoted 10 lines
Quoted 4 lines
Can you give me an example with above networks? - i mean packets with (src=193.220.70.0/27 or with src=193.108.240.0/22) and dst=193.220.70.32/27 will be marked with 108.
Just substitute whatever addresses you want into the above.
Cheers, Chris.
Do below lines the same? :
iptables -t mangle -N setmark
iptables -t mangle -A setmark -s src1 -d dst1 -j MARK --set-mark 107 iptables -t mangle -A setmark -s src2 -d dst1 -j MARK --set-mark 107 iptables -t mangle -A setmark -s src3 -d dst1 -j MARK --set-mark 107 iptables -t mangle -A POSTROUTING -j setmark
Thanks in advance,
Ruslan