Some local area network environment needs to use proxy to surf the internet, the graphical interface is very good to solve the browser to set up the proxy is good, but the Linux pure command line interface needs to be manually configured.
One, using the wget command for proxy access
Wget is very powerful, support proxy settings, agents can be set in the environment variable or WGETRC file
Method 1: Current environment variable settings
#export proxy=http://219.239.66.253:80/
In this way, you can use wget to download the offshore network.
However, this environment variable setting is only valid for the current environment, and the settings will disappear after the reboot.
Method 2:wget configuration File Settings
#vi/ETC/WGETRC
Ftp_proxy = http://219.239.66.253:80/
Http_proxy = http://219.239.66.253:80/
Https_proxy = http://219.239.66.253:80/(Note: no quotes "")
Method is set in the 3:wget command line argument
Wget supports the-e parameter for proxy settings
#wget-E "Http_proxy=http://[username]:[password] @proxyip:p ort/" "http://www.baidu.com"
Where,-e,–execute=command executes the '. Wgetrc ' Format command, WGETRC format see/ETC/WGETRC or ~/.WGETRC records and input files
Second, in the environment variable proxy settings
The main is in the/etc/profile file environment variable set agent (machine Restart after the proxy settings effect does not disappear).
#/etc/profile
# System wide environment and startup programs, for login setup
# functions and aliases Go IN/ETC/BASHRC
ftp_proxy=222.47.26.12:8888
http_proxy=222.47.26.12:8888
https_proxy=222.47.26.12:8888
no_proxy=192.168.95.20
Export Ftp_proxy
Export Http_proxy
Export Https_proxy
Export No_proxy
After adding, reboot the system. At this point all network connections are connected by proxy.
Example: [Root@localhost ~]# wget "www.blogger.com"
–2011-09-06 07:29:17–http://www.blogger.com/
Connecting to 222.47.26.12:8888 ... connected.
Proxy request sent, awaiting response ... OK
length:81 [text/html]
Saving to: ' index.html '
100%[====================================>] 81–.-k/s in 0s
2011-09-06 07:29:17 (7.72 MB/s) – ' index.html ' saved [81/81]
Third, some sites do not go agent
If you want the global user to use all shells, you need to modify the/etc/profile file
# Vi/etc/profile
Add the following configuration to the file
http_proxy=proxy.abc.com:8080
https_proxy= $http _proxy
ftp_proxy=user:password@proxy.abc.com:8080
no_proxy=*.abc.com,10.*.*.*,192.168.*.*,*.local,localhost,127.0.0.1
export http_proxy https_proxy ftp_proxy No _proxy
which
Http_proxy:http protocol uses proxy server address;
The HTTPS_PROXY:HTTPS protocol uses the security proxy address;
FTP_PROXY:FTP protocol uses proxy server address;
User: The username used by the agent;
Password: The agent uses the username password;
Proxy.abc.com: Proxy address, can be IP, can also be domain name;
8080: the port used;
No_proxy: A host or IP that does not use a proxy.
Save exit, log out of the login system can take effect.
This method is only suitable for configuring HTTP proxies, and there are other ways of configuring the Internet using the socket proxy.