How to use Linux as a proxy server

Source: Internet
Author: User

How to use Linux as a proxy server (the simplest method is redhat9.0)

Configuration required:
CPU: Pentium 133 MHz
Memory: 32 MB
Disk: 640 MB
NIC: 2

1. install Linux, select the minimum installation, and remove all components except for configuring IP addresses.
After installation, enter the prompt

2. Configure the NIC first. If the NIC is configured on the GUI, check whether the IP address is correct.
Ifconfig eth0 # Check the NIC 0 status if you want to change the configuration file (command: VI/etc/sysconfig/network-scripts/ifcfg-eth0) File
Ifconfig eth1 # check the status of NIC 1 if you want to change the configuration file (command: VI/etc/sysconfig/network-scripts/ifcfg-eth1) File
Route # Check the gateway. If you want to change the gateway, use (command: VI/etc/sysconfig/network). Enter the gateway you want to change after gateway =.
# Use route to check the Route status. If the read result is successful, it indicates no problem. Use ping to check whether the Intranet and Internet can be pinged.
3. Use iptables to implement the dual-nic NAT Function, so that the proxy server can access the Internet.
VI/etc/sysconfig/Network # first, edit the file and add a line (forward_ipv4 = yes) at the end of the file. Nat can be implemented only when the IP address transfer function is enabled.
Forward_ipv4 = Yes
VI/etc/rc. d/rc. Local # edit the start batch file and add the following lines at the end of the file # No need to add the Linux comment statement
Iptables-F # Clear the iptables table
Iptables-F-T Nat # Clear the iptables ip nat table
Iptables-T Nat-A postrouting-O eth0-s 192.168.0.0/16-J masquerade # Add a new ipnat table. 192.168.0.0/16 is the lan ip address.

Echo L>/proc/sys/NET/IPv4/ip_forward # Start the IP address transfer function. At this point, after the host is restarted, the proxy server may seem to have been used.
4. Configure the services loaded when the system starts.
Ntsysv # A dialog box is displayed, leaving only the iptables service and the networks service. Remove all the other services.
VI/etc/grub. conf # If a dialog box is displayed during system startup, set the wait time here.

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.