redsock2 可以把一些不支持透明代理的代理服務(wù)器重定向一下,這樣可以實(shí)現(xiàn)透明代理了
成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的平邑網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
redsock2安裝很簡單直接make就可以了,
ubuntu需要
apt-get intsll libevent-2.0-5 libssl-dev
安裝完成后,直接把 redsocks2 復(fù)制到相關(guān)目錄即可。
我這用它做網(wǎng)關(guān), 然后測試了一下,http 和 https 不能一起走,要分開
redsocks2 配置文件:
base { log_debug = off; log_info = off; daemon = on; redirector= iptables; } redsocks { local_ip = 192.168.1.1; local_port = 1080; ip = 192.168.1.1; port = 8787; type = http-relay; timeout = 12; autoproxy = 1; } redsocks { local_ip = 192.168.1.1; local_port = 1081; ip = 192.168.1.1; port = 8787; type = http-connect; timeout = 12; autoproxy = 1; } redsocks { local_ip = 192.168.1.1; local_port = 1090; interface = eth0; type = direct; #主要用來解決NAT問題,讓W(xué)AN可以訪問到LAN timeout = 1; autoproxy = 0; } autoproxy { no_quick_check_seconds = 300; quick_connect_timeout = 2; } ipcache { cache_size = 4; cache_file = "/home/user/conf/cache.ip"; stale_time = 7200; autosave_interval = 3600; port_check = 1; }
相關(guān)iptables 設(shè)置
#!/bin/bash iptables-restore</etc/network/iptables.up.rules iptables -t nat -N RSHTTPS iptables -t nat -A RSHTTPS -o lo -j RETURN iptables -t nat -A RSHTTPS -d 0.0.0.0/8 -j RETURN iptables -t nat -A RSHTTPS -d 10.0.0.0/8 -j RETURN iptables -t nat -A RSHTTPS -d 127.0.0.0/8 -j RETURN iptables -t nat -A RSHTTPS -d 169.254.0.0/16 -j RETURN iptables -t nat -A RSHTTPS -d 172.16.0.0/12 -j RETURN iptables -t nat -A RSHTTPS -d 172.17.0.0/12 -j RETURN iptables -t nat -A RSHTTPS -d 192.168.0.0/16 -j RETURN iptables -t nat -A RSHTTPS -d 224.0.0.0/4 -j RETURN iptables -t nat -A RSHTTPS -d 240.0.0.0/4 -j RETURN iptables -t nat -A RSHTTPS -p tcp -j REDIRECT --to-port 1081 iptables -t nat -I PREROUTING -p tcp --dport 443 -j RSHTTPS iptables -t nat -N RSHTTP iptables -t nat -A RSHTTP -o lo -j RETURN iptables -t nat -A RSHTTP -d 0.0.0.0/8 -j RETURN iptables -t nat -A RSHTTP -d 10.0.0.0/8 -j RETURN iptables -t nat -A RSHTTP -d 127.0.0.0/8 -j RETURN iptables -t nat -A RSHTTP -d 169.254.0.0/16 -j RETURN iptables -t nat -A RSHTTP -d 172.16.0.0/12 -j RETURN iptables -t nat -A RSHTTP -d 172.17.0.0/12 -j RETURN iptables -t nat -A RSHTTP -d 192.168.0.0/16 -j RETURN iptables -t nat -A RSHTTP -d 224.0.0.0/4 -j RETURN iptables -t nat -A RSHTTP -d 240.0.0.0/4 -j RETURN iptables -t nat -A RSHTTP -p tcp -j REDIRECT --to-port 1080 iptables -t nat -I PREROUTING -p tcp --dport 80 -j RSHTTP iptables -t nat -N RSDIRECT iptables -t nat -A RSDIRECT -p tcp -j REDIRECT --to-port 1090 iptables -t nat -I PREROUTING -p tcp -d 208.67.220.220 -j RSDIRECT #不加下面這條,沒辦法WAN網(wǎng)連接進(jìn)來 iptables -t nat -I PREROUTING -p tcp -s 192.168.1.2 --sport 3389 -j RSDIRECT pkill redsocks2 redsocks2 -c /home/tool/conf/red.conf
還有另一個(gè)叫 cow 的軟件也可以實(shí)現(xiàn)類似效果。功能上更加強(qiáng)點(diǎn)。
鏈接地址
當(dāng)前文章:redsocks2自動(dòng)代理設(shè)置
轉(zhuǎn)載來源:http://aaarwkj.com/article26/phoicg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、網(wǎng)站導(dǎo)航、云服務(wù)器、App開發(fā)、商城網(wǎng)站、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)