MULTI-TENANT WAN ACCESS on NotThe.Blog https://notthe.blog/series/multi-tenant-wan-access/ Recent content in the series MULTI-TENANT WAN ACCESS on NotThe.Blog Hugo -- gohugo.io en rss@notthe.blog (Steve Dockar) rss@notthe.blog (Steve Dockar) © 2019-2023 Steve Dockar - All Rights Reserved Thu, 19 Dec 2019 09:03:00 +0000 Multi-Tenant WAN Access to Shared Resources: Part 1 - The Problem https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/ Tue, 19 Nov 2019 09:01:00 +0000 rss@notthe.blog (Steve Dockar) https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/
We have a thing on the Internet, lets connect it to our WAN customers! What could possibly go wrong!
<p>A number of Cloud Services require the transfer of large volumes of data. In the <em>Cloud Provider</em> world, that could be uploading VMs in the form of OVA files, ISO disk images, or sending backup data to a <abbr title="Disaster Recovery as a Service">DRaaS</abbr> service. Customers can connect their on-prem <abbr title="Software Defined Data Centers">SDDCs</abbr> to the Cloud Provider with only an Internet connection, and make use of these great services. How easy is that! In locations where the Internet is readily available, fast <strong>and</strong> reliable, this is great. But what about locations where that&rsquo;s not the case? Well, that&rsquo;s where the trusty <abbr title="Wide Area Network">WAN</abbr> steps in. Using a Communication Provider&rsquo;s services, customers can get <strong>direct</strong> network links to their Cloud Provider&rsquo;s datacenters which, while more costly, may offer the speed and reliability which local Internet services lack.</p> <p>Excellent, problem solved! We&rsquo;ll just connect our services to our customers&rsquo; WANs and go back to watching Netflix, right? Hang on, surely it can&rsquo;t be that simple? Of course not, for one thing, if the Internet is poor, how will we watch Netflix????</p> <p>In this post, we&rsquo;ll explore the nature of the problem in connecting a service designed to face the Internet, to the Wide Area Networks of multiple customers. In the second post in the series we&rsquo;ll explore a possible solution. Before we start, let&rsquo;s clear up a couple of points. First, I used &ldquo;WAN&rdquo; in a fairly general way. For the purposes of this post it doesn&rsquo;t matter if the WAN is a L3 MPLS/IP-VPN, L2 Ethernet Private Line or even a legacy Frame Relay or X.25 network. Actually, a Frame Relay or X.25 network may present their own challenges, but, I digress. Secondly, by <strong>direct</strong> I meant that a customer&rsquo;s on-prem network is extended into a Cloud Provider&rsquo;s facility in such a way that the Provider&rsquo;s DC looks like a site on the customer&rsquo;s WAN. The fact that short of dark fiber/fibre between locations, the network links are unlikely to actually be direct isn&rsquo;t the point in this context.</p> <p>Okay, pedantic explanations aside on with the post&hellip;</p> <p>If you don&rsquo;t need all the background to the issue, you can jump straight past the tl;dr intro, to the solution by clicking <a href="#series">here</a>.</p> <h2 id="introduction---the-good-the-bad-and-the-ugly-complex">Introduction - The good, the bad and the <del>ugly</del>.. complex</h2> <p>From a security point of view, services or portals, API gateways etc. do have a tough time on the Internet. But, what&rsquo;s good about the Internet is that everybody on it has to use unique IP addresses. Okay, you can spoof a source address as part of a <abbr title="Denial of Service">DoS</abbr> attack, but to <em>use</em> the Internet you have to play by the rules and use an IP address (or addresses) that nobody else is using. If you&rsquo;re reading this post I&rsquo;m guessing you know, that other than a few, typically large, and typically long established companies, most organizations don&rsquo;t use public Internet addresses inside their networks. Instead, they <strong>all</strong> use the same set of addresses reserved for use inside private networks and detailed in <a href="https://tools.ietf.org/html/rfc1918">rfc1918</a>.</p> <p>As a slight aside, not all organizations do. Some, often unknowingly, use public Internet addresses which they <em>think</em> are private addresses. That&rsquo;s another story, and one which we can&rsquo;t fix in a blog post&hellip; sadly&hellip;</p> <p>And there, in a nutshell is the problem. If you place your service on the Internet and get a connection from a user or another computer making an API call, it will come from a unique public address which you can then answer, and reply to, without difficulty. But, let&rsquo;s say we also want to connect that service, maybe it&rsquo;s some kind of portal, to a customer over their private network too. This presents a couple of problems and we&rsquo;ll look at them from the perspective of the Customer and then the Service Provider.</p> <h3 id="the-customer-is-always-right">The Customer is always right&hellip;</h3> <p>As the customer, I want to connect over <em>my</em> WAN. That means I need to connect to an IP address that works on my network, even though the service lives in my Provider&rsquo;s network. If I use its public Internet address, my network will send the connection, well&hellip; over the Internet, and that kind of defeats the object. Here&rsquo;s what I want. Don&rsquo;t worry, I&rsquo;m sure this diagram will fill up as we go&hellip;</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide1.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide1_huefe4e8995eee14f2426f84a22712407e_79999_1920x0_resize_box_3.PNG" width="1920" height="1204" > </a> </figure> <p>I <em>might</em> be able use the same private address that the provider uses inside their network, but there is a good chance they might be using addresses that are already in use on my network so that might not always work&hellip; But let&rsquo;s say the address doesn&rsquo;t clash. Now I need to work with the Provider to teach my WAN that those particular addresses need to be routed to their network. We call this injecting or learning routes, and that means I&rsquo;m going to need access to some Networking skills (and a good Project Manager) to get things aligned, just so. In the diagram you can see that I use 10.1.x.x, 10.2.x.x and 10.3.x.x in my network and the Provider uses 10.4.x.x. So, all I have to do is teach my network where 10.4.x.x lives and we&rsquo;re in business!</p> <p>But, even if I <em>can</em> use the provider&rsquo;s real address, the Provider, as we&rsquo;ll see next, might still have some challenges with that.</p> <h3 id="the-service-provider-is-bigger-so-should-win-in-a-brawl">The Service Provider is bigger, so should win in a brawl&hellip;</h3> <p>As the Provider, we will have deployed the service before trying to connect it to any customers, and as Public addresses are in short supply, it&rsquo;s likely that the service will have been configured with those same RFC1918 addresses that we mentioned earlier, let&rsquo;s say &lsquo;10.1.x.x&rsquo;. So when we try and offer the service over a customer&rsquo;s network, they just have to connect to the addresses we used.</p> <p>To do this, those networking skills (and that good Project Manager) come in to play to add routes to the customer&rsquo;s WAN to tell it to send traffic destined for &lsquo;10.1.x.x&rsquo; to a WAN router in our Provider datacenter, where it breaks out into the network and heads for the service portal, or API endpoint or whatever.</p> <p>The first problem comes (as we noted in the last section) if the customer is already using those same &lsquo;10.1.x.x&rsquo; addresses somewhere in their network as you can see in the image below. We&rsquo;ll look at solutions in the next post, but I guess for now it just serves us right for not using something more obscure like &lsquo;10.113.x.x&rsquo;! In simple terms, when this happens each network will route traffic to the <em>nearest</em> &lsquo;10.1.x.x&rsquo; addresses as the have no way to know <em>which</em> &lsquo;10.1.x.x&rsquo; addresses we meant them to route to. When that happens, the Provider&rsquo;s service just seems like it&rsquo;s not working, when in actual fact, the issue is that the customer is sending their requests to <strong>their</strong> &lsquo;10.1.x.x&rsquo; addresses and not ours.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide2.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide2_hu326874a11b2b275b03aa79080878e4bd_102357_1920x0_resize_box_3.PNG" width="1920" height="1175" > </a> </figure> <p>Let&rsquo;s say though, that for now, we got lucky and the customer isn&rsquo;t using our addresses anywhere (we&rsquo;ll use the &lsquo;10.4.x.x&rsquo; addresses from the first example), and can get to work using their networking skills (and that good PM) to route their traffic to our service. When they do connect to our service, it would only be polite for us to reply to them, right. So we just send our reply back to the address they connected from, let&rsquo;s say Alice in Accounts at &ldquo;Customer A&rdquo;. Alice&rsquo;s computer has an IP address of &lsquo;10.100.100.1&rsquo; so we try and send our reply back to that address. But, unfortunately, the computer used by Peter in Personnel (HR doesn&rsquo;t start with a &ldquo;P&rdquo;) in the Provider also has an address of &lsquo;10.100.100.1&rsquo; so our network (the purple &ldquo;router&rdquo; in the diagram below) sends the reply we wanted to go back to Alice, to Peter instead.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide3.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide3_huc7b0878dbcbe6626eb53b6d8954b062f_135041_1920x0_resize_box_3.PNG" width="1920" height="1187" > </a> </figure> <p>So problem two is that if the customer connects to the provider from any address on their network which is in use anywhere in our Provider network, the service can&rsquo;t reply so the whole thing fails. We better add that to the list of things to fix!</p> <p>Again, for now, let&rsquo;s pretend we don&rsquo;t use Alice&rsquo;s &lsquo;10.100.100.1&rsquo; address in our Provider network, we then need to use our networking skills (and another good PM) to make sure we can route traffic from our service platform to Alice&rsquo;s address, back to the &ldquo;Customer A&rdquo; router so it can find it&rsquo;s way back to Alice. Here&rsquo;s what that looks like in a picture, where our Provider network knows that 10.1.x.x. 10.2.x.x, 10.3.x.x and 10.100.x.x all live behind the blue Customer-A router in our datacenter.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide4.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide4_hu1746612e170354dbbd7a0e461baf7196_94136_1920x0_resize_box_3.PNG" width="1920" height="1196" > </a> </figure> <p>So, as long as our customer doesn&rsquo;t use an address we are using, it&rsquo;s okay. Woohoo!</p> <p>Now, if the service is successful, we&rsquo;ll hopefully have more than one customer (which in the Provider world is known as &ldquo;a good thing&rdquo;), so let&rsquo;s introduce Bill from Billing (where else!) in &ldquo;Customer B&rdquo;. He uses his shiny new computer to connect to the Provider&rsquo;s portal to check something and (miraculously) his company doesn&rsquo;t use, so can also route to, those &lsquo;10.4.x.x&rsquo; addresses that the Provider uses. Great, obviously we want to reply to Bill (as we&rsquo;re nothing if not polite) so we carefully craft our reply and send it off to his &lsquo;10.100.100.1&rsquo; address. Hang on, that address seems familiar, right? It&rsquo;s the same one as Alice was using earlier. Oh no! Things were going well until this point. Now, how will our awesome service know which &lsquo;10.100.100.1&rsquo; address it should reply to?</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide5.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide5_hu89d7dc18b6ad76c30bd4ecd55794b5cf_163738_1920x0_resize_box_3.PNG" width="1920" height="1238" > </a> </figure> <p>Examining this problem more closely, we can extend our earlier problem two statement to &ldquo;if the customer connects to the provider from any address on their network which is in use anywhere in <strong>our</strong> Provider network <em>or, anywhere in <strong>any</strong> of our (connected) customers&rsquo; networks</em>, the service can&rsquo;t reply so the whole thing fails. <i class="fad fa-poo-storm fa-2x" data-fa-transform="down-6" style="color: brown"></i></p> <h3 id="summary">Summary</h3> <p>Connecting a Provider service, portal, API gateway etc. to the Internet is dangerous, but fairly straightforward. Connecting that same service to one or more Customer Wide Area Networks is not as dangerous because we know who our customers are, and, have a business relationship with them. That means they&rsquo;re <em>less</em> likely (<em>unless their network has been attacked or compromised</em> ) to attack our network. But, the simple fact that most of our customers and, potentially, our own networks, all use the same bunch of IP addresses makes the picture below much more difficult to actually build than this (heavily simplified) drawing suggests.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide6.PNG" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/images/Slide6_hueb3f84075657b846564e1371d603ad6b_140436_1920x0_resize_box_3.PNG" width="1920" height="844" > </a> </figure> <p>Okay, with the problems faced by both the Customer/Tenant and the Provider highlighted, in Part 2 of this series we&rsquo;ll look at the building blocks of a possible solution, and how they address each of the issues we identified in this post. See you there!</p> <p><a name="series"></a> <em>Posts in this series:</em></p> <ol> <li><a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/">Multi-Tenant WAN Access to Shared Resources: Part 1 - The Problem</a> (<em>this post</em>)</li> <li><a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/">Multi-Tenant WAN Access to Shared Resources: Part 2 - A Solution</a></li> <li><a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/">Multi-Tenant WAN Access to Shared Resources: Part 3 - Real Numbers</a></li> </ol>
Multi-Tenant WAN Access to Shared Resources: Part 2 - A Solution https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/ Thu, 19 Dec 2019 02:00:00 +0000 rss@notthe.blog (Steve Dockar) https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/
We have a thing on the Internet, lets connect it to our WAN customers! It went wrong! How can we fix it?
<p>In <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/">Part 1</a> of this series we looked at the problem Cloud Providers and their customers face when accessing provider services over their Wide Area Networks (WANs). In this second post in the series we&rsquo;ll explore a number of possible solutions. In some instances, services were designed from the beginning to face multiple tenant networks, each with possible overlapping address space. Where this is the case, we don&rsquo;t really need to &ldquo;design&rdquo; a solution, just ensure that our service, and the connectivity model which connects our tenant WAN environments to it, follows the way the service&rsquo;s designer envisioned it.</p> <p>In some cases of course, this isn&rsquo;t the case, and we need to hide the complexity of those overlapping customer networks from our service, so that we don&rsquo;t confuse or scare it. We&rsquo;ll look at both scenarios in this post.</p> <p>Before we start, in Part 1, we carefully engineered our customers&rsquo; and the Provider&rsquo;s networks so the service either worked, or, only exhibited one of the possible problems. This was done to introduce the issues in manageable bite-sized chunks. If you&rsquo;ve read that post, you&rsquo;re now, officially, an expert, so in this post, we&rsquo;re (as <a href="https://en.wikipedia.org/wiki/Emeril_Lagasse">Emeril</a> used to say) <em>kickin</em>&rsquo; it up a notch! In the examples in which we fix the various problems we identified in Part 1, we&rsquo;ll take a worse case scenario where <strong>each</strong> of our tenants <strong>and</strong> the Provider networks all use exactly the same addresses. Buckle up, things are gonna get bumpy!</p> <h2 id="dont-and-say-we-did">Don&rsquo;t and say we did</h2> <p>Sometimes, the best way to fix a problem is not to have it in the first place. Some software/hardware services are designed to face this issue without breaking sweat. The problem we&rsquo;re going to fix exists because the services in question only have one, single, network stack. That means they have no way to differentiate between multiple addressing schemas which <em>might</em> also overlap. Where services are designed to cope, architecturally, the model is usually something like the one in the diagram below.</p> <p>For clarity, we&rsquo;ll move the &ldquo;service&rdquo; from that big stack of servers top left, to its own space in the middle of the diagram.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide7.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide7_hu2c7c4692b695659f5c01e2574a77d39d_103752_1920x0_resize_box_3.png" width="1920" height="1010" > </a> </figure> <p>In the diagram, the dark box represents the natively multi-tenant service, for simplicity let&rsquo;s call it an &ldquo;appliance&rdquo;. On its left hand side there&rsquo;s a purple &ldquo;router&rdquo; which connects to the Provider&rsquo;s network. This is an independent <em>Routing</em> and <em>Forwarding</em> base within the appliance, just handling traffic to and from the Provider. On the other side, there&rsquo;s a similar setup, but in this case, one for each customer. In between the two, and here&rsquo;s where the magic happens, the application itself runs in a network space which is independent of all of the connected networks. This part of the appliance can send and receive traffic to or from all of them, without being tied to the network addressing of any of the connected networks. Pretty clever stuff!</p> <div class="in-post-callout"> <div class="callout-symbol"> <a><i class="far fa-lightbulb fa-3x"></i></a> </div> <div class="callout-text"> <p><em>An alternative approach is to fix the issue at Layer 2 instead of Layer 3. Instead of using the packet&rsquo;s source IP address to figure out how to route a reply, devices use the physical port that the connection came in through as the sign-post to the direction they should switch the reply back through. Usually in the Provider world this would be a L2 (datalink) interface with a VLAN ID to allow multiple connections on the same physical interface. A packet with source IP of 10.1.1.1 on VLAN 101 would be returned over VLAN 101 whereas one with the same source which came in on VLAN 102 would be returned over that VLAN and so on. <a href="https://www.f5.com">F5</a>&rsquo;s BigIP &ldquo;<a href="https://support.f5.com/csp/article/K13876">Auto Last Hop</a>&rdquo; feature is an example of this (although F5 KC Article <a href="https://support.f5.com/csp/article/K55225090">K55225090</a> suggests support for this, at least in VE is something you should check against the version you&rsquo;re running).</em></p> </div> </div> <p>The main challenge we&rsquo;re working so hard to overcome is when more than one network uses the same addresses as another. In Part 1 we saw that, although a bit more <em>dangerous</em>, the Internet doesn&rsquo;t add to this overlapping address malarkey. This means that we don&rsquo;t necessarily need another &ldquo;Internet router&rdquo; inside the appliance, instead, we can bring in the Internet through the Provider side as we saw in Part 1. To save you flicking back to that, here&rsquo;s what that would look like if we add it to the previous diagram.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide8.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide8_hu5f902943ecb0e23c3aeda3140f2e4198_143617_1920x0_resize_box_3.png" width="1920" height="932" > </a> </figure> <p>Internet access and the Provider networks don&rsquo;t clash, so we can deliver them both to the appliance on the same interface. In practice, this would be the Provider&rsquo;s networking specifically to do with delivering these types of services to the Internet, complete with firewalls, <abbr title="Intrusion Detection Systems">IDS</abbr>, <abbr title="Intrusion Protection Systems">IPS</abbr>, etc. and not all of their corporate IT networks or other sensitive parts of their infrastructure.</p> <p>Okay, so that&rsquo;s what the problem looks like in a solution where we err&hellip; don&rsquo;t actually err&hellip; have the problem. Say what? <i class="fal fa-surprise ntb-dark-text"></i> Actually, although seemingly a bit weird, that&rsquo;s no bad thing, as we now have a model that we can use to build our own solution against.</p> <h2 id="not-so-lucky">Not so lucky</h2> <p>It&rsquo;s no help knowing that some services don&rsquo;t have the problem if the service we have does. Actually, more often than not, services designed for the Internet or to be deployed to a single network will need help to operate in our multi-tenant Provider world. Typically, this means we need to connect the service to a network which doesn&rsquo;t suffer from this problem, and then, do the same for each of the connected customers WAN networks. Easy! Here&rsquo;s a diagram representing the solution (and I bet you were expecting another looooong <a class="ntb-dark-text"> <strong>NT.B</strong> </a> post right?).</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide9.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide9_hu0b9b115b313f7c360a76092f6e879d2a_77884_1920x0_resize_box_3.png" width="1920" height="1015" > </a> </figure> <h3 id="inside-the-black-box">Inside the black box</h3> <p>When we need to fix the problem ourselves, Network Address Translation (<a href="https://en.wikipedia.org/wiki/Network_address_translation">NAT</a>) is the usual go-to tool we reach for when we need to hide one network from another. &ldquo;<em>Just use NAT!</em>&rdquo; is a phrase which you can use to identify a real network engineer. Say that to them, and if they look like they just swallowed something <em>really</em> unpleasant, they&rsquo;re a network engineer! There&rsquo;s a maxim that holds true most of the time which is &ldquo;<em>Route if you can, NAT if you must</em>&rdquo;. Sadly, in this case <em>we must</em>. There are many explanations of NAT on the Internet (like the one in the link above), but for our purposes, NAT takes an IP packet with a Source and Destination address and port number, and lets us swap some, or all of them, for new values, usually following some rules that ensure we can keep track of what&rsquo;s going on. We can swap the source, destination or, in some cases, both, addresses and/or ports.</p> <p>Let&rsquo;s take a look at the flow from the first tenant, over their WAN, to the Provider&rsquo;s service. Fair warned, this time, we&rsquo;re going to change the addresses so that the customer is using the same addresses as the Provider. As the song says, if we can make it [work] here, we can make it [work] anywhere! Alice from Customer-A has been promoted, she&rsquo;s now in err.. Another Department and has a new PC whose IP address is &lsquo;10.1.1.1&rsquo;. Over in the Provider network, the new portal is live and, on the Provider&rsquo;s network its IP address is also &lsquo;10.1.1.1&rsquo;. If we were to color-code them for clarity, Alice has an <em>indigo</em> <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> whereas the Provider portal is a <em>plum</em> <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a>.</p> <p>Colors help us, but sadly IPv4 is color-blind and can&rsquo;t tell them apart. That means, Alice can&rsquo;t target the portal&rsquo;s real address. She has to connect to an address which makes sense on her network and doesn&rsquo;t clash with her or anyone else&rsquo;s address on <em>her network</em>. We&rsquo;ll need to ask the Customer A network admins to allocate some addresses which we can use to represent the Provider services in the customer network. Let&rsquo;s say they give us <a style="color: #1a4288"> <strong>&lsquo;10.2.2.x&rsquo;</strong> (&lsquo;10.2.2.0/24&rsquo;) </a> and from that we choose <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> for the portal. So now, Alice can connect to that and, (as we learned in Part 1, with the help of network engineers and a good Project Manager) we&rsquo;ll then route her traffic to the Customer-A router within the Provider&rsquo;s DC. As each packet flows through that router, we&rsquo;ll translate the &ldquo;destination&rdquo; address field (<abbr title="Destination NAT">DNAT</abbr>) in the packet from <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> to <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a>. We&rsquo;re not finished yet, but let&rsquo;s see what that looks like so far.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide10.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide10_hu52e298b6f4774c2b1f2be0d2955427ca_53638_1920x0_resize_box_3.png" width="1920" height="634" > </a> </figure> <p>So far, so good! We&rsquo;ve managed to route a packet from Alice to the portal, swapping colors.. I mean <em>addresses</em> (using &lsquo;NAT&rsquo;) as we go. We&rsquo;re currently NATing on the <em>Customer</em> router in the Provider&rsquo;s DC, as we need to translate the packets while they&rsquo;re still in the context of that customer&rsquo;s WAN. If we try and manage the NAT on the single <em>plum-colored</em> Provider router we&rsquo;d have probably lost the customer context before we got around to NATing anything. However, if you read Part 1 and are now an expert, you may spot a slight flaw in our otherwise awesome plan. Currently, although we&rsquo;ve made it possible for Alice to send a packet (or more than one) to the Portal, when the packet gets there and we want to try and reply to it, the <em>Source</em> address the packet came from is still Alice&rsquo;s <em>indigo</em> <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a>. we&rsquo;ll look to fix that in a moment, but before we do, there&rsquo;s another, slightly more hidden problem in what we&rsquo;ve got so far. This sneaky issue is going to try and bite us in a few places, so it&rsquo;s worth beating it into submission with a stick now, before it gets out of hand&hellip;</p> <h3 id="orders-are-orders">Orders are orders</h3> <p>Most network devices perform a mixture of roles. Routers are optimized for routing packets and managing the protocols that allow learning of network routing topologies, but, they can also filter packets (like a firewall) and NAT them too. Firewalls may be optimized for complex filtering rules or traffic analysis, but can also route and NAT too. What&rsquo;s common to all of these devices is that they will each have a specific sequence or &lsquo;order&rsquo; in which the steps are carried out. Take our NSX-T Edges for example. Traffic flowing from outside to inside is first NAT&rsquo;d, then subject to firewall rules and finally forwarded (routed) towards its next hop/destination. But, on the way back, the packet is first filtered (firewall rules), <em>then</em> NAT&rsquo;d and finally forwarded. Different direction, different order!</p> <p>Let&rsquo;s see that NSX-T <em>order of operation</em> laid out more clearly.</p> <div class="in-post-callout"> <div class="callout-symbol"> <a><i class="fad fa-shield fa-3x"></i></a> </div> <div class="callout-text"> <p><strong>[Outside]</strong> <i class="text-dark fas fa-arrow-alt-right"></i> NAT <i class="text-dark fas fa-arrow-alt-right"></i> Filter (<em>Firewall</em>) <i class="text-dark fas fa-arrow-alt-right"></i> Forward (<em>Route</em>) <i class="text-dark fas fa-arrow-alt-right"></i> <strong>[Inside]</strong> <br> <strong>[Outside]</strong> <i class="text-dark fas fa-arrow-alt-left"></i> Forward (<em>Route</em>) <i class="text-dark fas fa-arrow-alt-left"></i> NAT <i class="text-dark fas fa-arrow-alt-left"></i> Filter (<em>Firewall</em>) <i class="text-dark fas fa-arrow-alt-left"></i> <strong>[Inside]</strong></p> </div> </div> <p>Taking this as an example, if we were using one of our NSX-T T0/T1 Edges to perform the job of the tenant WAN router in the diagram, it would take the packet, translate (<em>NAT</em>) the destination from <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> to <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> then it would check its firewall rules to see if the packet is allowed (we&rsquo;ll assume it is) and then try and route the packet to &lsquo;10.1.1.1&rsquo;. But, err&hellip; <em>which</em> <strong>&lsquo;10.1.1.1&rsquo;</strong>? It now has one on each side!</p> <p>If the order of operation where route <strong>first</strong> and <strong>then</strong> NAT, we would decide the packet was heading (being <em>routed</em>) out towards the Provider Router (which we&rsquo;re still pretending is <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a>) first, then, once we&rsquo;d decided which interface to send the packet out of, we&rsquo;d swap the destination to <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> and away it would go towards the portal. As we&rsquo;re working on a worse case scenario here, we&rsquo;re going with the router in our diagram NATing before it routes, and that means we can&rsquo;t simply NAT to the Portal&rsquo;s <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> address because that address (without the pretty color) also exists on Alice&rsquo;s PC, which the router knows is in the opposite direction to the Portal. Aaargh!</p> <p><a id="NAT-good"></a>So NAT is an awesome tool, but it works best where the addresses used on either side of the NAT-ing device can&rsquo;t overlap. Like when we swap an rfc1918 address for a public Internet address when we connect to the some website on the Internet. In that case, we know that when we&rsquo;ve swapped our address the new one will only exist on the inside or the Internet but not both. Here, NATing between potentially overlapping rfc1918 addresses is fraught with danger!</p> <p>We&rsquo;ll come back to that in a moment, but first let&rsquo;s pretend for now that it&rsquo;s not a problem, and look at the Provider trying to reply.</p> <h3 id="the-right-to-reply">The right to reply</h3> <p>As we&rsquo;ve engineered this to be the worse case scenario, when the Provider portal tries to reply to Alice, it will send from its address of <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> to Alice&rsquo;s&hellip; oh, wait, no! It can&rsquo;t send to Alice&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> because colors don&rsquo;t count! We need to temporarily assign Alice an alternative address which is unique across the <em>Provider&rsquo;s</em> whole network. We also need to have the routing devices know that whatever this address is, we should <em>route</em> it towards the Customer-A WAN router. Let&rsquo;s just use some letters for now and call Alice <a style="color: #464547"> <strong>&lsquo;a.b.c.1&rsquo;</strong> </a>. It&rsquo;s okay for us to give Alice a temporary address so we can talk to her, but we need her to talk to us from this address first or we won&rsquo;t know it&rsquo;s her. This means we need to arrange to fix her incoming packets so they appear to come from her <em>temporary</em> address. Looks like we&rsquo;ll need more NATs! Let&rsquo;s take a look at that in a picture&hellip;</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide11.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide11_hue1f0dea5eab074fe32a262df5181d641_57948_1920x0_resize_box_3.png" width="1920" height="631" > </a> </figure> <p>In the picture above, we&rsquo;ve swapped Alice&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> destination to the Provider&rsquo;s real <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> address, and we&rsquo;ve also swapped her real <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> source for the Provider-allocated <a style="color: #7f35b2"> <strong>&lsquo;a.b.c.1&rsquo;</strong> </a> address. We&rsquo;ve also added a route to the Provider&rsquo;s network which says that &lsquo;a.b.c.x&rsquo; can be found through the Customer-A WAN router. Now that we&rsquo;ve hidden Alice&rsquo;s addresses from the Portal and vice-versa, we&rsquo;ll get a flow which should look like this.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide12.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide12_huc0185d94df442f57818f2fb776807571_73133_1920x0_resize_box_3.png" width="1920" height="735" > </a> </figure> <h3 id="lets-get-real">Let&rsquo;s get real</h3> <p>It works on this diagram, but, because of the <em>order of operation</em> challenge, it <strong>won&rsquo;t work</strong> in the real world. Let&rsquo;s examine why. Here&rsquo;s the diagram again, but this time with some handy-dandy numbers on (as we&rsquo;ve spared no expense in this post!), to help guide us. <i class="fas fa-exclamation-triangle ntb-dark-color"></i> Even when things fail, we&rsquo;ll ignore that and carry on, as that will give us a list of things to fix.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide13.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide13_huc2f7a6ad123d7e224a45607c6bf7bbe1_80945_1920x0_resize_box_3.png" width="1920" height="723" > </a> </figure> <p>Here&rsquo;s the flow, step by step. Remember, even when things break, we&rsquo;ll carry on as if they didn&rsquo;t.</p> <table> <thead> <tr> <th style="text-align:center">Step</th> <th>Action</th> <th>Result</th> <th style="text-align:center">State</th> </tr> </thead> <tbody> <tr> <td style="text-align:center">1</td> <td>Alice connects to her WAN&rsquo;s address for the portal - &lsquo;10.2.2.2&rsquo;.</td> <td>The packet with the original addresses in is sent over the WAN.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">2</td> <td>The packet, still with its original source and destination addresses arrives at the Customer-A WAN router</td> <td>The packet is passed to the NAT engine in the router</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">3</td> <td>On it&rsquo;s way through the router we swap (NAT) Alice&rsquo;s source <strong>and</strong> the Portal&rsquo;s destination addresses</td> <td>The translated packet needs routing to the new 10.1.1.1 destination, but that exists on both sides of the router.</td> <td style="text-align:center"><i class="fas fa-times" style="color: #ba0032"></i></td> </tr> <tr> <td style="text-align:center">4</td> <td>The translated packet is forwarded to the Provider router with it&rsquo;s new source and destination addresses</td> <td>The packet is routed to the portal.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">5</td> <td>The portal builds a reply packet using its own address (source) and the Alice&rsquo;s &lsquo;a.b.c.1&rsquo; address from the received packet (destination).</td> <td>The packet is forwarded to the Customer-A WAN router because of the route we added to the Provider router</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">6</td> <td>On it&rsquo;s way back through the Customer-A router, the packet has its source swapped to the &lsquo;10.2.2.2&rsquo; address Alice knows the Portal by, <strong>and</strong> its destination to Alice&rsquo;s real &lsquo;10.1.1.1&rsquo; address.</td> <td>Like in [3] we need to route to &lsquo;10.1.1.1&rsquo; but again, we have one on each side of the router.</td> <td style="text-align:center"><i class="fas fa-times" style="color: #ba0032"></i></td> </tr> <tr> <td style="text-align:center">7</td> <td>The packet is delivered back to Alice&rsquo;s &lsquo;10.1.1.1&rsquo; address, apparently from &lsquo;10.2.2.2&rsquo;</td> <td>The rest of Alice&rsquo;s connection follows the same sequence</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> </tbody> </table> <p>On reflection, we did pretty well and <em>almost</em> got it to work. Let&rsquo;s look at what&rsquo;s still on the glitch-list.</p> <ul> <li>[<strong>3.</strong>] We can&rsquo;t NAT Alice&rsquo;s packet&rsquo;s destination address to the real address of the Portal because that address exists on both sides of the NAT-ing router. <i class="fas fa-times" style="color: #ba0032"></i></li> <li>[<strong>6.</strong>] We can&rsquo;t NAT Alice&rsquo;s temporary destination address to <em>her</em> real address for the same reason as [3.] above. <i class="fas fa-times" style="color: #ba0032"></i></li> <li>[<strong>5.</strong>] (and [<strong>.3</strong>]) we need some sort of schema for allocating temporary addresses, potentially to lots of devices from lots of customers and <em>to</em> multiple Provider devices too. <i class="fas fa-exclamation-triangle ntb-yellow"></i> <br> <em>(Either that or wait for IPv7 and see if it supports Hex, Alphabetic or even colored addresses!)</em></li> </ul> <h3 id="we-have-a-dog-a-cat-a-mouse-and-a-rowing-boat">We have a dog, a cat, a mouse and a rowing boat</h3> <p>Remember <a href="#NAT-good">here</a> where we said that NAT was awesome as long as the same address(es) didn&rsquo;t exist on more than one side of a NAT device <abbr title="Even if you don't, just say you do and nobody will know any different!">? </abbr> Well, therein lies the secret to fixing this! A bit like the per connection <em>routers</em> in the <a href="#dont-and-say-we-did">black box example</a>, we need each of the networks to be completely independent of the others. We need a sort of &ldquo;no mans land&rdquo; in the middle (like the <a href="https://harrypotter.fandom.com/wiki/The_Cave">lake</a> in Harry Potter VI but without the lurking nasties), and we need to know how to cross it safely and get back. Kind of like this.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide14.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide14_hu7b0defa8c441653287286b21895b423b_197837_1920x0_resize_box_3.png" width="1920" height="1012" > </a> </figure> <p>You see here, packets arriving at the lake&rsquo;s shore are more worried about getting their bits wet than what&rsquo;s on the other side. While they&rsquo;re in a state of panic, we can NAT them to some &ldquo;<abbr title="Don't worry, we'll replace the lake addresses with some actual IP address in the next section. For now just think of them as not customer or provider addresses">lake</abbr>&rdquo; addresses (don&rsquo;t worry, I&rsquo;ll get bored of the water metaphor soon). Just like the earlier case where we gave Alice a temporary (&lsquo;a.b.c.1&rsquo;) address to ensure she didn&rsquo;t clash with anything on the provider network, here, we&rsquo;ll assign her (and anything else from the Customer-A WAN) a &ldquo;Customer-A lake&rdquo; address like &rsquo;la.ke.<strong>A</strong>.1&rsquo;, so she doesn&rsquo;t clash with anything else. We can also allocate the Provider a bunch of &ldquo;lake&rdquo; addresses to use for each of their components or services which customers will need to reach.</p> <p>When a packet leaves its origin, say Alice&rsquo;s PC, it will still need source and destination addresses which make sense on the Customer-A WAN. Let&rsquo;s say Alice&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> and the Portal&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a>. We shouldn&rsquo;t need Alice or her network engineer&rsquo;s (or their PM) to know about the scary lake, that nightmare lives in the Provider space but we do need to Source and Destination NAT (SNAT/DNAT) the packet somewhere, so we&rsquo;ll need a Provider-side Customer-A NAT device of some sort. There, we&rsquo;ll hide Alice&rsquo;s address behind a &ldquo;lake&rdquo; address and, we&rsquo;ll see which of our services she wants (oh, it&rsquo;s <em>the Portal</em> again) and swap her &lsquo;10.2.2.2&rsquo; destination for the portal&rsquo;s &ldquo;lake&rdquo; address. Now the packet is safely wrapped in &ldquo;lake&rdquo; addresses we can forward it across to the Provider&rsquo;s side of the lake.</p> <p><a id="natornot"></a> When the packet reaches the Provider&rsquo;s side, we&rsquo;re going to need more NATs, and, something to do the NAT-ing. This something will take the destination (&ldquo;lake&rdquo;) address and swap that for the portal&rsquo;s real address in the provider network (<a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a>). We can then decide to either leave Alice&rsquo;s &ldquo;lake&rdquo; source address and have the Provider network route all lake addresses back to the err&hellip; well lake. Or, we can also NAT Alice&rsquo;s lake source to a Provider-allocated rfc1918 address. Why go through this additional, and seemingly pointless step? Well, it depends on the range of addresses we choose to fill our lake from. We&rsquo;ll look at that choice shortly. In the meantime, here&rsquo;s a schematic of our solution so far.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide15.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide15_hue63da5a36fc8c3f977fbb0748c94b85c_198004_1920x0_resize_box_3.png" width="1920" height="1013" > </a> </figure> <p>We still need a WAN &ldquo;Customer Edge&rdquo; (CE) router for each customer (that&rsquo;s part of their WAN service) and we <em>might</em> be able to use that for some of the NATs, but erring on the side of caution, we&rsquo;ve got a WAN &lt;-&gt; Lake NAT device for each customer, and one for the Provider, all managed by the provider. Here&rsquo;s our Packet walk again, this time with the <em>lake</em> in it.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide16.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/images/Slide16_hu3ecb14667da2a6b43f57835326f801c2_194396_1920x0_resize_box_3.png" width="1920" height="574" > </a> </figure> <p>Here&rsquo;s the flow again, step by step. Fingers X&rsquo;d that nothing breaks this time!</p> <table> <thead> <tr> <th style="text-align:center">Step</th> <th>Action</th> <th>Result</th> <th style="text-align:center">State</th> </tr> </thead> <tbody> <tr> <td style="text-align:center">1</td> <td>Alice connects to her WAN&rsquo;s address for the portal - &lsquo;10.2.2.2&rsquo;.</td> <td>The packet with the original addresses in is sent over the WAN.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">2</td> <td>The packet, still with its original source and destination addresses arrives at the Customer-A WAN router</td> <td>The packet is passed to the Provider managed &ldquo;Customer-A&rdquo; NAT engine</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">3</td> <td>On it&rsquo;s way through, we swap (NAT) Alice&rsquo;s source (to &rsquo;la.ke.a.1&rsquo;) <strong>and</strong> the Portal&rsquo;s destination (to &rsquo;la.ke.p.1&rsquo;) addresses</td> <td>The translated packet needs routing to Provider portal&rsquo;s &ldquo;lake&rdquo; address which only exists on the other side of the lake.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">4</td> <td>The packet has its destination NAT&rsquo;d to the <em>real</em> ( &lsquo;10.1.1.1&rsquo;) address of the portal</td> <td>The packet is forwarded towards the portal.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">5</td> <td>The packet&rsquo;s source and destination are unique within the Provider network</td> <td>The packet routes correctly to the portal</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">6</td> <td>The portal builds a reply packet using its own address (source) and the Alice&rsquo;s &rsquo;la.ke.a.1&rsquo; address from the received packet (destination).</td> <td>The packet is forwarded to the Provider NAT engine because of the route we added to the Provider router</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">7</td> <td>On it&rsquo;s way back through the Provider NAT engine, the packet has its source swapped to the portal&rsquo;s &rsquo;la.ke.p.1&rsquo; address.</td> <td>As in [3] Alice&rsquo;s &rsquo;lake&rsquo; address now only exists on one side of the lake so the packet routes back correctly.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">8</td> <td>Before we send the packet back to the Customer-A WAN we need to get rid of all this &rsquo;lake&rsquo; stuff, so we NAT both source and destination addresses</td> <td>Once the packet has Customer-A WAN addresses again, it can be sent to the Customer-A WAN router in the Provider DC</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">9</td> <td>As the packet has Customer-A WAN addresses again, it can be forwarded back to Alice</td> <td>With Alice&rsquo;s real destination address, the packets route correctly to her site on the WAN</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">10</td> <td>The packet is delivered back to Alice&rsquo;s &lsquo;10.1.1.1&rsquo; address, apparently from &lsquo;10.2.2.2&rsquo;</td> <td>The rest of Alice&rsquo;s connection follows the same sequence</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> </tbody> </table> <p>So, this time we made it all the way to the end of the flow without a single &lsquo;<i class="fas fa-times" style="color: #ba0032"></i>&rsquo; - Woohoo! If we can find some addresses to replace the stupid <em>lake</em> metaphor, we&rsquo;ll be able to build a real solution. When we do that, we should also stress test it with Bill over at Customer-B who, as you might have guessed also has a new computer and his IP address is, of course, <a style="color: #78BE20"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a>!</p> <div class="in-post-callout"> <div class="callout-symbol"> <a><i class="far fa-lightbulb fa-3x"></i></a> </div> <div class="callout-text"> <p>If you read that and it all sounds familiar (or if you skipped it and just want the TL;DR), that&rsquo;s because it is. If Alice connected to the Provider&rsquo;s portal over the Internet we&rsquo;d see exactly the same process. Don&rsquo;t connect two rfc1918 networks together, that&rsquo;s like <a href="https://en.wikipedia.org/wiki/Proton_pack">crossing the streams</a>. Instead, we connect from Alice&rsquo;s private network to the Internet at one end, and back to the Provider&rsquo;s private network on the other. The subtle difference is that in this case, Alice simply targets the Internet address (via DNS lookup of the portal domain name of course) directly. She doesn&rsquo;t have to connect to a <em>fake</em> internal address to force the connection over the Customer-A WAN. But, other than that, it&rsquo;s a very similar model.</p> </div> </div> <h2 id="its-a-wrap">It&rsquo;s a wrap</h2> <p>Go us! - We made it work. Let&rsquo;s recap where we&rsquo;ve got to and take a moment to let our headaches calm down before we head off to Part 3. In this post, we&rsquo;ve finally managed to get a packet from a customer device (Alice&rsquo;s PC) all the way to the Provider portal even though they both had the same IP address. We worked out that although NAT was part of the solution, you can&rsquo;t <em>safely</em> NAT between two networks connected to the same device unless (as it the case with your network and the public Internet), the two networks do not have any overlapping addresses. We learned that this was in part because there&rsquo;s the potential for a device to NAT first, and then route/forward, and this breaks when the new address exists somewhere on both sides.</p> <p>Finally, we were subjected to that stupid lake metaphor to illustrate that NAT will work as long as we go from Customer to unique addresses first, then unique addresses to Provider (or vice-versa). In this way, isolating both Customer and Provider networks from each other (with the &rsquo;lake&rsquo; addresses) stops NAT from trying to bite us. All we need now is a practical example that we can use to do this in the real world, and to see if it will work when: <code>No_of_Customers &gt; 1</code>.</p> <p>Let&rsquo;s keep our fingers crossed that all of that turns up in Part 3!</p> <p><a id="series"></a> <em>Posts in this series:</em></p> <ol> <li><a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/">Multi-Tenant WAN Access to Shared Resources: Part 1 - The Problem</a></li> <li><a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/">Multi-Tenant WAN Access to Shared Resources: Part 2 - A Solution</a> (<em>this post</em>)</li> <li><a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/">Multi-Tenant WAN Access to Shared Resources: Part 3 - Real Numbers</a></li> </ol>
Multi-Tenant WAN Access to Shared Resources: Part 3 - Getting Real https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/ Thu, 19 Dec 2019 09:03:00 +0000 rss@notthe.blog (Steve Dockar) https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/
We have a thing on the Internet, lets connect it to our WAN customers! It went wrong! Theory is fine, but how can we really fix it?
<p>In the first two posts of this <a href="https://notthe.blog/series/multi-tenant-wan-access">series</a> we looked at what could possibly go wrong when we tried to connect a service designed to face the Internet, to not one, not many, but lots of customers&rsquo; wide area networks (WANs). We learned that NAT was a great tool, but that it was only part of the solution. We also learned that to connect two networks which use the same addresses, we need an intermediate set of addresses to hide the two networks from each other. In this post, we&rsquo;ll find some suitable addresses for that intermediate stage, and look at the scaling of this model for multiple customers connecting to multiple services.</p> <p>Let&rsquo;s just recap a couple of the points from that last paragraph in pictures, as it will set us up nicely to design a working solution. First, in the picture below, we&rsquo;re using a single routing device / Gateway to both NAT packets and interconnect the various networks. This would be convenient for a Provider as they could manage all this complex networking malarkey in one place, except we learned in the last post that this won&rsquo;t work. The reason was that, although NAT swaps from (potentially overlapping) customer networks to something coordinated by the Provider, on the way back, when we (un)NAT back to real addresses, that single routing device needs to send the packets back to the correct customer network which it can&rsquo;t do when faced with multiple &lsquo;10.1.1.1s&rsquo; in different customer networks! The red circle is the gateway&rsquo;s view into all the connected networks and their potentially overlapping address ranges.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide17.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide17_hufc6d1b92eed189e5d8a25db5e8ad9bbe_105298_1920x0_resize_box_3.png" width="1920" height="867" > </a> </figure> <p>In order to overcome that problem, we need to make sure that, by the time we&rsquo;re un-NATing the packet back to its real addresses, the routing/(un)NATing device only sees one pesky &lsquo;10.1.1.1&rsquo;. In practice, this means we have to route to a per-customer NATing device before we lose track of which customer we&rsquo;re trying to get to. That means we need a solution like this, with that stupid <em>lake</em> from the last post replaced by some real networking which for now we&rsquo;ll <abbr title="colour">color</abbr> orange and call <em>intermediate network</em> (or &ldquo;<em>lake</em>&rdquo; for short <i class="fad fa-grin-squint-tears ntb-dark-text"></i>).</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide18.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide18_hu0f481ae704555174106495205857b71a_106698_1920x0_resize_box_3.png" width="1920" height="864" > </a> </figure> <p>In the diagram above, whichever way we&rsquo;re crossing the <em>intermediate network</em>, we hide our real addresses behind temporary <em>intermediate addresses</em> (<em>lake</em> was way shorter to type.. just sayin&rsquo;&hellip;) and make our routing decision by sending the traffic to the <em>intermediate network</em> address of the destination NAT device. Once we&rsquo;re safely in the NAT device for the destination network, we can dump ( <em>un</em>-NAT) our temporary <em>intermediate addresses</em> and set off across the destination network as if nothing happened. This time, where the red circles cross networks, each NAT device can see only its connected network and the shared intermediate one.</p> <p>Think of the network packet like Tom Cruise leaving the IMF safe house and running through a crowded eastern European city. Dashing into the (equally crowded) railway station, pausing just long enough to rip off his false rubber nose and &ldquo;I&rsquo;m in disguise&rdquo; glasses, before nonchalantly boarding the <abbr title="2:10pm">14:10</abbr> to Paris Gare du Nord and heading to the restaurant car to order a fine Chablis. All, while the MI(<code>longINT</code>) theme music starts to play. Anyhoo, I digress (and wine would make the packets all soggy), so back to the network stuff&hellip;</p> <p>In that last diagram, even if multiple customers and/or the Provider use the same addresses anywhere in their networks, no single device will see more than one of them. The only other thing the NAT devices will need to connect to, is the <em>intermediate</em> network and its addresses. In the first post when we contrived to make the solution work (impractically) by not having any addresses overlap between the various networks, we saw how choosing &lsquo;10.1.1.x&rsquo; would be a bad idea because everybody else was likely to choose it somewhere in their network too. In all seriousness (okay, just briefly), where do we get addresses that will work for our intermediate network and not clash with any customer network..?</p> <h2 id="to-bravely-choose-what-nobody-chose-before">To bravely choose what nobody chose before</h2> <p>There are three subnets reserved in our old friend <a href="https://tools.ietf.org/html/rfc1918">rfc1918</a>. There&rsquo;s &lsquo;192.168.0.0/16&rsquo; (or &lsquo;192.168.x.x&rsquo;) which we often find in consumer level networking devices. Then there&rsquo;s the more industrial strength &lsquo;10.0.0.0/8&rsquo; (or &lsquo;10.x.x.x&rsquo;) which we often see in enterprise and Service Provider networks. The third subnet it slightly different and not so easy to simply drop &lsquo;x&rsquo; into. It&rsquo;s &lsquo;172.16.0.0/12&rsquo;. As the slash-twelve doesn&rsquo;t fall nicely on an octet boundary like slash-eight and slash-sixteen, this range is &lsquo;172.16.x.x&rsquo;, &lsquo;172.17.x.x&rsquo; all the way up to &lsquo;172.31.x.x&rsquo;. The subnets from &lsquo;172.32.x.x&rsquo; upwards aren&rsquo;t included in the reserved range so shouldn&rsquo;t be used in private networks. According to the <abbr title="American Registry for Internet Numbers">ARIN</abbr> <a href="https://whois.arin.net/rest/net/NET-172-32-0-0-1/pft?s=172.32.0.0">search below</a>, &lsquo;172.32(.x.x)-172.63&rsquo; belongs to T-Mobile US, and if we bothered to search further, we&rsquo;d find out who the rest of the range belongs to.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/arin172-32.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/arin172-32_hua0f0f95af511015a2b4e05e094d07350_48978_0x480_resize_box_3.png" width="543" height="480" > </a> </figure> <p>That said, there are corporate networks out there I&rsquo;m sure, who allocated &lsquo;172.(16-31).x.x&rsquo; to their remote locations and carried on through &lsquo;172.32.x.x&rsquo; and beyond. We should keep this in mind whenever we plan for <em>addresses customers might use</em>.</p> <p>We could choose some addresses from RFC1918 and <em>hope</em> nobody else is using them, but that&rsquo;s not exactly something we want to put our name against in the project Risk Register! What we need are some IP addresses that nobody is (or at least <em>should be</em>) using in their network and that&rsquo;s big enough to scale to allow for many, or even lots, of customers. What we really need are some <a href="https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml">special IPv4 addresses</a>.</p> <p>Checking out the IANA table in (conveniently) that link, it turns out that there are a bunch of special ranges, included in which, are a couple of likely candidates we can potentially use.</p> <p>Let&rsquo;s take a look at a couple from the IANA IPv4 Special Registery! <a id="iana-special"></a></p> <table> <thead> <tr> <th>Address Block</th> <th>Name</th> <th style="text-align:center">RFC</th> <th style="text-align:center">Term&rsquo;n Date</th> <th style="text-align:center">SRC</th> <th style="text-align:center">DST</th> <th style="text-align:center">Fwd-able</th> <th style="text-align:center">Globally Reachable</th> <th style="text-align:center">Reserved-by-Protocol</th> </tr> </thead> <tbody> <tr> <td><strong>169.254.0.0/16</strong></td> <td>Link Local</td> <td style="text-align:center"><a href="https://tools.ietf.org/html/rfc3927">RFC3927</a></td> <td style="text-align:center">N/A</td> <td style="text-align:center">True</td> <td style="text-align:center">True</td> <td style="text-align:center">False</td> <td style="text-align:center">False</td> <td style="text-align:center">True</td> </tr> <tr> <td><strong>100.64.0.0/10</strong></td> <td>Shared Address Space</td> <td style="text-align:center"><a href="https://tools.ietf.org/html/rfc6598">RFC6598</a></td> <td style="text-align:center">N/A</td> <td style="text-align:center">True</td> <td style="text-align:center">True</td> <td style="text-align:center">True</td> <td style="text-align:center">False</td> <td style="text-align:center">False</td> </tr> </tbody> </table> <p>Let&rsquo;s take a look at each in turn.</p> <h3 id="those-weird-1692540016-addresses">Those weird 169.254.0.0/16 addresses</h3> <p>&lsquo;169.254.0.0/16&rsquo;, Link Local or sometimes &ldquo;Automatic Private IP Allocation&rdquo; (APIPA) is the range of addresses which a device will fall back to when it had neither a statically configured IP address on an interface or a reachable DHCP server from which to request one. You may have seen them in action when you&rsquo;re enjoying the feeling that comes from forgetting to plug the Ethernet cable in, or not clicking &ldquo;Connect&rdquo;, on that new Windows virtual machine. (Just mentioning that for a friend you understand&hellip;)</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/VMnicConnect.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/VMnicConnect_hu9d0aeac173b889acf84906447b3ea63a_26737_0x774_resize_box_3.png" width="2122" height="774" > </a> </figure> <p>The RFC defines how a device should choose its own Link Local address and what to do if another device is already using it. The things which make this suitable for our use (at least at this point in our assessment) is that those addresses are not globally reachable (just like the RFC1918 addresses), or forwardable. This means that even if they are in use in a Customer&rsquo;s network somewhere, we should never see them being sent over the WAN to our interconnection.</p> <p>&ldquo;<em>Forwardable</em> = False&rdquo; might be an issue though, as strictly speaking these addresses shouldn&rsquo;t be forwarded across <em>any</em> routing device, but contained within a single physical or logical network. Arguably, we&rsquo;re not forwarding them. They&rsquo;re being allocated to the (translated packets of the) NAT device and then sent on to a local link to another (NAT) device on that same network. With a good legal team, we could probably get away with that in court. However, section <a href="https://tools.ietf.org/html/rfc3927#section-1.6">1.6</a> of the RFC states that &ldquo;<em>addresses in the 169.254/16 prefix SHOULD NOT be configured manually or by a DHCP server</em>&rdquo; Wow, <strong>SHOULD NOT</strong>. It&rsquo;s not as definitive as <strong>MUST NOT</strong>, but it is pretty close. Again, we&rsquo;re not manually configuring or using DHCP, we&rsquo;re using NAT, so we <em>might</em> get away with that defense.</p> <p>Back in <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/#natornot">Part 2</a> we left a hanging &ldquo;<em>We can then <strong>decide</strong> to either leave Alice&rsquo;s “lake” source address and have the Provider network route all lake addresses back</em>&rdquo;. Looking at the diagram below, we can see that, if we stick (moderately) closely to the RFC3927, the extent of the Link Local addresses doesn&rsquo;t get us out of the NAT devices on the interface opposite the intermediate networks. If we use the &lsquo;169.254.x.x&rsquo; addresses, we can&rsquo;t route them past the NAT devices.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide19.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide19_hu80a28b52e121b511899242ea542b32f0_109127_1920x0_resize_box_3.png" width="1920" height="852" > </a> </figure> <p>On the customer side, this isn&rsquo;t an issue, because whatever addresses we use in the intermediate network, as packets leave on the customer side, we have to swap back the customer&rsquo;s real destination (so we can reach their device), <em>and</em> the source address back to the one from their network which they used to represent our service.</p> <p>However at the Provider end, using those &lsquo;169.254.x.x&rsquo; addresses means the &ldquo;decision&rdquo; above is kind of made for us. As packets leave the NAT device for the Provider network, we already have to <abbr title="Destination NAT">DNAT</abbr> the real address of the Portal or service in order to reach it. If we leave the &lsquo;169.254.x.x&rsquo; source address we used to cross the intermediate network, any router in the Provider network <em>should</em> refuse to forward the packet. I say should, because in some cases it is possible to amend the default behavior of a Linux-based routing device to <em>bend</em> this rule a little.</p> <p><em>Possible</em> is not the same as <em>advisable</em> though. We should probably stay away from rule-bending and just NAT both source and destination addresses of the packet as it crosses the Provider network. This does mean that as well as coordinating the NATs in and out of the intermediate network (so which customer WAN gets which 169.254.x.x addresses), we now have to have some RFC1918 addresses on hand to temporarily assign to the customers&rsquo; packets as they cross the provider network.</p> <p>We do need to make sure these temporary addresses are unique within the Provider network, but we don&rsquo;t have to care about any of the customer networks as these temporary addresses will never be seen beyond the Provider network. Similarly, if the same addresses happen to be in use in a customer network, we&rsquo;ll never see those beyond the NAT device at the customer side of the intermediate network, so we&rsquo;re all good on that score too. <i class="fas fa-thumbs-up ntb-dark-text"></i></p> <p>Let&rsquo;s take a look at a packet trace using 169.254.x.x&rsquo; addresses. We will need an address in that range for every possible address in the Provider network that a customer will connect to. This could be discrete devices, load balanced VIPs, secondary addresses on devices or similar. We&rsquo;ll grab the top end of the range for the Provider network. In the intermediate network, <a style="color: #f8981d"> &lsquo;169.254.<strong>[255]</strong>.x&rsquo; </a> will route to the Provider network NAT device, and there, we&rsquo;ll assign individual NATs to each endpoint that a customer will connect to.</p> <p>In this example:</p> <ul> <li>We&rsquo;ll make the portal&rsquo;s real address <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> and hide it behind <a style="color: #f8981d">&rsquo;<strong>169.254.255.1</strong>&rsquo;</a> from the <a style="color: #f8981d">&lsquo;169.254.255.x&rsquo;</a> range on the intermediate network.</li> <li>Customer A is the first customer to ride this roller coaster, so we&rsquo;ll give them <a style="color: #f8981d">&lsquo;169.254.<strong>[1]</strong>.x&rsquo;</a> from the intermediate network address pool.</li> <li>Alice from Customer A is back (Yay!) and she&rsquo;s still <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong>. </a> She&rsquo;s connecting to what she thinks of as the Provider&rsquo;s portal on <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> within the Customer A WAN, that the network engineers (and long suffering PM) have routed to the WAN CE router in the Provider&rsquo;s DC.</li> <li>When Alice is crossing the intermediate network, we&rsquo;ll swap her <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> source address for <a style="color: #f8981d"> <strong>&lsquo;169.254.1.1&rsquo;</strong> </a>. At the same time, we&rsquo;ll swap the portal&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> destination address for its <a style="color: #f8981d">&rsquo;<strong>169.254.255.1</strong>&rsquo;</a> intermediate network address.</li> <li>As we can&rsquo;t route these temporary intermediate network addresses across the Provider network, we&rsquo;ll allocate some Provider addresses to hide them. Let&rsquo;s stick with the upper end, and allocate <a style="color: #7f35b2"> &lsquo;10.255.x.x&rsquo; </a> and from that <a style="color: #7f35b2"> &lsquo;10.255.<strong>[1]</strong>.x&rsquo; </a> to Customer A and <a style="color: #7f35b2"> <strong>&lsquo;10.255.1.1&rsquo;</strong> </a> to Alice.</li> <li>In the Provider network, we route these new <a style="color: #7f35b2"> &lsquo;10.255.x.x&rsquo; </a> addresses back to our intermediate network NAT device.</li> <li>Everything starts with Alice, so she&rsquo;s on the left, and the Provider is on the right.</li> </ul> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide20.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide20_hue738825736951d5f36e8cc897bb402ae_124798_1920x0_resize_box_3.png" width="1920" height="566" > </a> </figure> <p>Here&rsquo;s the flow again, step by step. Fingers X&rsquo;d that everything still works!</p> <table> <thead> <tr> <th style="text-align:center">Step</th> <th>Action</th> <th>Result</th> <th style="text-align:center">State</th> </tr> </thead> <tbody> <tr> <td style="text-align:center">1</td> <td>Alice connects to her WAN&rsquo;s address for the portal - &lsquo;10.2.2.2&rsquo;.</td> <td>The packet with the original addresses in is sent over the WAN.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">2</td> <td>The packet, still with its original source and destination addresses arrives at the Customer-A WAN router</td> <td>The packet is passed to the Provider managed &ldquo;Customer-A&rdquo; NAT engine</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">3</td> <td>On it&rsquo;s way through, we swap (NAT) Alice&rsquo;s source (to &lsquo;169.254.1.1&rsquo;) <strong>and</strong> the Portal&rsquo;s destination (to &lsquo;169.254.255.1&rsquo;) <em>intermediate</em> addresses</td> <td>The translated packet needs routing to the Provider portal&rsquo;s <em>intermediate</em> address which only exists on the other side of the <em>intermediate network</em>.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">4</td> <td>The packet has its destination NAT&rsquo;d to the <em>real</em> ( &lsquo;10.1.1.1&rsquo;) address of the portal <strong>and</strong> it&rsquo;s source NAT&rsquo;d to Alice&rsquo;s temporary Provider network address (&lsquo;10.255.1.1&rsquo;).</td> <td>The packet is forwarded towards the portal.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">5</td> <td>The packet&rsquo;s source and destination are unique within the Provider network</td> <td>The packet routes correctly to the portal</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">6</td> <td>The portal builds a reply packet using its own address (source) and the Alice&rsquo;s &lsquo;10.254.1.1&rsquo; temporary Provider network address from the received packet (destination).</td> <td>The packet is forwarded to the Provider NAT engine because of the route we added to the Provider router</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">7</td> <td>On it&rsquo;s way back through the Provider NAT engine, the packet has its source swapped to the portal&rsquo;s &lsquo;169.254.255.1&rsquo; and destination to Alice&rsquo;s &lsquo;169.254.1.1&rsquo; <em>intermediate</em> addresses.</td> <td>As in [3] Alice&rsquo;s &lsquo;169.254.1.x&rsquo; address now only exists on one side of the <em>intermediate network</em> so the packet routes back correctly.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">8</td> <td>Before we send the packet back to the Customer-A WAN we need to get rid of all this &lsquo;<del>lake</del> <em>intermediate network</em>&rsquo; stuff, so we NAT both source and destination addresses</td> <td>Once the packet has Customer-A WAN addresses again, it can be sent to the Customer-A WAN router in the Provider DC</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">9</td> <td>As the packet has Customer-A WAN addresses again, it can be forwarded back to Alice</td> <td>With Alice&rsquo;s real destination address, the packets route correctly to her site on the WAN</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">10</td> <td>The packet is delivered back to Alice&rsquo;s &lsquo;10.1.1.1&rsquo; address, apparently from &lsquo;10.2.2.2&rsquo;</td> <td>The rest of Alice&rsquo;s connection follows the same sequence</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> </tbody> </table> <p>Woohoo! - Wow, that was an edge of the seat ride for sure!</p> <p><a id="sub-optimal"></a> Okay, so that worked, but there were a couple of <em>sub-optimal</em> elements in there. First, although we didn&rsquo;t exactly break any rules, we&rsquo;re not really using those addresses as they were intended in the RFC document. Secondly, we couldn&rsquo;t route those intermediate addresses across the Provider network, so we had to do yet more NATs. If you remember back to Part 1 all those coffees (or stronger beverages) ago, we said something like &ldquo;<em>and NAT if you must</em>&rdquo;. We still <em>must</em> here, but if NATing isn&rsquo;t great, NATing multiple times is probably worse right? So, having used these RFC3927 addresses as a learning exercise, let&rsquo;s move on and try find a better solution.</p> <h3 id="what-the-heck-is-a-1006400-addresses-and-just-how-big-is-a-10">What the heck is a 100.64.0.0 addresses and just how big is a /10</h3> <p>What would be really cool would be if somebody had realized that with the advent of mass IPv4 adoption, there would be times when different networks would crash into each other, and worked out a way to make it less painful. Enter <a href="https://tools.ietf.org/html/rfc6598">RFC6598</a> stage-left (or is it just Tom Cruise with another disguise?). Shared Address Space or, &ldquo;Carrier Grade NAT&rdquo; (CGN) as it&rsquo;s often known, is a reservation of IPv4 addresses put aside for Carriers (or Providers in our case) to slip in between large networks whose native addresses can&rsquo;t be used directly. Sounds familiar right? Well, once again, we&rsquo;re not quite sticking to the letter of the <del>law</del> RFC here. There&rsquo;s a note in the Introduction of RFC6598 which says:</p> <div class="sideline-textbox" > <em>In particular, Shared Address Space can only be used in Service Provider networks or on routing equipment that is able to do address translation across router interfaces when the addresses are identical on two different interfaces.</em> </div> <p>Now we might have that (see <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/#dont-and-say-we-did">Don&rsquo;t and say we did</a> in Part 2), but in these examples, we&rsquo;re working on the basis that we can&rsquo;t do all our NATing in one place because of that order of operation gotcha that we found. However, our issue is still pretty much the same, so we&rsquo;ll roll with it for now, work on the assumption that that note was a capability constraint rather than a functional requirement and hope nobody notices&hellip;</p> <p>Okay, so what are the advantages of using these addresses instead of the <em>Link Local</em> ones in the last section? Well, for one, there are lots of them, err.. addresses that is. To answer the &ldquo;just how big is a /10&rdquo; question, the range goes from &lsquo;100.64.x.x&rsquo; right up to &lsquo;100.127.x.x&rsquo;! Whichever way you slice and dice that, it&rsquo;s a lot of addresses. We&rsquo;ll look at allocating chunks of address space in more detail soon, but for now, you could allocate an entire /16 to over 60 different sites, which would give space for more than 60,000 individual Alices, Bills and Peters, in each site!</p> <p>The second advantage is that, as per the <a href="#iana-special">table</a> above, although not &ldquo;Globally Reachable&rdquo; these addresses are &ldquo;Forwardable&rdquo;. That makes them more like RFC1918 addresses than those &lsquo;169.254&rsquo; addresses, in that the Provider can route them around their network, but they can&rsquo;t be used over the Internet. Or, at least we&rsquo;d hope, coming in from a customer&rsquo;s WAN. That means that where, in the last example, we had to take customer traffic, NAT it to Intermediate Network addresses, then NAT it to Provider <em>temporary</em> addresses (because <em>Link Local</em> addresses shouldn&rsquo;t be forwarded), using these &lsquo;100.64&rsquo; addresses means we can skip that last NAT. If we <abbr title="Swap all the '169.254's for 100.64's"><code>sed s/169.254/100.64/</code></abbr> that last packet flow example, we&rsquo;ll end up with this.</p> <ul> <li>We&rsquo;ll make the portal&rsquo;s real address <a style="color: #7f35b2"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> and hide it behind <a style="color: #f8981d">&rsquo;<strong>100.64.255.1</strong>&rsquo;</a> from the <a style="color: #f8981d">&lsquo;100.64.255.x&rsquo;</a> range on the intermediate network.</li> <li>Customer A is the first customer to ride this roller coaster, so we&rsquo;ll give them <a style="color: #f8981d">&lsquo;100.64.<strong>[1]</strong>.x&rsquo;</a> from the intermediate network address pool.</li> <li>Alice from Customer A is still here, and she&rsquo;s still <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong>. </a> She&rsquo;s (still valiantly) connecting to what she still thinks of as the Provider&rsquo;s portal on <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> within the Customer A WAN, that the network engineers (and long suffering PM) had long ago routed to the WAN CE router in the Provider&rsquo;s DC.</li> <li>When Alice is crossing the intermediate network, we&rsquo;ll swap her <a style="color: #1a4288"> <strong>&lsquo;10.1.1.1&rsquo;</strong> </a> source address for <a style="color: #f8981d"> <strong>&lsquo;100.64.1.1&rsquo;</strong> </a>. At the same time, we&rsquo;ll swap the portal&rsquo;s <a style="color: #1a4288"> <strong>&lsquo;10.2.2.2&rsquo;</strong> </a> destination address for its <a style="color: #f8981d">&rsquo;<strong>100.64.255.1</strong>&rsquo;</a> intermediate network address.</li> <li><del>As we can&rsquo;t route temporary intermediate network addresses across the Provider network, we&rsquo;ll allocate some Provider addresses to hide them.</del> We don&rsquo;t need to do this as we <em>can</em> forward <abbr title="Carrier Grade NAT - These 100.64 addresses!">CGN</abbr> addresses.</li> <li>In the Provider network, we route these <a style="color: #f8981d"> &lsquo;100.64.x.x/10&rsquo; </a> addresses back to our intermediate network NAT device.</li> <li>Everything, as usual starts with Alice, so she&rsquo;s <em>still</em> on the left, and the Provider is <em>still</em> on the right.</li> </ul> <p>Okay, let&rsquo;s take a look at the new packet walk&hellip;</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide21.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide21_huf42203071b783e7fcf8f3c7c2afaa791_125302_1920x0_resize_box_3.png" width="1920" height="567" > </a> </figure> <p>Here&rsquo;s the flow again, step by step, hopefully for the last time! Fingers X&rsquo;d that everything <em>still</em>, still works!</p> <table> <thead> <tr> <th style="text-align:center">Step</th> <th>Action</th> <th>Result</th> <th style="text-align:center">State</th> </tr> </thead> <tbody> <tr> <td style="text-align:center">1</td> <td>Alice connects to her WAN&rsquo;s address for the portal - &lsquo;10.2.2.2&rsquo;.</td> <td>The packet with the original addresses in is sent over the WAN.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">2</td> <td>The packet, still with its original source and destination addresses arrives at the Customer-A WAN router</td> <td>The packet is passed to the Provider managed &ldquo;Customer-A&rdquo; NAT engine</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">3</td> <td>On it&rsquo;s way through, we swap (NAT) Alice&rsquo;s source (to &lsquo;100.64.1.1&rsquo;) <strong>and</strong> the Portal&rsquo;s destination (to &lsquo;100.64.255.1&rsquo;) <em>intermediate</em> addresses</td> <td>The translated packet needs routing to the Provider portal&rsquo;s <em>intermediate</em> address which only exists on the other side of the <em>intermediate network</em>.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">4</td> <td>The packet has its destination NAT&rsquo;d to the <em>real</em> ( &lsquo;10.1.1.1&rsquo;) address of the portal <del>and it&rsquo;s source NAT&rsquo;d to Alice&rsquo;s temporary Provider network address</del>. (Oh no it doesn&rsquo;t!)</td> <td>The packet is forwarded towards the portal.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">5</td> <td>The packet&rsquo;s source and destination are unique within the Provider network</td> <td>The packet routes correctly to the portal</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">6</td> <td>The portal builds a reply packet using its own address (source) and the Alice&rsquo;s &lsquo;100.64.1.1&rsquo; <em>intermediate</em> network address from the received packet (destination).</td> <td>The packet is forwarded to the Provider NAT engine because of the route we added to the Provider router</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">7</td> <td>On it&rsquo;s way back through the Provider NAT engine, the packet has its source swapped to the portal&rsquo;s &lsquo;100.64.255.1&rsquo; <em>intermediate</em> address, but its destination is already/still Alice&rsquo;s &lsquo;100.64.1.1&rsquo; <em>intermediate</em> address.</td> <td>As in [3] Alice&rsquo;s &lsquo;100.64.1.x&rsquo; address now only exists on one side of the <em>intermediate network</em> so the packet routes back correctly.</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">8</td> <td>Before we send the packet back to the Customer-A WAN we need to get rid of all this &lsquo;<em>intermediate network</em>&rsquo; stuff, so we NAT both source and destination addresses</td> <td>Once the packet has Customer-A WAN addresses again, it can be sent to the Customer-A WAN router in the Provider DC</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">9</td> <td>As the packet has Customer-A WAN addresses again, it can be forwarded back to Alice</td> <td>With Alice&rsquo;s real destination address, the packets route correctly to her site on the WAN</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> <tr> <td style="text-align:center">10</td> <td>The packet is delivered back to Alice&rsquo;s &lsquo;10.1.1.1&rsquo; address, apparently from &lsquo;10.2.2.2&rsquo;</td> <td>The rest of Alice&rsquo;s connection follows the same sequence</td> <td style="text-align:center"><i class="fas fa-check" style="color: green"></i></td> </tr> </tbody> </table> <p>Woohoo! - Wow, err.. actually, I&rsquo;m not sure that&rsquo;s quite as exciting twenty-seventh time around. But at least it still worked!</p> <h2 id="industrialize-and-scale">Industrialize and scale</h2> <p>Both the <em>Link Local</em> and <em>Carrier Grade NAT (Shared Address Space)</em> methods seem to work. The CGN one is slightly slicker as we don&rsquo;t need to allocate, coordinate and configure the second set of NAT addresses but hopefully it&rsquo;s clear how they both work in essentially the same way. In the Provider world, half the battle is getting something to work, the other half is getting it to work repeatedly. The third half of the battle[sic] is getting it to bill correctly, but that&rsquo;s a (half a) battle for another day. <em>Repeatedly</em> involves things like hardware and software scaling, creating a configuration model that lets us easily create identifiers like names and IP addresses that take the &ldquo;design&rdquo; out of adding extra customers. Things like:</p> <ul> <li>Device names will be [device-type]-&lt;pod-no&gt;-&lt;device-no&gt; so each time we add a new one we just <abbr title="increment">bump</abbr> &lt;device-no&gt; by one.</li> <li>Each tenant will be allocated a &lt;some-size&gt; range of IP addresses for their [whatever] network connection from this [pre-allocated/reserved] range/pool, so each time we do this, we get the next &lt;some-size&gt; block from the pool.</li> <li>Each tenant will be allocated &lt;some-number&gt; of VLANs for L2 connectivity from this [pre-allocate/reserved] range, so again, each time we onboard a new tenant, we know what their VLANs will be.</li> </ul> <p>If you&rsquo;re really dedicated/lazy you can create a Slack bot (or a spreadsheet) that will take a tenant &ldquo;number&rdquo;, and use it to calculate all those per-tenant configuration elements. Or, take a tenant number as an input to a vRealize Orchestrator workflow that will do the hard work for you. Anyway, more digressing. Let&rsquo;s try and scale that last example and see if it still works.</p> <p>Remember, now we&rsquo;re experts, every customer uses the same IP addresses, and we want to use the same model over and over again (because lazy err&hellip; repeatable, is good)! Okay, without the aid of a safety net (and slightly regretting using orange for the <em>intermediate network</em> as it&rsquo;s very bright <i class="far fa-sunglasses ntb-dark-text"></i>), here&rsquo;s the multi-tenant version of the packet flow(s).</p> <p>Although we show per-tenant flows on the right hand side of the intermediate network, there&rsquo;s only a single Provider NAT device (stretched here to show it affects all customers). We can get away with just having one because it&rsquo;s only responsible for NATing between the Provider&rsquo;s real and intermediate addresses. It doesn&rsquo;t need to do anything with Customer/Tenant addresses as they get taken care of on the per-Tenant NAT devices on the other side of the <em>lake</em>&hellip; err intermediate network.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide22.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide22_hubf2997e084c15b7baaec1d47d333b383_257212_1920x0_resize_box_3.png" width="1920" height="1357" > </a> </figure> <p>Hopefully this makes sense if you slogged through all the earlier examples. Let&rsquo;s look at what we had to change to make this multi-tenant ready, and what we managed to leave alone.</p> <ul> <li>We&rsquo;ve allocated each customer a /24 of CGN NAT addresses. As before, Customer A (Tenant ID: 1) gets &lsquo;100.64.<strong>[1]</strong>.x&rsquo; or, &lsquo;100.64.<strong>1</strong>.0/24 if you prefer. Depending upon the number of connections from a given customer network and the specifics of the NAT (or <abbr title="Port Address Translation - Using one 'NAT' address for more than one connection">PAT</abbr>) device this may be way overkill. But, operationally, knowing which customer a connection is from just by looking at one octet in the source IP address can be really useful.</li> <li>Customer B (Tenant ID: 2) gets &lsquo;100.64.<strong>[2]</strong>.x&rsquo; or &lsquo;100.64.<strong>2</strong>.0/24. The last octet (the &ldquo;dot 1&rdquo;) would be allocated pseudo-randomly depending on the configuration of the NAT device and the number of other connections from Customer B, but we&rsquo;ve cheated a little for the sake of clarity here, so we see Bill (from Customer B) as &lsquo;100.64.<strong>2</strong>.1&rsquo;.</li> <li>At the bottom of the diagram we see&hellip; Oh, somebody new. Let&rsquo;s call him Nigel from Tenant &rsquo;ninety-nine&rsquo; (You can go with Xavier from Customer &lsquo;xx&rsquo; if you prefer). Just to show how we scale, Nigel&rsquo;s WAN is allocated, you&rsquo;ve guessed it: &lsquo;100.64.<strong>[99]</strong>.0/24&rsquo;. Again, for clarity we&rsquo;ve cheated and given Nigel the &ldquo;dot 1&rdquo; so he becomes &lsquo;100.64.<strong>99</strong>.1&rsquo;.</li> </ul> <p>And, that&rsquo;s about it. As our successive customers get allocated higher and higher ID numbers, we still go through the same process for each one. The portal or service sees all its WAN connections from neatly managed &lsquo;100.64.some.thing&rsquo; addresses, and simply routes all of that range back to the Intermediate network. That third octet goes all the way from &lsquo;1&rsquo; (well, zero really, but if you have to use that, make sure any &ldquo;algorithm&rdquo; you create for naming or numbering stuff doesn&rsquo;t break in the presence of a zero value) to &lsquo;254&rsquo;, because we used &lsquo;100.64.<strong>255</strong>.0/24&rsquo; for the Provider&rsquo;s devices and services. This might be enough to reach the design limit/maximum in which case, Go Us! But it might not be if we have bigger plans (Muhahahaha!).</p> <h2 id="divide-and-conquer">Divide and Conquer</h2> <p>We can easily scale to higher numbers of customers/tenants if we have to meet that requirement. As we saw earlier, there are a <em>lot</em> of addresses in the CGN range. We could treat each &lsquo;site&rsquo; as an isolated island (oh no, more lake analogies) and never route the CGN addresses out of a given location (on our Provider internal WAN). If that is the case, we can happily use the same address model with exactly the same addresses in every site. That does make it kind of awkward if anyone changes their mind and decides to route between customers and portals in different sites.</p> <p>A safer model (as far as the Architect&rsquo;s ability to say &ldquo;I thought you&rsquo;d want to do that, so I designed it in already&rdquo;) would be to plan to (be able to) route between sites even if you don&rsquo;t think you need to, at least not to begin with. Depending upon how many connections you expect per tenant, how many addresses you want to reserve for each tenant, and how many tenants you want to scale to, will tell you how many addresses you need per &ldquo;site&rdquo;. How many sites you want to design for will then give you the building blocks of a formula to carve up your chosen intermediate address space. Using the same address space, but distributed across Provider sites allows us to route between them if we want to.</p> <p>Let&rsquo;s take a look at how we could slice&rsquo;n&rsquo;dice the CGN address space. Here&rsquo;s the range again, with some extra details for clarity.</p> <figure style="padding: 0rem; margin: 1rem 0;"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide23.png" target="_blank"> <img class="imageproc-base imageproc-shadow imageproc-border" src="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/images/Slide23_hu29e3d559e3a504f0e4e981703e7ae686_25540_1920x0_resize_box_3.png" width="1920" height="637" > </a> </figure> <p>We could, for example, decide that one /16 (entire second octet) is big enough for a site, and that the 60-ish /16s in the &lsquo;100.64.0.0/10&rsquo; subnet is also enough for the number of sites we&rsquo;ll need. Then, our site allocation model would be something like:</p> <div class="sideline-textbox" > <i class="fas fa-caret-right ntb-dark-text"></i> Site number: 1 to 64 [site] <br> <i class="fas fa-caret-right ntb-dark-text"></i> Customer number: 1 to 254 [ID] (per site) <br> <em>Let&rsquo;s take Site number and bump it by 63 for the &gt;=64, 2nd octet range</em> <br> <i class="fas fa-caret-right ntb-dark-text"></i> Provider Subnet: 100.(63+[site]).255.0/24 (per site) <br> <i class="fas fa-caret-right ntb-dark-text"></i> Customer Subnet: 100.(63+[site]).[ID].0/24 (per customer, per site) </div> <p>At the other end of the scale, we could decide that each customer only needs a single IP address and that Port Address Translation (AKA Dynamic PAT or Overload / Hide NAT depending on your NAT device vendor) will do the job. If that&rsquo;s the case, the formula above looks like this. The single intermediate network address could be the one assigned to the interface of the NAT device or it could be a separate address used just for NAT.</p> <div class="sideline-textbox" > <i class="fas fa-caret-right ntb-dark-text"></i> Site number: 1 to 64 [site] <br> <i class="fas fa-caret-right ntb-dark-text"></i> Customer number: 1 to 254 [ID] (per site) <br> <em>Again we need to bump the Site number by 63</em> <br> <i class="fas fa-caret-right ntb-dark-text"></i> Provider Subnet: 100.(63+[site]).255.0/24 (per site) <br> <i class="fas fa-caret-right ntb-dark-text"></i> Customer Subnet: 100.(63+[site]).[0,1,2 etc.][ID]/24 (per customer, per site) </div> <p>The likelihood is, that a /24 for each customer is overkill. Similarly, a single address will probably work, but might, on a bad day, lead to &lsquo;<abbr title="Not enough NATs for the number of connections">port exhaustion</abbr>&rsquo;. We will probably end up with something in between the two extremes. Some network devices make it easy to specify a pool or range of addresses for things like NAT, so we could allocate an arbitrary number of addresses to each customer. Some prefer subnet sized blocks, so we can only assign binary powers so 1,2,4,18,16 etc. NAT addresses per customer. The device doing the NATing will determine what we have to work with here.</p> <p>Knowing how many individual addresses we need for each customer will then define the minimum size we should allocate, but we may choose to allocate more for operational simplicity. Exactly how this should be done is something for the detailed design stage of a project.</p> <h2 id="name-names-for-goodness-sake">Name names for goodness sake</h2> <p>All throughout this looooong post there have been references to &ldquo;NAT device&rdquo;, &ldquo;NATing device&rdquo;, &ldquo;Provider NATing device&rdquo;, &ldquo;per-Customer/Tenant NAT device&rdquo; and similar, but what the heck are these really? Are they firewalls? Are they routers? Load balancers? What? Well, the answer is &ldquo;it depends&rdquo;.</p> <p>Yes, sorry, I know&hellip; <i class="fad fa-sad-tear fa-2x ntb-dark-text" data-fa-transform="down-4" ></i></p> <p>The thing is, it does depend. There are solutions doing this kind of thing using big switches to create a VRF per tenant and then handling the NAT there. That&rsquo;s great if you have the licence for the feature and don&rsquo;t have to pay per tenant for a separate context or virtual appliance licence. You could do this with a Linux VM (per tenant/provider of course) using the native kernel routing capabilities or a ready-made router virtual appliance. You could use NSX-V Edges or any one of a myriad network devices that allow some sort of virtual routing and forwarding separation or similar.</p> <p>Hopefully though, the models explored in this series of posts will help whatever network device you have at your disposal. Often. as with many &ldquo;which is best&rdquo; technology-based questions, the answer is &ldquo;the one with which you&rsquo;re most familiar&rdquo;.</p> <h2 id="summary">Summary</h2> <ul> <li>To pass as a network engineer remember, Route if you can, NAT if you must!</li> <li>NAT is not safe to use if the same addresses <em>might</em> appear on either side of the NATing device.</li> <li>As per RFC6598, some NATing devices can cope if they see the same addresses on either side (but it&rsquo;s best not to rely on that unless you know for sure yours can).</li> <li>Filter, NAT, Route or NAT, Filter Route? The order of operation within a network device can bite you if you&rsquo;re not careful.</li> <li>Even if the order of operation works in your favor, what would happen if somewhere down the line, somebody upgrades your solution with a device that has a different order of operation?</li> <li>When connecting networks whose administration lives within different groups and cannot be guaranteed to play nicely, design for the worse case and you&rsquo;ll look like a hero when it still works!</li> <li>If you&rsquo;ve read all three posts, you&rsquo;re now carrying, in total, over 10,000 words of NAT stuff in your head, and probably need a drink and a lie down.</li> </ul> <p>If you made it all the way down here, thanks for persevering! Hopefully you&rsquo;ve found this series of posts useful, or at least mildly interesting. If you have any comments or questions, please feel free to use the comments section below.</p> <p>I&rsquo;d also like to give a huge shout out to my good friends <a href="https://twitter.com/dpaluszek">Daniel Paluszek</a>, <a href="https://twitter.com/JJMarrone">John Marrone</a> and <a href="https://www.linkedin.com/in/grantmarkham/">Grant Markham</a> for reviewing these posts and, <em>The</em> <a href="https://www.linkedin.com/in/intishah/">Inti Shah</a> for teaching me to use <a href="#sub-optimal"><em>sub-optimal</em></a> instead of &ldquo;you could have done that better!&rdquo;</p> <div class="series-link"> <h3> <a id="series"></a> <a href="https://notthe.blog/series/multi-tenant-wan-access" > Posts in this series </a> </h3> <p> <ol> <li hugo-nav="/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/"> <a href="https://notthe.blog/2019/11/multi-tenant-wan-access-to-shared-resources-part-1-the-problem/">Multi-Tenant WAN Access to Shared Resources: Part 1 - The Problem</a> <li hugo-nav="/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-2-a-solution/">Multi-Tenant WAN Access to Shared Resources: Part 2 - A Solution</a> <li hugo-nav="/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/"> <a href="https://notthe.blog/2019/12/multi-tenant-wan-access-to-shared-resources-part-3-getting-real/">Multi-Tenant WAN Access to Shared Resources: Part 3 - Getting Real</a> <em>(this post)</em> </ol> </p> </div>