Use linux as the gateway-Linux Enterprise Application-Linux server application information. The following is a detailed description. Use linux as a gateway
Linux SNAT address translation as a gateway
I. Test topology (Omitted ):
10.0.0.75 (external) 192.168.200.1 (internal)
2. Configure the IP addresses of each network adapter as shown in this figure:
1. Internet IP Address:
IP: 10.0.0.75
Mask: 255.255.255.0
Gateway: 10.0.0.254
DNS: 202.96.209.6 (Shanghai)
2. Intranet IP Address:
IP: 192.168.200.1
Mask: 255.255.255.0
Gateway: NULL
3. Enable the ipforward kernel switch variable
1. Use more/proc/sys/net/ipv4/ip_forward to check whether it is set to "0"
Use vi/proc/sys/net/ipv4/ip_forward to change the number "0" to "1 ".
2. Modify the following items in the/etc/sysctl. conf file:
Net. ipv4.ip _ forward = 1
Net. ipv4.conf. default. rp_filter = 1
Kernel. sysrq = 0
4. Enable the forwarding function of the FORWARD chain
Iptables? A forward? D 192.168.200.0/24? J accept
5. Translate LAN addresses into Internet addresses:
Add the following two entries to the firewall table so that all hosts in the 192.168.200.0 network segment can access the gateway.
Iptables? T nat? A postrouting? S 192.168.200.0/24? J SNAT -- to-source 10.0.0.75
At this point, a NAT Gateway has been set up, but there is no firewall function.
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