MT > SQUID = Howto get User's ip in squid access.log ???

Hello, I need an suggestion. Current network scenario is

USER >> MiKROTiK >> SQUID >> INTERNET

USERS IP’s = 10.10.0.0/8

MT LAN = 10.10.0.1 [Connected to Users Switch]
MT WAN = 192.168.0.1 / GW 192.168.0.2 [Connected to SQUID LAN]

SQUID LAN = 192.168.0.2 [Conencted to MT LAN]
SQUID WAN = 192.168.1.1 [DSL]

squid is acting as a GW for MT. all data from MT goes to squid.

in this scenario , Is there any way , I can get users ip’s in squid access log?

Don’t NAT out that interface by making your source NAT rule more specific by adding out-interface=WANinterfaceName.

So , in Default src-nat rule properties / out-interface, i should select WAN ethernet ??? then will squid see my client ip instead of MT ? will all other traffic work properly?

I am bit confused here, can you be more specific please about the steps ???

Thx in advance :slight_smile:

If the router is applying source NAT to packets leaving it towards the Squid server it is doing so because you are telling it to. The most likely cause is that you aren’t explicitly telling it to, but have a very generic source NAT rule, such as “chain=srcnat action=masquerade”. That rule tells the router to source NAT every packet that leave the router, and to set the source IP address of the packet to the IP of the router on the interface the packet is leaving through. If you add a qualifier to that NAT rule and tell the router to only apply source NAT to packets leaving through the WAN interface the Squid proxy will see the client IP and not the router IP (and will also have to do less work as it doesn’t need to NAT all those packets that do not need NAT).

You may want to read the wiki manual page on NAT. This really should be a FAQ.