Set a Linux client Internet proxy

Source: Internet
Author: User

Summary

(I) set a user's Internet proxy

(Ii) set the Internet proxy for a specific user program: wget setting proxy and Yum setting proxy

 

Main Content

(1) set a user's Internet proxy

(1) Start CCProxy on the old node 10.10.11.20.that can connect to the Internet,
Set an http port, such as 9527;
Add clients a and B to your account and use the IP address;

(2) Set proxy on internal node clients A and B

For example, you can set a user's Internet proxy. Only this user can access the Internet through this proxy, such as the root user.
[Root @ glnode04 ~] # Vim ~ /. Bash_profile (start a bash to load the file)
Add to file
Http_proxy = "http: // 10.10.77.133: 9527"
Export http_proxy


[Root @ glnode04 ~] # Source ~ /. Bash_profile

In this way, you can use the proxy server to access the Internet.

Note that the old node has two IP addresses, one being 11.251 and the other being 77.251. When proxy is set in the client, only the latter can be used. The IP addresses 77.251 and glnode04 are in the same subnet, they can ping each other.

(3) test

[Root @ gmnode14 kernels] # wget Sina.com
-- 04:58:01 -- http://sina.com/
Connecting to 10.10.77.htm: 9527... connected.
A proxy request has been sent and is waiting for response... 301 moved permanently
Location: http://www.sina.com/[following to new URL]
-- 04:58:02 -- http://www.sina.com/
Connecting to 10.10.77.htm: 9527... connected.
A proxy request has been sent and is waiting for response... 301 moved permanently
Location: http://www.sina.com.cn/[following to new URL]
-- 04:58:04 -- http://www.sina.com.cn/
Connecting to 10.10.77.htm: 9527... connected.
A proxy request has been sent and is waiting for response... 200 OK
Length: 534407 (522 K) [text/html]
Saving to: 'index.html'

100% [============================================== ========================================================== ========================================================== ====================>] 534,407 583 K/s in 0.9 s

04:58:05 (583 kb/s)-'index.html 'saved [534407/534407]

(2) separately set proxy for an application

For example, wget's Internet proxy,
Set the wget proxy on internal nodes A and B.

[Root @ hdfs05 VM] # Vim ~ /. Wgetrc
Http_proxy = http: // 10.10.77.small: 9527/
Use_proxy = on

For example, Yum's Internet proxy,

You can/Etc/yum. conf

Set proxy server information. The proxy configuration item must be set to the complete Proxy Server URL, including the TCP port number. If your proxy server requires the user name and password, you can use the proxy_username and proxy_password configuration items to specify them.
This configuration enables Yum to use the proxy server mycache.mydomain.com, the connection port number 3128, the user name Yum-user, and the password Qwerty.
# Proxy Server-proxy server: Port Number
Proxy = http: // 10.10.77.htm: 9527/
# Account details for Yum connection
Proxy_username = Yum-user
Proxy_password = qwerty

Related Article

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.