Set proxy server access and static IP address in Ubuntu LAN

Source: Internet
Author: User

1. Use the proxy server to access the Internet

To use machine A to access the Internet through machine B, use the following methods: 1. First, make sure that machine B can access the Internet.

2. install squid software on machine B, $ sudo apt-Get install squid. After installation is complete, a squid configuration file squid is put down on the Internet. conf, and then overwrite the file with the same name under/etc/squid /.

3. test the proxy server on machine B. If you see squid start/running and process 1726 (process number will be different) in $ sudo service squid start, run sudo service squid stop, execute $ sudo service squid start and $ sudo service squid restart when you see squid stop/waiting. if you see squid start/running twice, process 1726 indicates that it is basically OK.

4. Set the network proxy on machine A and change the original proxy to the IP address of machine B, and change the port number to 3128. You can view IP addresses in $ ifconfig.

5. Open a webpage on machine A. If it cannot be opened, delete the squid and reinstall it. $ Sudo apt-Get autoremove squid

PS: the proxy server can be started without a password.

2. Set static IP addresses

The network configuration information of Ubuntu is saved in the/etc/Network/interfaces file. Use Vim to open the configuration file. By default, the configuration of the IP address is automatically obtained as follows:

# The primary network interface

Auto Lo

Iface lo Inet loopback

Next we will set it to a static IP.

Step 1: Disable the settings for Automatically Obtaining IP addresses

Auto lo blocks this line

Iface lo Inet loopback shields this line

The modified content is as follows:

# The primary network interface

# Auto Lo

Auto eth0

# Iface eth0 Inet DHCP

Step 2: Add static IP information

# The primary network interface

Iface eth0 Inet static

Address 45.111.38.58

Netmask 255.255.255.0

Gateway 45.111.38.254

PS: The address must not be the IP address assigned to others.

Restart the network: sudo/etc/init. d/networking restart

After completing the preceding steps, you only need to re-enable the network.

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.