{"id":204,"date":"2024-10-11T14:50:38","date_gmt":"2024-10-11T14:50:38","guid":{"rendered":"https:\/\/gratisvps.net\/blog\/?p=204"},"modified":"2024-10-15T22:03:21","modified_gmt":"2024-10-15T22:03:21","slug":"how-to-set-up-and-configure-a-linux-gre-tunnel-2","status":"publish","type":"post","link":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/","title":{"rendered":"How to set up and configure a Linux GRE tunnel"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"204\" class=\"elementor elementor-204\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-32ec3513 e-flex e-con-boxed e-con e-parent\" data-id=\"32ec3513\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6fe5a2e9 elementor-widget elementor-widget-text-editor\" data-id=\"6fe5a2e9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<strong>This guide will walk through the setup and configuration of a GRE tunnel between two Linux hosts. The two Linux hosts are running Ubuntu 22.04 LTS.<\/strong>\r\n\r\nWhat is a GRE tunnel in networking?\r\nGRE (Generic Routing Encapsulation) tunnels encapsulate network packets inside new network packets. A virtual link is established between two hosts, allowing the hosts to communicate as if they were directly connected. The Cisco-developed tunneling protocol can encapsulate most protocol packet types.\r\n\r\nIs a GRE tunnel encrypted?\r\n\r\nThough a GRE tunnel functions similarly to a VPN, packets traveling inside a GRE tunnel are not encrypted but are instead encapsulated inside a GRE header. You must configure IPSec separately if you want to maintain data confidentiality.\r\n\r\nHow to set up and configure a GRE tunnel\r\nSetting up a GRE tunnel naturally requires work on both hosts. You will need to create a tunnel interface on each, set up firewall rules, and create routing tables. For clarity, we&#8217;ll name one host &#8220;Host A&#8221; and the other &#8220;Host B&#8221;.\r\n\r\nGRE tunnel setup on Host A\r\nEnabling IP forwarding\r\n\r\nThe first step is to enable IP port forwarding on our host. Without this the GRE tunnel will not work. This is possible with a single command:\r\n<div id=\"81078de5455304a733829e6b2d8d6c35\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs default\" role=\"presentation\">sysctl -w net.ipv4.ip_forward=1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nCreating the GRE tunnel interface\r\n\r\nNow we can create the GRE tunnel interface from Host A to Host B:\r\n<div id=\"c7245c58b8ecd4524d46a7dd0c1168ff\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip tunnel add gre1 mode gre remote &lt;HOST_B_IP&gt; local &lt;HOST_A_IP&gt; ttl 25<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nNaturally, you should replace &lt;Host_B_IP&gt; with the IP address of your target server and &lt;Host_A_IP&gt; with the IP address of the machine you are currently connected to.\r\n\r\nNext, we need to assign an IP address to the GRE interface on our host:\r\n<div id=\"1b612062e71a34d7f09968fda23d44d5\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip addr add &lt;HOST_A_PRIV_IP_GRE&gt;\/30 dev gre1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nYou should replace &lt;HOST_A_PRIV_IP_GRE&gt; with an unused private IP, for example:\r\n<div id=\"d3d8288f18961b1bc339bb2895e5eba6\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip addr add 10.0.0.1\/30 dev gre1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nNow it&#8217;s a simple matter of activating the GRE interface with the following command:\r\n<div id=\"c823b14d1b22be7bd67910ddbc5a277b\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip link <span class=\"hljs-keyword\">set<\/span> dev gre1 up<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nSetting up a firewall rule for source NAT\r\nWe&#8217;ll now add a firewall rule to perform source NAT. This will translate the source IP address of packets leaving our GRE interface into public routable addresses:\r\n<div id=\"870bb0177d281d1b39c58840ab91e729\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">iptables -t nat -A POSTROUTING -s &lt;HOST_B_PRIV_IP_GRE&gt; ! -o gre+ -j SNAT --to-<span class=\"hljs-keyword\">source<\/span> &lt;HOST_A_IP&gt;<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nEXAMPLE:\r\n<div id=\"884dae0d95a49ed58bd1b5bd06d7a225\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs accesslog\" role=\"presentation\">iptables -t nat -A POSTROUTING -s 10.0.0.2 ! -o gre+ -j SNAT --to-source 1.1.1.1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nCreating routing table rules for the GRE tunnel interface\r\nFinally, we can add a custom routing table for the GRE tunnel that will route traffic from the GRE tunnel&#8217;s source IP through the GRE table:\r\n<div id=\"0ef0fec1401298ca7888418ab3a5b119\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span>\r\n<span class=\"code-number\">2<\/span>\r\n<span class=\"code-number\">3<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\"><span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'100 GRE'<\/span> &gt;&gt; \/etc\/iproute2\/rt_tables  \r\nip rule add from &lt;HOST_A_PRIV_IP_GRE&gt;\/32 table GRE\r\nip route add default via &lt;HOST_B_PRIV_IP_GRE&gt; table GRE<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nEXAMPLE:\r\n<div id=\"4643d3f327766ddd27e6a6cd0dbb3987\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span>\r\n<span class=\"code-number\">2<\/span>\r\n<span class=\"code-number\">3<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\"><span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'100 GRE'<\/span> &gt;&gt; \/etc\/iproute2\/rt_tables  \r\nip rule add from 10.0.0.1\/32 table GRE\r\nip route add default via 10.0.0.2 table GRE<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nGRE tunnel setup on Host B\r\nFor host B, the setup is the same, except of course that we must use flip the IP addresses and use a different private IP.\r\n\r\nEnabling IP forwarding\r\n\r\nWe can set up IP forwarding on Host B with the same command as Host A.\r\n<div id=\"bd435e41ffe68be57be5b7ebb70d021f\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs default\" role=\"presentation\">sysctl -w net.ipv4.ip_forward=1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nCreating the GRE tunnel interface\r\nNow we can create the GRE tunnel interface from Host B to Host A:\r\n<div id=\"b90c367fc5cfe4a3ccd711677e755c4c\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip tunnel add gre1 mode gre remote &lt;HOST_A_IP&gt; local &lt;HOST_B_IP&gt; ttl 225<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nYou should replace &lt;Host_A_IP&gt; with the IP address of your first server and &lt;Host_B_IP&gt; with the IP address of the machine you are currently connected to.\r\n\r\nNext, we need to assign an IP address to the GRE interface on our host:\r\n<div id=\"0f19a344ee173ae6d7a781a0242527ff\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip addr add &lt;HOST_B_PRIV_IP_GRE&gt;\/30 dev gre1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nYou should replace &lt;HOST_B_PRIV_IP_GRE&gt; with an unused private IP, for example:\r\n<div id=\"72312f2cf71dbc723abc4b45fd9ea6c8\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip addr add 10.0.0.2\/30 dev gre1<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nNow it&#8217;s a simple matter of activating the GRE interface with the following command:\r\n<div id=\"0d2f3f20c8a1f436a3f575f4dcfdf948\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">ip link <span class=\"hljs-keyword\">set<\/span> dev gre1 up<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nSetting up a firewall rule for source NAT\r\nWe&#8217;ll now add a firewall rule to perform source NAT. This will translate the source IP address of packets leaving our GRE interface into public routable addresses:\r\n<div id=\"ec1f2b210a72c412e67556618e33a0e3\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\">iptables -t nat -A POSTROUTING -s &lt;HOST_B_PRIV_IP_GRE&gt; ! -o gre+ -j SNAT --to-<span class=\"hljs-keyword\">source<\/span> &lt;HOST_B_IP&gt;<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nEXAMPLE:\r\n<div id=\"31c801fb104742bf75e4cfe2f827b83f\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span><\/div>\r\n<pre><code class=\"hljs accesslog\" role=\"presentation\">iptables -t nat -A POSTROUTING -s 10.0.0.1 ! -o gre+ -j SNAT --to-source 2.2.2.2<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nCreating routing table rules for the GRE tunnel interface\r\nFinally, we can add a custom routing table for the GRE tunnel that will route traffic from the GRE tunnel&#8217;s source IP through the GRE table:\r\n<div id=\"62e04b5a5b6740436d6d885f080db97a\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span>\r\n<span class=\"code-number\">2<\/span>\r\n<span class=\"code-number\">3<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\"><span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'100 GRE'<\/span> &gt;&gt; \/etc\/iproute2\/rt_tables  \r\nip rule add from &lt;HOST_B_PRIV_IP_GRE&gt;\/32 table GRE\r\nip route add default via &lt;HOST_A_PRIV_IP_GRE&gt; table GRE<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nEXAMPLE:\r\n<div id=\"c80fedab2a5e8ab0f18cebaa03f8fc87\" class=\"codeblock-wrapper\">\r\n<div class=\"codeblock-scoller-wrapper\">\r\n<div class=\"codeblock-code-wrapper\">\r\n<div class=\"codeblock-code\">\r\n<div class=\"code-numbers\"><span class=\"code-number\">1<\/span>\r\n<span class=\"code-number\">2<\/span>\r\n<span class=\"code-number\">3<\/span><\/div>\r\n<pre><code class=\"hljs bash\" role=\"presentation\"><span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'100 GRE'<\/span> &gt;&gt; \/etc\/iproute2\/rt_tables  \r\nip rule add from 10.0.0.2\/32 table GRE\r\nip route add default via 10.0.0.1 table GRE<\/code><\/pre>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\nThat&#8217;s it! Your GRE tunnel should now be working. Remember, do not send any sensitive data via the tunnel without first setting up IPSec.\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-01eef41 elementor-widget elementor-widget-code-highlight\" data-id=\"01eef41\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>console.log( 'Code is Poetry' );<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>This guide will walk through the setup and configuration of a GRE tunnel between two Linux hosts. The two Linux hosts are running Ubuntu 22.04 LTS. What is a GRE tunnel in networking? GRE (Generic Routing Encapsulation) tunnels encapsulate network packets inside new network packets. A virtual link is established&hellip;<\/p>\n","protected":false},"author":1,"featured_media":205,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,2,4],"tags":[30],"class_list":["post-204","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","category-linux","category-security-tips","tag-gre-tunnel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.6 (Yoast SEO v23.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to set up and configure a Linux GRE tunnel - Gratisvps.net | Blog Daily Tech Info<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set up and configure a Linux GRE tunnel\" \/>\n<meta property=\"og:description\" content=\"This guide will walk through the setup and configuration of a GRE tunnel between two Linux hosts. The two Linux hosts are running Ubuntu 22.04 LTS. What is a GRE tunnel in networking? GRE (Generic Routing Encapsulation) tunnels encapsulate network packets inside new network packets. A virtual link is established&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Gratisvps.net | Blog Daily Tech Info\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-11T14:50:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-15T22:03:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"ariete\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ariete\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\"},\"author\":{\"name\":\"ariete\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4\"},\"headline\":\"How to set up and configure a Linux GRE tunnel\",\"datePublished\":\"2024-10-11T14:50:38+00:00\",\"dateModified\":\"2024-10-15T22:03:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\"},\"wordCount\":638,\"publisher\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp\",\"keywords\":[\"GRE tunnel\"],\"articleSection\":[\"How To\",\"Linux\",\"Security Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\",\"url\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\",\"name\":\"How to set up and configure a Linux GRE tunnel - Gratisvps.net | Blog Daily Tech Info\",\"isPartOf\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp\",\"datePublished\":\"2024-10-11T14:50:38+00:00\",\"dateModified\":\"2024-10-15T22:03:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage\",\"url\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp\",\"contentUrl\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/gratisvps.net\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set up and configure a Linux GRE tunnel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#website\",\"url\":\"https:\/\/gratisvps.net\/blog\/\",\"name\":\"Gratisvps.net | Blog Daily Tech Info\",\"description\":\"Discover reliable VPS server solutions\",\"publisher\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gratisvps.net\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#organization\",\"name\":\"Gratisvps.net | Blog Daily Tech Info\",\"url\":\"https:\/\/gratisvps.net\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png\",\"contentUrl\":\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png\",\"width\":250,\"height\":67,\"caption\":\"Gratisvps.net | Blog Daily Tech Info\"},\"image\":{\"@id\":\"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4\",\"name\":\"ariete\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ca385b636b0c0fe0e98479594ff50902?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ca385b636b0c0fe0e98479594ff50902?s=96&d=mm&r=g\",\"caption\":\"ariete\"},\"sameAs\":[\"https:\/\/gratisvps.net\/blog\"],\"url\":\"https:\/\/gratisvps.net\/blog\/author\/ariete\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to set up and configure a Linux GRE tunnel - Gratisvps.net | Blog Daily Tech Info","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/","og_locale":"en_US","og_type":"article","og_title":"How to set up and configure a Linux GRE tunnel","og_description":"This guide will walk through the setup and configuration of a GRE tunnel between two Linux hosts. The two Linux hosts are running Ubuntu 22.04 LTS. What is a GRE tunnel in networking? GRE (Generic Routing Encapsulation) tunnels encapsulate network packets inside new network packets. A virtual link is established&hellip;","og_url":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/","og_site_name":"Gratisvps.net | Blog Daily Tech Info","article_published_time":"2024-10-11T14:50:38+00:00","article_modified_time":"2024-10-15T22:03:21+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp","type":"image\/webp"}],"author":"ariete","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ariete","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#article","isPartOf":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/"},"author":{"name":"ariete","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4"},"headline":"How to set up and configure a Linux GRE tunnel","datePublished":"2024-10-11T14:50:38+00:00","dateModified":"2024-10-15T22:03:21+00:00","mainEntityOfPage":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/"},"wordCount":638,"publisher":{"@id":"https:\/\/gratisvps.net\/blog\/#organization"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage"},"thumbnailUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp","keywords":["GRE tunnel"],"articleSection":["How To","Linux","Security Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/","url":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/","name":"How to set up and configure a Linux GRE tunnel - Gratisvps.net | Blog Daily Tech Info","isPartOf":{"@id":"https:\/\/gratisvps.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage"},"thumbnailUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp","datePublished":"2024-10-11T14:50:38+00:00","dateModified":"2024-10-15T22:03:21+00:00","breadcrumb":{"@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#primaryimage","url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp","contentUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/9805757029_article_hd.webp","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/gratisvps.net\/blog\/how-to-set-up-and-configure-a-linux-gre-tunnel-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gratisvps.net\/blog\/"},{"@type":"ListItem","position":2,"name":"How to set up and configure a Linux GRE tunnel"}]},{"@type":"WebSite","@id":"https:\/\/gratisvps.net\/blog\/#website","url":"https:\/\/gratisvps.net\/blog\/","name":"Gratisvps.net | Blog Daily Tech Info","description":"Discover reliable VPS server solutions","publisher":{"@id":"https:\/\/gratisvps.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gratisvps.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/gratisvps.net\/blog\/#organization","name":"Gratisvps.net | Blog Daily Tech Info","url":"https:\/\/gratisvps.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png","contentUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png","width":250,"height":67,"caption":"Gratisvps.net | Blog Daily Tech Info"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4","name":"ariete","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ca385b636b0c0fe0e98479594ff50902?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ca385b636b0c0fe0e98479594ff50902?s=96&d=mm&r=g","caption":"ariete"},"sameAs":["https:\/\/gratisvps.net\/blog"],"url":"https:\/\/gratisvps.net\/blog\/author\/ariete\/"}]}},"_links":{"self":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/204"}],"collection":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":8,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"predecessor-version":[{"id":228,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/204\/revisions\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/media\/205"}],"wp:attachment":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}