多VLAN下SQUID做透明閘道器

2021-09-20 19:19:26 字數 2310 閱讀 7159

網路連線圖

cisco3750 ---> panabit ---> squid ---> internet

3750上有,vlan多個, 其中1號口做路由,ip,192.168.10.2

squid 有兩個網絡卡 eth1 lan 192.168.10.1  eth2 wan 1.2.3.4

panabit和squid都位於esxi中.網路配置為

其中panabit的wan和firewall(squid)的lan在乙個虛擬交換機中(設定了vlan,vlan id 100)

firewall和panabit所在的網路要把混雜, 偽傳輸,mac位址更改,都改為接受.

squid基於centos6.4,

路由設定:

route add -net 192.168.1.0/24 gw 192.168.10.2 

route add -net 192.168.2.0/24 gw 192.168.10.2

route add -net 192.168.3.0/24 gw 192.168.10.2

route add -net 192.168.4.0/24 gw 192.168.10.2

route add -net 192.168.5.0/24 gw 192.168.10.2

route add -net 192.168.6.0/24 gw 192.168.10.2

route add -net 0.0.0.0/0 gw 1.2.3.4

iptables設定:

#!/bin/sh 

#eth1 lan eth2 wan

iptables=/sbin/iptables

int_net=192.168.0.0/16

$iptables -f

$iptables -x

$iptables -z

$iptables -f -t nat

$iptables -x -t nat

$iptables -z -t nat

$iptables -p input drop

$iptables -p output accept

$iptables -p forward accept

$iptables -a input -i lo -j accept

#input chain

$iptables -a input -i eth1 -p tcp -s $int_net -j accept

$iptables -a input -p icmp --icmp-type echo-request -j accept

$iptables -a input -m state --state established,related -j accept

#$iptables -a input -i ! lo -j log --log-prefix "drop" --log-ip-options --log-tcp-options

$iptables -a input -i eth2 -p udp --sport 53 -j accept

#nat

$iptables -t nat -a prerouting -p tcp --dport 22 -i eth2 -j dnat --to 192.168.1.24:22

$iptables -t nat -a prerouting -p tcp --dport 25 -i eth2 -j dnat --to 192.168.2.24:25

$iptables -t nat -a prerouting -p tcp --dport 110 -i eth2 -j dnat --to 192.168.2.24:110

#(adsl)

#$iptables -t nat -a postrouting -s $int_net -o eth2 -j masquerade  

#static ip

$iptables -t nat -a postrouting -s $int_net -j snat --to 1.2.3.4

#squid unauth

$iptables -t nat -a prerouting -i eth1 -p tcp -s $int_net --dport 80 -j redirect --to-port 3128

centos 新增靜態路由

建立 /etc/sysconfig/static-routes 檔案

vi 這個檔案

any net 192.168.6.0/24 gw 192.168.10.2

多VLAN間通訊

一 背景介紹 交換是疏通領域另乙個知識塊,與路由一樣有著舉足輕重的地方,本片就通過不同vlan間通訊的三個實現方式來講解交換的通訊過程。二 不同vlan間通訊實現方法 1.使用二層裝置實現 如下圖所示,兩個交換機之間使用埠繫結的方式以trunk連線,下聯2台同網段的pc,但不屬於同乙個vlan,大部...

ubuntu 下的squid安裝日誌

ubuntu 9.0.4 1 安裝 遇到問題 checking for c compiler default output file name.configure error c compiler cannot create executables see config.log for more d...

ubuntu 下的squid安裝日誌

ubuntu 9.0.4 1 安裝 wget tar xzvf squid 3.0.stable20.tar.gz cd squid 3.0.stable20 configure prefix path to squid 遇到問題 checking for c compiler default ou...