Share Squid3 transparent with storeid.php Debian Wheezy
Install Program
Langsung copas aja...
download file squid konfigurasinya
disini
extrack dan upload menggunakan winscp
Kopas
echo "shm /dev/shm tmpfs nodev,nosuid,noexec 0 0" >> /etc/fstab
mkdir -p /var/spool/squid3/1
mkdir -p /var/spool/squid3/2
/usr/local/squid3/lib/ssl_crtd -c -s /etc/squid3/ssl_db
chmod +x /etc/init.d/squid3
chmod -R 777 /etc/squid3
chown -R proxy:proxy /etc/squid3
chmod -R 777 /var/log/squid3
chown -R proxy:proxy /var/log/squid3
chmod -R 777 /var/spool/squid3
chown -R proxy:proxy /var/spool/squid3
squid -z
service squid3 start
optimalisasi disk cache
ingat hanya untuk disk cache....
/etc/fstab
gunakan opsi "
noatime,compress,noacl 0 0" Untuk btrfs
gunakan opsi "
noatime,notail 0 0" Untuk reiserfs
untuk Bridge transparent proxy copas Script ini di /etc/rc.local
#!/bin/sh -e
# Activate Module
modprobe xt_TPROXY
modprobe xt_socket
modprobe nf_tproxy_core
modprobe xt_mark
modprobe nf_nat
modprobe nf_conntrack_ipv4
modprobe nf_conntrack
modprobe nf_defrag_ipv4
modprobe ipt_REDIRECT
modprobe iptable_nat
#Make Bridge interface
brctl addbr br0
#Set eth0 and eth1 to promiscuous mode to listen and receive all frame
ifconfig eth0 0.0.0.0 promisc up
ifconfig eth1 0.0.0.0 promisc up
#Add eth0 and eth1 in br0
brctl addif br0 eth0
brctl addif br0 eth1
#Bring interface br0 up
ip link set br0 up
cd /proc/sys/net/bridge/ ; { for i in *; do echo 0 > $i; done; unset i; }
cd /root
# Assign IP to br0 to easy remote to server
ip addr add 192.168.255.2/29 brd + dev br0
# Add route to br0
route add default gw 192.168.255.1 dev br0
#Flush all rule from mangle iptables and broute ebtables
iptables -t mangle -F
ebtables -t broute -F
#Add iptables
iptables -t mangle -N DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -A INPUT -j ACCEPT
iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
#Change ip as your proxy ip and your client segment
iptables -t mangle -A PREROUTING -d 192.168.255.2/32 -p tcp --dport 80 -j ACCEPT
iptables -t mangle -A PREROUTING -d 192.168.255.2/32 -p tcp --dport 3128 -j ACCEPT
# Redirec All traffic http to 3129
iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
# Redirec Warnet traffic https to 3127
iptables -t mangle -A PREROUTING -s 192.168.2.0/24 -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127
#Add ebtables, Becareful about INTERFACE
#Interface to Internet
ebtables -t broute -A BROUTING -i eth0 -p ipv4 --ip-proto tcp --ip-sport 80 -j redirect --redirect-target ACCEPT
ebtables -t broute -A BROUTING -i eth0 -p ipv4 --ip-proto tcp --ip-sport 443 -j redirect --redirect-target ACCEPT
#Interface to Local Area Network
ebtables -t broute -A BROUTING -i eth1 -p ipv4 --ip-proto tcp --ip-dport 80 -j redirect --redirect-target ACCEPT
ebtables -t broute -A BROUTING -i eth1 -p ipv4 --ip-proto tcp --ip-dport 443 -j redirect --redirect-target ACCEPT
/sbin/ip rule add fwmark 1 lookup 100
/sbin/ip route add local 0.0.0.0/0 dev lo table 100
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
# Route Via Distribusi - Change ip as your client segment
#/sbin/route add -net 192.168.111.0/24 gw 192.168.255.3
#/sbin/route add -net 192.168.2.0/24 gw 192.168.255.3
service squid3 start
exit 0