LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-23-2013, 08:52 AM   #1
DarkAbraxas
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Rep: Reputation: Disabled
MikroTik and transparent Squid with 1 nic


Hi guys.
I need help with transparent Squid configuration on box that have one network card.
I managed to setup MikroTik to redirect all traffic on port 80 to Linux machine (Slackware 14.0) and Squid works fine when he is not transparent and when I manually setup proxy in browser. So the problem is in iptables configuration. I tried couple of things I found on the internet, but nothing helped me so far.

For the sake of easy explanation and understanding lets say this:
1. MikoTik is gateway for internet on address 192.168.1.1/24
2. Linux machine with Squid is on address 192.168.1.10/24
3. I have computers in the same subnet (192.168.1.0/24) and I have other computers in subnets 192.168.2.0/24 and 192.168.3.0/24.

I want all computers in those networks to be on transparent Squid.


As I said, I redirected traffic on port 80 to Squid, but when its transparent I get something like this:

Quote:
ERROR
The requested URL could not be retrieved

The following error was encountered while trying to retrieve the URL: http://www.some-address.com/

Connection to xxx.xxx.xxx.xxx failed.

The system returned: (110) Connection timed out

The remote host or network may be down. Please try the request again.

Your cache administrator is webmaster.


I hope someone can help...
 
Old 12-24-2013, 03:21 AM   #2
DarkAbraxas
LQ Newbie
 
Registered: Jun 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Here is simplified diagram of mentioned network:


http://www.linuxquestions.org/questions/attachment.php?attachmentid=14308&stc=1&d=1387876634
Attached Thumbnails
Click image for larger version

Name:	mikrotik squid network.jpg
Views:	413
Size:	63.9 KB
ID:	14308  
 
Old 06-14-2014, 09:02 PM   #3
picassofb
LQ Newbie
 
Registered: Jun 2014
Posts: 1

Rep: Reputation: Disabled
Hi, did u solved your problem? I want to do the same.
 
Old 06-16-2014, 04:16 PM   #4
kelbel.muller
LQ Newbie
 
Registered: Jun 2014
Distribution: Gentoo
Posts: 1

Rep: Reputation: 0
Hi.
Have you solved your problem?

If not, below are configs that works for me:
----------------------------
* NETWORK DESIGN *
LAN: 10.5.5.0/24, 10.6.6.0/24 and 10.7.7.0/24
WAN: 192.168.0.0/29
SQUID SUBNET: 10.9.9.0/30

* IP ADDRESSES *
Mirotik:
eth-LAN: 10.5.5.1/24, 10.6.6.1/24 and 10.7.7.1/24
eth-WAN: 192.168.0.2/29
eth-SQUID: 10.9.9.1/30

Squid Cache:
10.9.9.2/30
----------------------------
* MIKROTIK CONFIGURATION *
## ADDRESS LIST ##
Quote:
/ip firewall address-list add list=SQUID_CLIENTS address=10.5.5.0/24
/ip firewall address-list add list=SQUID_CLIENTS address=10.6.6.0/24
/ip firewall address-list add list=SQUID_CLIENTS address=10.7.7.0/24
/ip firewall address-list add list=SQUID_CLIENTS address=192.168.0.2
## MANGLE RULES ##
Quote:
/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=TO_SQUID passthrough=yes protocol=tcp src-address-list=!SQUID_CLIENTS dst-address-list=SQUID_CLIENTS in-interface=eth-WAN src-port=80 comment="## FROM LAN TO INTERNET"
/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=TO_SQUID passthrough=yes protocol=tcp src-address-list=SQUID_CLIENTS dst-address-list=!SQUID_CLIENTS in-interface=!eth-SQUID dst-port=80 comment="## FROM INTERNET TO LAN"
## ROUTE CONFIGURATION ##
Quote:
/ip route add dst-address=0.0.0.0/0 gateway=10.9.9.2 distance=1 scope=30 target-scope=30 routing-mark=TO_SQUID disabled=no comment="## ROUTE TO SQUID"
----------------------------

Please tell if it worked or not for you.

Last edited by kelbel.muller; 06-16-2014 at 04:18 PM.
 
Old 07-22-2015, 06:11 AM   #5
l1nkers
LQ Newbie
 
Registered: Jun 2015
Posts: 4

Rep: Reputation: Disabled
Same setup, bad results

Good day,

I have been using the exact same setup and I am getting the logs. But for some reason I am getting my ISP provider's ip adress for all websites visited from Mikrotik src-adress list. So there is no way to determine who is visiting what sites. How can I solve this?

L1nkers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto connect SQUID box with Mikrotik and Log user’s original source ip in squid PPTP fruiz002 Linux - Networking 1 08-23-2012 06:17 AM
Howto connect SQUID box with Mikrotik and Log user’s original source ip in squid PPTP fruiz002 Linux - Networking 1 08-01-2012 02:26 AM
Transparent Proxy (squid + Dansguardian) with one NIC azrim Linux - Server 4 04-28-2010 08:42 AM
Squid vs Mikrotik khodeir Debian 16 10-16-2009 07:32 AM
Squid Transparent win32sux Linux - Networking 2 08-05-2005 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration