LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-12-2018, 05:05 AM   #1
deltion
LQ Newbie
 
Registered: Nov 2018
Posts: 3

Rep: Reputation: Disabled
Exclamation Squid Transparant Proxy CentOS7


Good morning,

For a project I want to run a Squid (proxy server).
I use CentOS7.
This server becomes a transparent proxy server. So: incoming and outgoing port is port 80. This server therefore only has a cache (2000 Mb) function of many visited sites.
The internet traffic from the workstation must go via the proxy server.
How do I configure this?

I hope someone can help me further.

Sincerely,

Paul
 
Old 11-12-2018, 12:33 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by deltion View Post
Good morning,
For a project I want to run a Squid (proxy server). I use CentOS7. This server becomes a transparent proxy server. So: incoming and outgoing port is port 80. This server therefore only has a cache (2000 Mb) function of many visited sites. The internet traffic from the workstation must go via the proxy server. How do I configure this?
What have you done/tried so far?? There are MANY how-to guides on how to install and configure Squid on CentOS...which ones have you read and where are you stuck?? We're happy to help, but you need to read the "Question Guidelines" link in my posting signature; doing basic research should be done before posting. Putting "how to configure squid as transparent proxy" into Google pulls up what you need.

We can help with specific questions, but please don't ask us to look up guides for you.
 
Old 11-15-2018, 06:51 AM   #3
deltion
LQ Newbie
 
Registered: Nov 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
What's getting wrong, is somebody able to help me??

Regards,

Paul
Attached Thumbnails
Click image for larger version

Name:	foutmelding script iptables.png
Views:	11
Size:	43.5 KB
ID:	28972   Click image for larger version

Name:	foutmelding script uitvoer.png
Views:	5
Size:	53.7 KB
ID:	28973   Click image for larger version

Name:	foutmelding script.png
Views:	6
Size:	140.8 KB
ID:	28974  
 
Old 11-15-2018, 08:01 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by deltion View Post
What's getting wrong, is somebody able to help me??
Again:
  • What HAVE YOU DONE so far???
  • What guides/tutorials did you follow??
And don't post screen-shots, but put the text in CODE blocks, so people can actually read it. AGAIN, there are MANY tutorials you can find, and I even GAVE YOU a search term in my first reply, that pulls up an exact tutorial as the VERY FIRST HIT. And if you went on to search for how to configure the squid cache size, you could find that too.

We are happy to HELP you, but you have to actually provide details and information when asked.
 
Old 11-15-2018, 09:53 AM   #5
deltion
LQ Newbie
 
Registered: Nov 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hello,

The proxy server is working if we set it manually on our windows clients, but our project says it has to be transparent.
We are using Iptables as our firewall. Our linux server has 2 NIC's. One connected to the internet (ens33) and one connected to the LAN (10.3.10.2)
We need to portforward traffic comming in on the LAN NIC port 80 to 3128 (squid port)

We tried alot of iptable rules. A few you can see below:

# squid server IP
SQUID_SERVER="10.3.10.2"
# Interface connected to Internet
INTERNET="ens33"
# Interface connected to LAN
LAN_IN="ens37"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j accept
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i ens33 -m state --state ESTABLISHED,RELATED -j ACCEPT
# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface ens33 -j MASQUARDE
iptables --append FORWARD --in-interface ens37 -j ACCEPT
# unlimited access to LAN
iptables -A INPUT -i ens37 -j ACCEPT
iptables -A OUTPUT -o ens37 -j ACCEPT
# DNAT port 80 request comming from LAN systems to squid 3128 (3128) aka transparent proxy
iptables -t nat -A PREROUTING -i ens37 -p tcp --dport 80 -j DNAT --to 10.3.10.2:3128
# if it is same system
iptables -t nat -A PREROUTING -i ens33 -p tcp --dport 80 -j REDIRECT --to-port 3128
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP


Which give the following errors:

iptables: Bad policy name. Run `dmesg' for more information.
iptables: Bad policy name. Run `dmesg' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `MASQUARDE
 
Old 11-15-2018, 01:37 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,617

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
Quote:
Originally Posted by deltion View Post
Hello,
The proxy server is working if we set it manually on our windows clients, but our project says it has to be transparent. We are using Iptables as our firewall. Our linux server has 2 NIC's. One connected to the internet (ens33) and one connected to the LAN (10.3.10.2) We need to portforward traffic comming in on the LAN NIC port 80 to 3128 (squid port)
We tried alot of iptable rules.
A few you can see below:
Code:
# squid server IP
SQUID_SERVER="10.3.10.2"
# Interface connected to Internet
INTERNET="ens33"
# Interface connected to LAN
LAN_IN="ens37"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j accept
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i ens33 -m state --state ESTABLISHED,RELATED -j ACCEPT
# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface ens33 -j MASQUARDE
iptables --append FORWARD --in-interface ens37 -j ACCEPT
# unlimited access to LAN  
iptables -A INPUT -i ens37 -j ACCEPT
iptables -A OUTPUT -o ens37 -j ACCEPT
# DNAT port 80 request comming from LAN systems to squid 3128 (3128) aka transparent proxy
iptables -t nat -A PREROUTING -i ens37 -p tcp --dport 80 -j DNAT --to 10.3.10.2:3128
# if it is same system
iptables -t nat -A PREROUTING -i ens33 -p tcp --dport 80 -j REDIRECT --to-port 3128
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP
Which give the following errors:
Code:
iptables: Bad policy name. Run `dmesg' for more information.
iptables: Bad policy name. Run `dmesg' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `ACCEPT
'
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.21: Invalid target name `MASQUARDE
[/QUOTE]
Ok, so **AGAIN**:
  • Post things in CODE tags, so they can be read easily
  • Which tutorials did you follow????
  • Did you actually *DO* anything that the system told you?? Look at iptables -h? Run dmesg?
  • Did you, AGAIN, put the exact search-term in that I gave you already, and READ THE LINKS??? AGAIN, the first link has a complete set of iptables rules, along with other instructions.
  • Did you look at the Squid documentation???
 
  


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
Any problem if I install CENTOS7 Workstation over CENTOS7 Server? Rich Strebendt Linux - Software 5 05-03-2018 11:05 PM
[SOLVED] Transparant proxy with 2 nics and NAT hophop Linux - Networking 8 04-18-2012 05:56 AM
YAHOO VOICE with IPTABLES and Transparant Proxy derecks Linux - Networking 1 07-20-2006 08:34 AM
transparant taskbar JMK Linux - Newbie 1 01-18-2004 01:15 AM
transparant terminal LILLY4117 Linux - Newbie 5 09-02-2003 11:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:02 PM.

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