===== VM1 settings =====
gedit /etc/network/interfaces
modprobe ip_gre
auto tun0
iface tun0 inet static
address 10.0.201.2
netmask 255.255.255.0
broadcast 10.0.201.255
up ifconfig tun0 multicast
pre-up iptunnel add tun0 mode gre local 111.2.1.130 remote 111.2.1.97 ttl 255
pointopoint 10.0.201.1
post-down iptunnel del tun0
Create a interface was called eth3
Assign a IP address is 192.168.111.1
Reboot.
===== VM2 settings =====
gedit /etc/network/interfaces
modprobe ip_gre
auto tun0
iface tun0 inet static
address 10.0.201.1
netmask 255.255.255.0
broadcast 10.0.201.255
up ifconfig tun0 multicast
pre-up iptunnel add tun0 mode gre local 111.2.1.97 remote 111.2.1.130 ttl 255
pointopoint 10.0.201.2
post-down iptunnel del tun0
Create a interface was called eth2
Assign a IP address is 192.168.222.1
Reboot
===== Experiment =====
==== Test 1 ====
ping from "VM1 of tun0(10.0.201.2)" to "VM2 of tun0(10.0.201.1)" (OK).
==== Test 1 ====
If eth3 want ping to eth2 must add route rule to routing table.
sudo route add 192.168.222.0 netmask 255.255.255.0 gw 10.0.201.2 dev tun0
After this script, then ping successfully.
Reference :
- Creating an IP Tunnel using GRE on Linux (Very Important)
- Ubuntu 12.04 Server: GRE Tunneling
- 深入理解 GRE tunnel
- GRE Tunneling How to
- Bridging across GRE tunnels (experimental)
- Tunneling - GRE/L2TP
- Understanding and Configuring VLAN Routing and Bridging on a Router Using the IRB Feature
- /etc/network/interfaces
- networking - How can I add encryption to a GRE tunnel?
Other :
##############################
iface zeus inet static
address 192.168.0.2
netmask 255.255.255.0
network 10.0.0.0
pre-up ip tunnel add zeus mode gre remote 212.120.124.15 local 130.89.193.99 ttl 255
up ip link set mtu 1500 dev zeus
up ip ro add 10.0.0.0/24 dev zeus
up ip ro del 192.168.0.0/24 dev zeus
post-down ip tunnel del zeus
##############################
iface zeus inet static
pre-up ip tunnel add zeus mode gre remote 111.5.3.143 local 111.2.1.130 ttl 255
up ip link set mtu 1500 dev zeus
up ip ro add 10.0.0.0/24 dev zeus
up ip ro del 192.168.0.0/24 dev zeus
post-down ip tunnel del zeus
##############################
iface zeus inet static
pre-up ip tunnel add zeus mode gre remote 111.2.1.130 local 111.2.1.97 ttl 255
up ip link set mtu 1500 dev zeus
up ip ro add 10.0.0.0/24 dev zeus
up ip ro del 192.168.0.0/24 dev zeus
post-down ip tunnel del zeus
##############################
0 意見:
張貼留言