Configure an internet proxy for Unix and Linux

Source: Internet
Author: User
The company's network environment is a bit complicated. the damn confidentiality policy requires that all internet connections should be implemented through HTTP proxy. In the Win environment, you only need to synchronize the proxy configuration through the domain policy, but it is relatively troublesome for Linux. I studied it and shared it with you. Get proxy tags: proxy surfing

The company's network environment is a bit complicated. the "secrecy policy" requires that all internet connections be implemented through HTTP proxy. In the Win environment, you only need to synchronize the proxy configuration through the domain policy, but it is relatively troublesome for Linux. I studied it and shared it with you.

 

Get proxy server address

Generally, proxy settings are more common in several ways. it is relatively simple to see in the Internet configuration of IE, whether it can be modified or not, at least you can see the IP/host name and port number configuration, which is enough!

The other method is as automatic as it is, which requires a bit of brains.

Open a terminal in advance, type netstat, do not press enter, and immediately switch to IE to access a relatively slow web page. Switch back to terminal. press Enter! Then ......

C:Usersliqunjia>netstatActive Connections  Proto  Local Address          Foreign Address        State  TCP    10.239.204.38:5357     GUANQUNW-MOBL:60787    TIME_WAIT  TCP    10.239.204.38:54912    outlooksh:59532        ESTABLISHED  TCP    10.239.204.38:59490    fmscsp1fe04:5061       ESTABLISHED  TCP    10.239.204.38:59678    outlooksh:59532        ESTABLISHED  TCP    10.239.204.38:59842    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59844    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59847    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59848    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59850    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59851    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59857    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59858    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59862    litrin-test:http       TIME_WAIT  TCP    10.239.204.38:59867    shzdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59869    shmdmzpr02_int:911     CLOSE_WAIT  TCP    10.239.204.38:59870    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59871    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59872    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59873    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59874    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59875    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59876    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59877    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59878    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59879    shmdmzpr02_int:911     ESTABLISHED  TCP    10.239.204.38:59880    shmdmzpr02_int:911     ESTABLISHED  TCP    127.0.0.1:50035        LIQUNJIA-MOBL:62522    ESTABLISHED  TCP    127.0.0.1:62522        LIQUNJIA-MOBL:50035    ESTABLISHED  TCP    [::1]:59671            LIQUNJIA-MOBL:59673    ESTABLISHED  TCP    [::1]:59673            LIQUNJIA-MOBL:59671    ESTABLISHED

A large number of established points to the same port. this ip address and port are undoubtedly the proxy address.

Desktop Environment

Here we mainly talk about the configuration of Firefox, which is similar to the FF configuration in Windows. just cut a picture.

Configuration in Shell

Under normal circumstances, few users can simply browse the web page through shell. In most cases, shell Internet connections are only used for wget/curl or update manager.

The internet proxy settings in shell are mainly implemented through the configuration of several environment variables. The format is as follows:

Export http_proxy = http: // server-ip: port/# HTTP proxy configuration export https_proxy = https: // server-ip: port/# https proxy configuration export ftp_proxy = ftp: // server-ip: port/# ftp proxy (can it be older ?) Export no_proxy = *. edu # address features that do not pass the proxy

It should be noted that if your proxy has user authentication, the configuration format should be as follows:

export http_proxy=http://username:password@server-ip:port/

Well, if your user name or password contains "@" "/" and other symbols-for example, most authentication methods for windows domain accounts have this problem, you can escape it with the "" symbol.

If you do not want to enter the proxy configuration every time you log on, you are advised to save the export command ~ /. Bashrc (or other shellrc), the system will automatically load each time the shell is started.

In fact, wget can directly specify the proxy server authentication method, or use the-no_proxy parameter to forcibly bypass the proxy.

Wget -- proxy-user = USER -- proxy-password = PASS http://www.abc.com/wget -- no_proxy http://www.abc.com/# no proxy

Curl is more flexible than wget.

Curl -- proxy http (s): // server-ip: port http://abc.com/# specify a separate proxy curl -- socket4 server-ip: port http://abc.com/# specify socket4 proxy curl -- socket5 server-ip: port http://abc.com/# specify socket5 proxy curl -- proxy-user username: password http://abc.com/# use the system's proxy server to configure curl -- noproxy http://abc.com # bypass the proxy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.