{"id":32,"date":"2025-08-09T14:13:00","date_gmt":"2025-08-09T14:13:00","guid":{"rendered":"https:\/\/azherrashid.xyz\/?p=32"},"modified":"2025-12-09T14:22:24","modified_gmt":"2025-12-09T14:22:24","slug":"never-go-offline-again-setting-up-4g-wan-failover-on-opnsense-with-a-teltonika-trb140","status":"publish","type":"post","link":"https:\/\/azherrashid.xyz\/?p=32","title":{"rendered":"Never Go Offline Again: Setting up 4G WAN Failover on OPNsense with a Teltonika TRB140"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>We rely on the internet for almost everything now. Whether you are running a home lab, a small business office, or just have a household that panics when Netflix buffers, losing your primary internet connection is a major headache.<\/p>\n\n\n\n<p>If you are already running OPNsense, you have enterprise-grade failover capabilities right at your fingertips. You just need a second internet source.<\/p>\n\n\n\n<p>In this guide, we are going to set up a robust Multi-WAN failover system. We will use your existing primary internet connection (fiber\/cable) and add a 4G\/LTE backup using the super-reliable Teltonika TRB140 gateway.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why the Teltonika TRB140?<\/h2>\n\n\n\n<p>While you could use a cheap USB 4G dongle, they are notoriously flaky. They overheat, disconnect randomly, and driver support in FreeBSD (the OS underneath OPNsense) can be hit-or-miss.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"900\" src=\"https:\/\/azherrashid.xyz\/wp-content\/uploads\/2025\/12\/trb140_20220319_125924.jpg\" alt=\"\" class=\"wp-image-33\" style=\"width:723px;height:auto\" srcset=\"https:\/\/azherrashid.xyz\/wp-content\/uploads\/2025\/12\/trb140_20220319_125924.jpg 900w, https:\/\/azherrashid.xyz\/wp-content\/uploads\/2025\/12\/trb140_20220319_125924-300x300.jpg 300w, https:\/\/azherrashid.xyz\/wp-content\/uploads\/2025\/12\/trb140_20220319_125924-150x150.jpg 150w, https:\/\/azherrashid.xyz\/wp-content\/uploads\/2025\/12\/trb140_20220319_125924-768x768.jpg 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p>The Teltonika TRB140 is an industrial LTE Cat 4 gateway. It connects via Ethernet, meaning no driver issues. It\u2019s designed to run 24\/7 in harsh environments. Most importantly, it supports <strong>IP Passthrough (Bridge Mode)<\/strong>, which is crucial for avoiding &#8220;Double NAT&#8221; issues and ensuring OPNsense handles the public IP address directly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before we start, ensure you have the following:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>OPNsense Firewall:<\/strong> Running and configured with a primary WAN and LAN. You need at least one free physical Ethernet port (e.g., <code>igb2<\/code>, <code>em2<\/code>, etc.).<\/li>\n\n\n\n<li><strong>Teltonika TRB140:<\/strong> With power adapter and LTE antennas attached.<\/li>\n\n\n\n<li><strong>A SIM Card:<\/strong> An active data SIM with a known APN (Access Point Name). <em>Warning: Keep an eye on your data caps when running on backup!<\/em><\/li>\n\n\n\n<li><strong>Ethernet Cable:<\/strong> To connect the TRB140 to OPNsense.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 1: Configuring the Teltonika TRB140<\/h2>\n\n\n\n<p>We need to configure the TRB140 just enough so that it connects to the mobile network and passes that connection straight through its Ethernet port without doing any routing itself.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Insert SIM and Power Up:<\/strong> Insert your SIM card into the TRB140 and power it on. Wait for the mobile signal LEDs to stabilize.<\/li>\n\n\n\n<li><strong>Initial Connection:<\/strong> Connect your computer&#8217;s Ethernet port directly to the TRB140&#8217;s Ethernet port.<\/li>\n\n\n\n<li><strong>Login:<\/strong> Open a browser and go to <code>192.168.2.1<\/code> (the default IP). Log in (admin\/admin01 usually, you will be forced to change this).<\/li>\n\n\n\n<li><strong>Setup Wizard:<\/strong> Run through the initial setup wizard to set your time zone and ensure the mobile interface connects. If it doesn&#8217;t connect automatically, you may need to enter your carrier&#8217;s APN located under <strong>Network -> Interfaces -> General (Mobile)<\/strong>.<\/li>\n\n\n\n<li><strong>Enable Passthrough Mode (Crucial Step):<\/strong>\n<ul class=\"wp-block-list\">\n<li>Navigate to <strong>Network -> Interfaces<\/strong>.<\/li>\n\n\n\n<li>Edit the <strong>Mobile<\/strong> interface.<\/li>\n\n\n\n<li>Change the <strong>Mode<\/strong> from NAT to <strong>Passthrough<\/strong>.<\/li>\n\n\n\n<li>Ensure the &#8220;Passthrough to interface&#8221; is set to the <strong>LAN<\/strong> Ethernet port.<\/li>\n\n\n\n<li><em>Optional but recommended:<\/em> Sometimes you need to specify the MAC address of the OPNsense port you will be connecting to. For now, try leaving it blank; the TRB140 usually detects the first device plugged into its LAN port.<\/li>\n\n\n\n<li>Click <strong>Save &amp; Apply<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><em>Note: Once passthrough is enabled, you will lose easy access to the TRB140 web UI because it is no longer acting as a router with a local IP of 192.168.2.1. It is now a transparent bridge.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 2: Physical Connections<\/h2>\n\n\n\n<p>Now that the modem is ready, let&#8217;s hook it into the firewall.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Disconnect your computer from the TRB140.<\/li>\n\n\n\n<li>Connect an Ethernet cable from the <strong>TRB140 LAN port<\/strong> to your chosen free port on the <strong>OPNsense box<\/strong> (e.g., <code>igb2<\/code>).<\/li>\n<\/ol>\n\n\n\n<p>Phase 3: Configuring the OPNsense Interface<\/p>\n\n\n\n<p>We need to tell OPNsense that this new port is a second WAN connection.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Log into your OPNsense Admin UI.<\/li>\n\n\n\n<li>Navigate to <strong>Interfaces -> Assignments<\/strong>.<\/li>\n\n\n\n<li>At the bottom, where it says &#8220;New interface&#8221;, select the physical port you connected the TRB140 to (e.g., <code>igb2<\/code>) and click the <strong>+<\/strong> button.<\/li>\n\n\n\n<li>It will likely be named <code>OPT1<\/code> or <code>OPT2<\/code>. Click on its name to edit it.<\/li>\n\n\n\n<li><strong>General Configuration:<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Enable Interface:<\/strong> Checked.<\/li>\n\n\n\n<li><strong>Description:<\/strong> Give it a name, like <code>WAN2_4G<\/code>.<\/li>\n\n\n\n<li><strong>IPv4 Configuration Type:<\/strong> DHCP. (Because the TRB140 is in passthrough mode, it will pass the carrier&#8217;s IP settings via DHCP to this interface).<\/li>\n\n\n\n<li><strong>IPv6 Configuration Type:<\/strong> None (unless your carrier supports it and you want to configure it).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Save<\/strong> and <strong>Apply Changes<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p><em>Checkpoint: Go to the OPNsense Dashboard\/Lobby. You should see the <code>WAN2_4G<\/code> interface get an IP address. It might be a CGNAT private IP (like 10.x.x.x or 100.x.x.x) depending on your mobile carrier. This is normal.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 4: Gateway and Monitor IP Setup<\/h2>\n\n\n\n<p>OPNsense needs to know <em>how<\/em> to determine if an internet connection is actually working. If we just monitor the TRB140 itself, the connection might look &#8220;up&#8221; even if the cellular tower has lost internet connectivity.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Navigate to <strong>System -> Gateways -> Single<\/strong>.<\/li>\n\n\n\n<li>You should see a new gateway that was automatically created when you enabled DHCP on WAN2_4G. It usually has &#8220;GW&#8221; in the name. Click the pencil icon to edit it.<\/li>\n\n\n\n<li><strong>Edit Gateway:<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>Gateway name:<\/strong> Rename it something clearer if you wish (e.g., <code>GW_WAN2_4G<\/code>).<\/li>\n\n\n\n<li><strong>Monitor IP:<\/strong> This is critical. Do <strong>not<\/strong> leave this blank. Enter an external, highly available DNS server. Good choices are <code>1.1.1.1<\/code> (Cloudflare) or <code>8.8.8.8<\/code> (Google). <em>Note: Ensure your primary WAN gateway is monitoring a different IP (e.g., if WAN1 monitors 8.8.8.8, have WAN2 monitor 1.1.1.1).<\/em><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Click <strong>Save<\/strong> and <strong>Apply Changes<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p><em>Checkpoint: Look at the gateway status on the dashboard. You should see both gateways showing green &#8220;Online&#8221;.<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction We rely on the internet for almost everything now. Whether you are running a home lab, a small business office, or just have a household that panics when Netflix buffers, losing your primary internet connection is a major headache. If you are already running OPNsense, you have enterprise-grade failover capabilities right at your fingertips. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":1,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":34,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/34"}],"wp:attachment":[{"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azherrashid.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}