Ik heb de volgende IPtables regels:
Table:
Table NAT:
Table MANGLE:
Een redelijk berg, wellicht niet op z'n handigst in elkaar geschroefd.
Het probleem waar ik mee zit is dat de regels in NAT table bij PREROUTING niet werken. Vanaf VLAN10 zouden alle request naar een squid proxy moeten gaan. Maar de regel word in z'n geheel niet bereikt. Als ik bij table MANGLE, chain VLAN10 de DROP weggooi, gaan de packets wel naar de POSTROUTING regels.
Dit vind ik dus raar, ik verwacht eigenlijk dat de PREROUTING regel eerder dan POSTROUTING regel zou moeten komen.
Ik staar me nu al even blind op deze regels, maar ik kan niet bedenken waar het fout gaat.
Table:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| Chain INPUT (policy ACCEPT 73M packets, 34G bytes)
pkts bytes target prot opt in out source destination
256K 234M ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
3162K 312M ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
13 688 ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
1060 51090 ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143
0 0 ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993
0 0 ACCEPT all -- ppp0 * x.x.x.201 0.0.0.0/0
63 3780 ACCEPT all -- ppp0 * x.x.x.202 0.0.0.0/0
15990 4521K ACCEPT all -- ppp0 * x.x.x.203 0.0.0.0/0
0 0 ACCEPT all -- ppp0 * x.x.x.204 0.0.0.0/0
0 0 ACCEPT all -- ppp0 * x.x.x.122 0.0.0.0/0
0 0 ACCEPT all -- ppp0 * x.x.x.71 0.0.0.0/0
0 0 ACCEPT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723
20 1520 ACCEPT udp -- ppp0 * 194.109.22.18 0.0.0.0/0 udp spt:123
4961 276K ACCEPT icmp -- ppp0 * 0.0.0.0/0 0.0.0.0/0
276K 44M ACCEPT udp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 udp spt:53
3841 1584K DROP all -- ppp0 * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 14M packets, 9479M bytes)
pkts bytes target prot opt in out source destination
19882 29M ACCEPT tcp -- * * 0.0.0.0/0 82.94.249.x tcp dpt:25
15499 824K ACCEPT tcp -- * * 82.94.249.x 0.0.0.0/0 tcp spt:25
342 360K ACCEPT tcp -- * * 0.0.0.0/0 82.94.249.x tcp dpt:25
241 12115 ACCEPT tcp -- * * 82.94.249.x 0.0.0.0/0 tcp spt:25
0 0 ACCEPT tcp -- * * 0.0.0.0/0 194.109.6.51 tcp dpt:25
0 0 ACCEPT tcp -- * * 194.109.6.51 0.0.0.0/0 tcp spt:25
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
Chain OUTPUT (policy ACCEPT 91M packets, 61G bytes)
pkts bytes target prot opt in out source destination
197K 278M ACCEPT tcp -- * ppp0 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
0 0 ACCEPT all -- * ppp0 0.0.0.0/0 x.x.x.71
232 17632 ACCEPT udp -- * ppp0 0.0.0.0/0 194.109.22.18 udp dpt:123 |
Table NAT:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| Chain PREROUTING (policy ACCEPT 421K packets, 37M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- br0.10 * 0.0.0.0/0 10.0.0.0/8
0 0 DROP all -- br0.10 * 0.0.0.0/0 192.168.0.0/16
0 0 DNAT tcp -- br0.10 * 0.0.0.0/0 0.0.0.0/0 to:10.0.100.1:3128
0 0 DNAT tcp -- br0.7 * 0.0.0.0/0 0.0.0.0/0 to:10.0.70.1:3128
Chain POSTROUTING (policy ACCEPT 33 packets, 3168 bytes)
pkts bytes target prot opt in out source destination
241K 18M ACCEPT all -- * * 0.0.0.0/0 10.0.0.0/8
662K 45M ACCEPT all -- * * 0.0.0.0/0 192.168.1.0/24
202K 16M MASQUERADE all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 2188K packets, 154M bytes)
pkts bytes target prot opt in out source destination |
Table MANGLE:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
| Chain PREROUTING (policy ACCEPT 95M packets, 44G bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 81M packets, 35G bytes)
pkts bytes target prot opt in out source destination
1289 156K ACCEPT all -- br0.10 * 0.0.0.0/0 x.x.x.128
25 3450 DROP all -- br0.10 * 0.0.0.0/0 !10.0.100.0/24
Chain FORWARD (policy ACCEPT 11M packets, 8970M bytes)
pkts bytes target prot opt in out source destination
1613K 315M VLAN1 all -- br0 * 0.0.0.0/0 0.0.0.0/0
830K 81M VLAN2 all -- br0.2 * 0.0.0.0/0 0.0.0.0/0
0 0 VLAN3 all -- br0.3 * 0.0.0.0/0 0.0.0.0/0
0 0 VLAN4 all -- br0.4 * 0.0.0.0/0 0.0.0.0/0
0 0 VLAN5 all -- br0.5 * 0.0.0.0/0 0.0.0.0/0
1300K 99M VLAN6 all -- br0.6 * 0.0.0.0/0 0.0.0.0/0
3552 1207K VLAN7 all -- br0.7 * 0.0.0.0/0 0.0.0.0/0
49 2319 VLAN10 all -- br0.10 * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 91M packets, 62G bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 105M packets, 71G bytes)
pkts bytes target prot opt in out source destination
218K 309M MARK tcp -- * ppp0 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 MARK set 0x2
Chain VLAN1 (1 references)
pkts bytes target prot opt in out source destination
720K 172M ACCEPT all -- * br0.6 192.168.1.183 0.0.0.0/0
31269 9809K ACCEPT all -- * br0.6 192.168.1.188 0.0.0.0/0
1353 147K ACCEPT all -- * br0.2 192.168.1.201 0.0.0.0/0
27779 1862K ACCEPT all -- * br0.2 192.168.1.40 0.0.0.0/0
0 0 ACCEPT all -- * br0.2 192.168.1.20 0.0.0.0/0
0 0 ACCEPT all -- * br0.2 192.168.1.11 0.0.0.0/0
0 0 ACCEPT all -- * br0.2 192.168.1.9 0.0.0.0/0
83 6560 ACCEPT all -- * br0.2 192.168.1.200 0.0.0.0/0
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
965 88124 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
2052 223K DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN10 (1 references)
pkts bytes target prot opt in out source destination
37 1824 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Chain VLAN2 (1 references)
pkts bytes target prot opt in out source destination
1354 143K ACCEPT all -- * br0 0.0.0.0/0 192.168.1.201
29144 23M ACCEPT all -- * br0 0.0.0.0/0 192.168.1.40
6004 807K ACCEPT all -- * br0 0.0.0.0/0 192.168.1.20
632 66608 ACCEPT all -- * br0 0.0.0.0/0 192.168.1.11
0 0 ACCEPT all -- * br0 0.0.0.0/0 192.168.1.9
66 6635 ACCEPT all -- * br0 0.0.0.0/0 192.168.1.200
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN3 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.2 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN4 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.2 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN5 (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.2 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN6 (1 references)
pkts bytes target prot opt in out source destination
1297K 99M ACCEPT all -- * * 10.0.60.117 0.0.0.0/0
0 0 DROP all -- * br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.2 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.7 0.0.0.0/0 0.0.0.0/0
Chain VLAN7 (1 references)
pkts bytes target prot opt in out source destination
24 1248 DROP all -- * br0 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.2 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.3 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.4 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.5 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * br0.6 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * !ppp0 0.0.0.0/0 0.0.0.0/0 |
Een redelijk berg, wellicht niet op z'n handigst in elkaar geschroefd.
Het probleem waar ik mee zit is dat de regels in NAT table bij PREROUTING niet werken. Vanaf VLAN10 zouden alle request naar een squid proxy moeten gaan. Maar de regel word in z'n geheel niet bereikt. Als ik bij table MANGLE, chain VLAN10 de DROP weggooi, gaan de packets wel naar de POSTROUTING regels.
Dit vind ik dus raar, ik verwacht eigenlijk dat de PREROUTING regel eerder dan POSTROUTING regel zou moeten komen.
Ik staar me nu al even blind op deze regels, maar ik kan niet bedenken waar het fout gaat.
Solar @ Dongen: http://solar.searchy.net/ - Penpal International: http://ppi.searchy.net/