4

I have an Access Point with OpenWrt. On other host of the same LAN there is a squid (IP Address 192.168.80.148). I'd like to route packages with destination port 80 to 192.168.80.148.

So I have

root@ap:/tmp# iptables -L -vn -t mangle
Chain PREROUTING (policy ACCEPT 67354 packets, 54M bytes)
 pkts bytes target     prot opt in     out     source               destination         
67358   54M fwmark     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain INPUT (policy ACCEPT 1548 packets, 127K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 65789 packets, 54M bytes)
 pkts bytes target     prot opt in     out     source               destination         
65789   54M mssfix     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 1017 packets, 133K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 66808 packets, 54M bytes)
 pkts bytes target     prot opt in     out     source               destination         
25686 1564K MARK       tcp  --  *      br-lan  0.0.0.0/0            0.0.0.0/0            PHYSDEV match ! --physdev-in eth0+ tcp dpt:80 MARK set 0x1

Chain fwmark (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain mssfix (1 references)
 pkts bytes target     prot opt in     out     source               destination         
root@ap:/tmp# ip rule ls
0:      from all lookup 128 
0:      from all fwmark 0x1 lookup squid1 
1:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 
root@ap:/tmp# ip route show table squid1
default via 192.168.80.148 dev br-lan 

So, But routing is not working, I see no packages going from my station to box with squid.

One important thing: Access Point is not the default gateway of station. All ports of the AP are in the same VLAN and so AP have an only IP address with is in the same LAN that internal internet ADSL modem. LAN IP address of ADSL modem is the default gateway.

What am I doing wrong?

EDITED:

I've added a testing rule:

iptables -t mangle -A OUTPUT -o br-lan -p tcp -m physdev ! --physdev-in eth0+ -m tcp --dport 80 -
j MARK --set-xmark 0x1/0xffffffff

And I've found that in that case routing works, (traffic from AP itself goes through squid box). So, the problem is that traffic from the station is not being routed. Why?

  • I gave it up... I've disabled dhcp on ADLS modem y re-enabled dnsmasq on OpenWrt pointing to squid box as default gateway. So I don't need routing policy. Still I don't understand why it doesn't work. But at least I've found an alternative approach. – sebelk Mar 28 '16 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.