Multi-host internet based on a public network IP

Source: Internet
Author: User

First, let's talk about the server architecture I deployed:

One LVs, one tomcat, one MySQL (pre-deployment).

1, the company gave me a public network IP, in the LVS used this IP, but Tomcat Internet has become a

Problem, here's a solution, hopefully to help you:

The first step: the LVS on a network card is set to public IP, the other piece is set to private network IP (for example, 192.168.1.100).

The second step: the LVS need to turn on the Ip_forward forwarding function. (Note: IP forwarding is to enable multi-host Internet access in the location)

Step three: Tomcat needs to set the gateway to 192.168.1.100 so you can ping the LVS on

The public network IP address, if not, first resolved.

Fourth step: Use Iptables to do Snat on LVS:

Iptables-t nat-a postrouting-s 192.168.1.0/24-o eth0-j SNAT--to-source public network IP

Fifth step: Finally, you need to do a DNS configuration on the machine you need to surf the internet, just add the/etc/resolve.conf

NameServer 8.8.8.8 will be all right.

This article is from the Linux shell blog, so be sure to keep this source http://madaqiang.blog.51cto.com/7955196/1663660

Multi-host internet based on a public network IP

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.