Ubuntu sets proxy for Internet access and ubuntu sets proxy

Source: Internet
Author: User
Tags nameserver

Ubuntu sets proxy for Internet access and ubuntu sets proxy

A Proxy Server is an intermediate agency between a personal network and an Internet service provider. It forwards valid network information and controls and registers forwarding. As a bridge between Internet (WAN) and Intranet (LAN), proxy servers play an extremely important role in practical applications.

  Environment: Win7_64-bit + VMware11 + Ubuntu1204

Firefox's configuration is relatively simple. You only need to find the NetWork in system settings, and select manual mode in NetWork proxy to configure the proxy server address and port. Some proxy servers deny direct access to virtual machines. Therefore, the NIC of the virtual machine must be set to NAT mode rather than bridging mode. This is also the reason why many developers fail to configure the NIC.

User Logon cannot be set in system settings. If the proxy server does not allow anonymous logon, the command line (apt-get wget) still cannot access the Internet. This document describes how to set up proxy for Internet access under the command line.

  

  Proxy for apt tools:You must configure the/etc/apt. conf file in the following format:

  1 Acquire::http::proxy "http://user:pwd@proxy.xxx:8080/";  2 Acquire::https::proxy "https://user:pwd@proxy.xxx:8080/";  3 Acquire::ftp::Proxy "ftp://username:password@proxyhost:port/";

This setting is permanently valid and is also recommended. Of course, you also need to set the NIC of the VM to the NAT mode.

 

  Wget tool settings:You need to configure the/etc/wgetrc file in the following format:

1 http_proxy = http://user:pwd@proxy.xxx:8080/
2 use_proxy = on

  

  By setting the DNS server penetration Proxy:Because some gateways intercept the Internet through dns, you can set the DNS server.

    1,By modifying/etc/network/interfaces, add the following sentence at the end: dns-nameservers 114.114.114.114

114.114.114.114 is the DNS service provided by 114. Here is just an example. You can also change it to the DNS service provided by the telecom operator. After restart, the DNS will take effect.

    2,Modify/etc/resolvconf/resolv. conf. d/base (this file is empty by default) and insert:

Nameserver 8.8.8.8
Nameserver 8.8.4.4

Save and execute resolvconf-u

It is not recommended here. In general, this setting is invalid.

  Set proxy environment variables:

1,Temporary settings: Enter the command export http_proxy = http: // usr: pwd @ proxy_addr: proxy_port/in the terminal/

2,Permanent settings: In ~ /. Add export http_proxy = http: // usr: pwd @ proxy_addr: proxy_port/to the Startup File such as bashrc or/etc/profile/

Note: the principle of setting proxy in system settings is to set proxy variables, so the system settings will overwrite this variable.

After testing, setting environment variables can enable Firefox to access the Internet, but the command line still cannot access the Internet.

 

  

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.