Use iptables in Ubuntu to configure proxy servers

Source: Internet
Author: User
In Ubuntu, this article uses Ubuntu: to enable the net. ipv4.ip _ forward1 option in/etc/sysctl. conf to write the following script file. Proxy. sh #! /Bin/shsysctl-p/sbin/modprobeip_tables/sbin/modprobeip_nat_ftp # if this machine is

This article passes the test in ubuntu 9.04

Ubuntu 9.04:

Enable the net. ipv4.ip _ forward = 1 option in/etc/sysctl. conf.

Write the following script file.

Proxy. sh


#! /Bin/sh
Sysctl-p
/Sbin/modprobe ip_tables
/Sbin/modprobe ip_nat_ftp
# If this machine is dial-up, EXTIF may be ppp +
# If multiple NICs exist, EXTIF is the corresponding Nic.
EXTIF = eth3
ANY = 0.0.0.0/0
# Include all hosts in the 172.16.0.0/16 Lan
LAN = 172.16.0.0/16
/Sbin/ Iptables-F INPUT
/Sbin/iptables-F OUTPUT
/Sbin/iptables-F FORWARD
/Sbin/iptables-F-t nat
/Sbin/iptables-P INPUT ACCEPT
/Sbin/iptables-P OUTPUT ACCEPT
/Sbin/iptables-P FORWARD ACCEPT
/Sbin/iptables-t nat-a postrouting-s $ LAN-o $ EXTIF-j MASQUERADE


Set the network administrator as the ip address of the proxy host on the machine that requires the proxy service.

EXTIF = eth3 in proxy. sh is the Internet ip address of the proxy host.

LAN = 172.16.0.0/16 indicates the intranet host that requires proxy services.

Find the DNS server address you can use.

Generally, you can use the DNS server used by the proxy host.

For example, the application scenario is as follows:

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.