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.