SERVER MANAGEMENT

How to enable GRE tunnel support in OpenVZ VPS

Enable GRE Tunnel

Enable GRE tunnel support in OpenVZ VPS

This post explains how to enable GRE tunnel support in OpenVZ VPS. GRE is Generic Routing Encapsulation, developed by Cisco Systems. It can encapsulate a wide variety of network-layer protocols.

Enabling support for GRE tunnel in an OpenVZ container is simple and straight forward. Check the step by step explanation below:

1. Enable necessary modules:

First, you need to enable the necessary kernel modules.

modprobe nf_conntrack_proto_gre
modprobe ip_gre

Once it is enabled, verify that using the following command:

lsmod | grep gre

Sample Output:

You will get an output like below once you run the above command

[root@server ~]# lsmod | grep gre
nf_conntrack_proto_gre 6185 0
ip_gre 10425 0
ip_tunnel 13244 1 ip_gre
nf_conntrack 81593 12 nf_conntrack_proto_gre,xt_connlimit,xt_conntrack,vzrst,vzcpt,nf_nat_ftp,nf_conntrack_ftp,iptable_nat,nf_nat,nf_conntrack_ipv4,nf_conntrack_ipv6,xt_state
[root@server ~]#
2. Stop container and enable ip_gre feature:

Then, you need to stop the container to enable the GRE feature.

vzctl stop VMID
vzctl set VMID --features ipgre:on --save

Do not forget to replace your actual Virtual Server ID with VMID.

3. Start the container.

Once you enabled the feature, start the container and check if the GRE feature enabled properly by entering into the Virtual server.

vzctl enter VMID

You should see GRE interfaces inside the container, by running the following command:

ip a |grep gre

Sample Output:

root@vps:~# ip a |grep gre
3: gre0: <NOARP> mtu 1476 qdisc noop state DOWN
link/gre 0.0.0.0 brd 0.0.0.0
4: gretap0: <BROADCAST,MULTICAST> mtu 1476 qdisc noop state DOWN qlen 1000
root@vps:~#

That’s it!

Also Read:

If you like the post Understanding top Command and wish to receive more articles from us, please like our FB page: GrepItOut

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments. For more details on our services, please drop us an E-mail at info@grepitout.com