Forward proxy settings

squid carried forward proxy

Background

  There are two servers A (Intranet IP: 10.8.200.100) and B (network IP: 10.8.200.200), between A and B in the LAN can access each other. A can not access the external network, B can access the Internet. Now we need to B as a proxy server, A to access external network resources via a proxy server B.

Steps

  • A proxy server configuration
  • B Server Agent Configuration
    • Installation squid
    • Configuration squid
    • Enable squid

A proxy server configuration

Configuring global environment variables in /etc/profile.d folder:

vim /etc/profile.d/proxy.sh

#--------- 编辑proxy.sh 文件------------

# 填写代理服务器 B 的 IP 以及 squid 缺省端口 3128
export http_proxy=http://10.8.200.200:3128

# 设置https代理
export https_proxy=https://10.8.200.200:3128

# 如果需要设置不代理的IP或者网址,可以如下列出
export no_proxy="10.8.200.115, www.baidu.com, ..."

Enable profile

source /etc/pofile

Configuration server B program squid

Installation squid

apt-get install squid

Configuration squid

# 在 /ect/squid/ 文件夹下找到 squid.conf 
# 备份
cp suqid.conf squid.conf_bak

# 修改配置文件
# ip 配置
# 找到 http_access deny all 改为
http_access allow all

# 端口配置
# 缺省端口为 3128 , 如需更改需如下指定端口,此次不更改
http_port 1008

Enable squid

# 检查语法是否正确
squid -k parse 

# 前台启动 squid.conf
/usr/local/squid/sbin/squid -N -d1

# 后台启动
/usr/local/squid/sbin/squid -s

# 停止
/usr/local/squid/sbin/squid -k shutdown

reference

Squid command
How to set up a proxy server in the network

Guess you like

Origin www.cnblogs.com/yaolin1228/p/12288057.html