环境:两台都是centos7.3的系统,
其中一台配置代理:
1 yum -y install python2-pip python-devel gcc bzip2-devel
2 pip install twisted
3 vim proxy.py
from twisted.web import proxy, http
from twisted.internet import reactor
from twisted.python import log
import sys
log.startLogging(sys.stdout)
class ProxyFactory(http.HTTPFactory):
protocol = proxy.Proxy
reactor.listenTCP(8080, ProxyFactory())
reactor.run()
4 python proxy.xy
2017-03-24 16:33:15+0800 [-] Log opened.
2017-03-24 16:33:15+0800 [-] ProxyFactory starting on 8118
2017-03-24 16:33:15+0800 [-] Starting factory <__main__.ProxyFactory instance at 0x2e08cf8
另外一台:
export https_proxy=http://192.168.137.177:8118
export http_proxy=http://192.168.137.177:8118
export ftp_proxy=http://192.168.137.177:8118
这样就可以通过代理进行访问了,使用yum和wget命令都可以了,但是ping 一个域名是不通的