问题描述
公司使用代理登陆的方式,与外网连通,导致配置虚拟机本地互联网络没问题,ping也没问题,但是wget等互联操作的时候会提示网络连接超时。
解决方法
yum代理设置
#编辑文件为:
vi /etc/yum.conf
#在里面添加这一行:
proxy=IP:PORT
#这里的IP 为你要设置的IP ,PORT 是你要设置的端口
#如果需要登陆才能访问,则使用以下方式:
proxy=http://username:password@IP:PORT
如果密码中含有特殊字符则需要转为url字符
字符 | URL编码值 |
---|---|
空格 | %20 |
" | %22 |
# | %23 |
% | %25 |
& | %26 |
( | %28 |
) | %29 |
+ | %2B |
, | %2C |
/ | %2F |
: | %3A |
; | %3B |
< | %3C |
= | %3D |
> | %3E |
? | %3F |
@ | %40 |
\ | %5C |
%7C |
wget代理设置
#编辑文件为:
vi /etc/wgetrc
#添加下面两行:
http_proxy=http://username:password@IP:PORT
https_proxy=http://username:password@IP:PORT
ftp_proxy=http://username:password@IP:PORT