Linux IP Tunnel Configuration

Source: Internet
Author: User

System Centos6.0

Here, I will not talk about tunneling or IP tunneling technology.

In my case, the tunnel is different data centers and different public IP addresses. How can they achieve LAN performance and configure private IP addresses for the same network segment? interconnection can be achieved;

I wrote this article because many people found a lot of searches for nat and DR modes when writing lvs articles. Why not write tun? I think it is because there is no ready-made channel, because tun needs to configure the tunnel in advance.

The following is the IP Tunneling configuration;

Both machines are two NICs,

Server1:

Eth0: 192.168.244.152 (public IP); nat in vm for Internet access

Eth1: 10.0.0.1 (private IP); custom to virtual network VMnet3;

Server2:

Eth0: 192.168.244.154 public IP address); nat in vm for Internet access

Eth1: 10.0.0.2 (private IP); custom to virtual network VMnet2;

Now you find that the two machines cannot ping the private IP address of the other side;

The configuration is as follows:

Server1:

modprobe ipipmodprobe ip_greip tunnel add tun0 mode gre remote 192.168.244.154 local 192.168.244.152ip link set tun0 upip addr add 10.0.0.1 peer 10.0.0.2 dev tun0ip route add 10.0.0.0/24 dev tun0iptables -F

Server2:

modprobe ipipmodprobe ip_greip tunnel add tun0 mode gre remote 192.168.244.152 local 192.168.244.154ip link set tun0 upip addr add 10.0.0.2 peer 10.0.0.1 dev tun0ip route add 10.0.0.0/24 dev tun0iptables -F

Start testing now, just one machine;

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/01023521Z-0.jpg "title =" 1.jpg"/>



Ii. ipip Mode

Server1;

Modprobe ipipip tunnel add ethn mode ipip local 222.170.n.n remote appsethn 172.0.0.1route add-host 172.0.0.2 dev ethnecho 1>/proc/sys/net/ipv4/ip_forward # When you have different Ip segments, ip route add.

Server2;

modprobe ipipip tunnel add ethn mode ipip local 60.199.m.m remote 222.170.n.nifconfig ethn 172.0.0.2route add -host 172.0.0.1 dev ethnecho 1 > /proc/sys/net/ipv4/ip_forward

Now we can find that the two ip addresses of 172.0.0.0 can ping each other.


Now I want you to know how lvs continues to configure tun mode 650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/01023524E-1.gif "/>

You are welcome to speak out;

This article is from the Coffee _ Blue Mountains blog, please be sure to keep this source http://lansgg.blog.51cto.com/5675165/1221310

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.