<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Network Engineering - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Network Engineering - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Fri, 22 May 2026 17:40:25 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/network-engineering/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What is a DNS Server? DNS Servers Explained ]]>
                </title>
                <description>
                    <![CDATA[ The web would not work at all without DNS servers. They are responsible for translating domain names into IP addresses. Then computers use those IP addresses to locate and connect to web servers, and send users to the right websites. Many people firs... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-a-dns-server/</link>
                <guid isPermaLink="false">66b8d67ef8e5d39507c4c120</guid>
                
                    <category>
                        <![CDATA[ Network Engineering ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Quincy Larson ]]>
                </dc:creator>
                <pubDate>Thu, 07 Apr 2022 21:49:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/christina-wocintechchat-com-glRqyWJgUeY-unsplash--1-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The web would not work at all without DNS servers. They are responsible for translating domain names into IP addresses. Then computers use those IP addresses to locate and connect to web servers, and send users to the right websites.</p>
<p>Many people first learned about the DNS system in October of 2021, when all of Facebook's apps and websites went down at the same time, due to a catastrophic DNS misconfiguration.</p>
<h3 id="heading-what-is-an-ip-address">What is an IP Address?</h3>
<p>An IP address is a unique identifier for a device on a network. They are used to route traffic to the correct device on a network. </p>
<p>The primary IP address of google.com, for instance, is 172.217.165.14. </p>
<p>IP addresses can be hard to remember. Especially if they are long and complicated. Human-readable names are much easier to remember. </p>
<h2 id="heading-what-are-the-main-types-of-dns-servers">What are the main types of DNS Servers?</h2>
<p>There are many different types of DNS servers, each with its own unique capabilities.</p>
<p>The most common type of DNS server is the recursive DNS server. This is responsible for performing DNS lookups on behalf of its clients.</p>
<h3 id="heading-how-recursive-dns-servers-work">How Recursive DNS Servers Work</h3>
<p>A client – typically a web browser – sends a DNS query (what's the IP address of this domain name?) to a recursive DNS server. That server resolves the query, then returns the answer to the client.</p>
<p>Recursive DNS servers are typically run by Internet Service Providers (ISPs). These are the companies you pay for your internet access each month.</p>
<h3 id="heading-how-authoritative-dns-servers-work">How Authoritative DNS Servers Work</h3>
<p>Another type of DNS server is the Authoritative DNS server. These are responsible for storing the DNS records for a domain. They contain a database of public IP addresses and corresponding hostnames. </p>
<p>Authoritative DNS servers are responsible for translating domain names to IP addresses. This allows users to access websites using domain names instead of IP addresses.</p>
<p>Authoritative DNS servers are typically provided by domain registrars. </p>
<h3 id="heading-what-are-the-ways-a-dns-servers-can-be-configured">What are the Ways a DNS Servers Can be Configured?</h3>
<p>You can configure a DNS servers using one of these approaches:</p>
<ul>
<li><strong>Static IP Address servers</strong> – permanent IP addresses that have been assigned to specific computers. Static IP addresses are ideal for computers that need to be accessible at all times – such as servers.</li>
<li><strong>Dynamic IP Address servers</strong> – these are useful when devices aren't permanently connected to the network (such as with public Wi-Fi networks). You can also use these to balance network traffic, or assign temporary IP addresses to devices that only infrequently connect to the network.</li>
<li><strong>Round Robin servers</strong> – these resolves domain names by returning a list of IP addresses – each corresponding to a server able to provide the requested information. Round Robin server can distribute traffic evenly across a group of servers. This ensures that no single server is overloaded with requests, and that other servers receive their fair share of traffic, too.</li>
<li><strong>Load Balancing servers</strong> – these figure out the most efficient way to distribute requests across servers. freeCodeCamp.org uses load balancing servers (also called "Load Balancers") and I imagine most major websites do, too.</li>
</ul>
<p>You can also configure DNS servers to use different types of caching, which can improve performance.</p>
<h3 id="heading-what-is-caching">What is caching?</h3>
<p>Caching is a technique where you store data from past requests in a temporary memory location. The thinking is: if someone needs this information, someone else will probably need this information as well.</p>
<p>When someone requests data from your server, you can then first check to see whether the data is stored in your cache. If it is, you can retrieve it from cache rather than the original location.</p>
<p>This is how Content Delivery Networks (CDNs) work. Caching can dramatically speed up the performance of your website or service.</p>
<h2 id="heading-does-dns-change-your-ip-address">Does DNS change your IP address?</h2>
<p>No. Switching DNS servers will not change your IP address.</p>
<p>DNS servers translate domain names to IP addresses. By default, all the web browsers come with the option to automatically detect the DNS settings of their current network.</p>
<p>So when you connect to a Virtual Private Network (VPN), the DNS server of your VPN replaces the DNS server of your ISP.</p>
<h2 id="heading-how-do-i-setup-a-dns-server">How do I setup a DNS server?</h2>
<p>If you want to set up your own DNS server for your company or organization, here are some steps to get started:</p>
<ol>
<li>Choose the right DNS server software. Some popular options include BIND, ISC DHCP, and PowerDNS.</li>
<li>Install the DNS server software on a dedicated server. This will help you ensure that your server has the resources it needs to run reliably. If you use the cloud, you won't have to worry as much about a power outage or network outage taking down your DNS.</li>
<li>Configure the DNS server software. This includes setting up the DNS zones and records.</li>
<li>Test the DNS server. Once it's is up and running, you might stress test it by simulating traffic to make sure it doesn't "fall over."</li>
</ol>
<p>There are also plenty of hosted DNS server tools you can use, which should work out of the box and save you some time. These cost a bit of money each month, but require less expertise to supervise.</p>
<h2 id="heading-i-hope-you-learned-a-lot-about-dns-servers">I hope you learned a lot about DNS Servers.</h2>
<p>I hope you've found this helpful. If you want to learn more about programming and technology, try <a target="_blank" href="https://www.freecodecamp.org/learn">freeCodeCamp's core coding curriculum</a>. It's free.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use the Traceroute and Ping Commands to Troubleshoot Network Connectivity Issues ]]>
                </title>
                <description>
                    <![CDATA[ By Megan Kaczanowski Ping and traceroute are common commands you can use to troubleshoot network problems.  Ping is a simple command that can test the reachability of a device on the network.  Traceroute is a command you use to 'trace' the route that... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/traceroute-and-ping/</link>
                <guid isPermaLink="false">66d460709f2bec37e2da065c</guid>
                
                    <category>
                        <![CDATA[ computer network ]]>
                    </category>
                
                    <category>
                        <![CDATA[ computer networking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Network Engineering ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 04 Oct 2021 23:46:48 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/10/pexels-pixabay-163064--1-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Megan Kaczanowski</p>
<p>Ping and traceroute are common commands you can use to troubleshoot network problems. </p>
<p>Ping is a simple command that can test the reachability of a device on the network. </p>
<p>Traceroute is a command you use to 'trace' the route that a packet takes when traveling to its destination. It's useful for tracing network problems, discovering where connections fail, and tracking down latency problems. </p>
<h2 id="heading-how-does-ping-work">How does ping work?</h2>
<p>Ping uses ICMP (Internet Control Message Protocol) Echo messages to see if a remote host is active or inactive, how long a round trip message takes to reach the target host and return, and any packet loss. </p>
<p>It sends a request and waits for a reply (which it receives if the destination responds back within the timeout period). </p>
<p>It's basically a quick, easy way to verify that you can reach a destination on the internet. If you can, great! If not, you can use traceroute to investigate what's happening at every step between your device and the destination.</p>
<h3 id="heading-example-ping-command-and-results">Example ping command and results:</h3>
<p>hostname ~ % ping -c 5 www.google.com</p>
<p>PING www.google.com (216.58.212.228): 56 data bytes</p>
<p><em>The ping command, set to send 5 packets to google.com.</em></p>
<p>64 bytes from 216.58.212.228: icmp_seq=0 ttl=113 time=42.262 ms</p>
<p>64 bytes from 216.58.212.228: icmp_seq=1 ttl=113 time=34.796 ms</p>
<p>64 bytes from 216.58.212.228: icmp_seq=2 ttl=113 time=35.805 ms</p>
<p>64 bytes from 216.58.212.228: icmp_seq=3 ttl=113 time=45.299 ms</p>
<p>64 bytes from 216.58.212.228: icmp_seq=4 ttl=113 time=150.292 ms</p>
<p><em>This shows the results from each individual ping, with their round trip time in milliseconds.</em></p>
<p>--- www.google.com ping statistics ---</p>
<p>5 packets transmitted, 5 packets received, 0.0% packet loss</p>
<p>round-trip min/avg/max/stddev = 34.796/61.691/150.292/44.474 ms</p>
<p><em>The stats from the entire test - the minimum time it took to reach the destination, the average, the maximum, and the standard deviation.</em></p>
<h2 id="heading-how-does-traceroute-work">How does traceroute work?</h2>
<p>By default, traceroute sends three packets of data to test each 'hop' (when a packet is passed between routers it is called a 'hop'). </p>
<p>It will first send 3 packets to an unreachable port on the target host, each with a Time-To-Live (TTL) value of 1. This means that as soon as it hits the first router in the path (within your network), it will timeout. The first router will respond with an ICMP Time Exceeded Message (TEM), as the datagram has expired. </p>
<p>Then another 3 datagrams are sent, with the TTL set to 2, causing the second router (your ISP) in the path to respond with an ICMP TEM. </p>
<p>This continues until the datagrams eventually have a TTL long enough to reach the destination. When it does, as the messages are being sent to an invalid port, an ICMP port unreachable message is returned, signaling that the traceroute is finished. </p>
<p>In this case, an error message is actually expected behavior, not a sign that something has gone wrong.</p>
<p>The most important part of a traceroute is usually the round trip times. Ideally you're looking for consistent times over the course of the trace. </p>
<p>If you see times suddenly increase (elevated latency) on a specific hop, and continue to increase as the trace approaches the target, this may indicate a problem starting with the sudden increase. </p>
<p>However, if there is elevated latency in the middle, but it remains consistent toward the end, or if the elevated latency decreases toward the end, that doesn't necessarily indicate a problem.</p>
<p>If you see high latency at the beginning of the trace, it may indicate a problem with your local network. You should work with your local admin (or yourself, if you are your own local admin) to fix it. By default, Windows uses ICMP to transmit the data while Linux uses UDP.</p>
<h3 id="heading-example-traceroute-command-and-result">Example traceroute command and result:</h3>
<p>hostname ~ % traceroute www.google.com </p>
<p>traceroute to www.google.com (216.58.212.228), 64 hops max, 52 byte packets</p>
<p><em>The command to traceroute to google.</em></p>
<p>1  homerouter.cpe (192.168.8.1)  10.129 ms  1.528 ms  1.373 ms</p>
<p><em>The first hop is within a local network. Here, we have the hop number (1), the domain name/IP address (in this case a home router), then RTT1, RTT2, and RTT3 (Round Trip Time - the time it takes for a packet to get to the hop and back to the computer, in milliseconds). This is the latency of the hop.</em> </p>
<p><em>There are three numbers because, by default, the command sends three data packets. In general, times over 150ms are unusual for a trip within the continental US, though signals crossing an ocean may exceed this time.</em></p>
<p>2  <em> </em> *</p>
<p><em>Hop 2: There are two possibilities for stars like this - either ICMP/UDP were not configured on the receiving device and it did not respond, or the packets were dropped due to a network issue (such as a firewall or packet timeouts).</em> </p>
<p><em>In this case, as it's very close to the beginning of the trace, it's likely that this is due to the device not being configured to send responses to a traceroute.</em></p>
<p>3  192.168.213.21 (192.168.213.21)  26.641 ms  31.671 ms  26.824 ms</p>
<p>4  192.168.213.22 (192.168.213.22)  20.294 ms  22.496 ms  19.922 ms</p>
<p>5  <em> </em> *</p>
<p>6  <em> </em> *</p>
<p><em>These stars, further along in the trace, are more likely to be due to a target's firewall  blocking requests (though HTTP requests should still be able to be processed in most cases), a possible connection problem, or a return path issue (that is, the signal is reaching the router, but isn't getting a response).</em></p>
<p><em>The trace will then continue until it reaches the target.</em></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>In summary, ping is a (very) fast way to tell if a host is reachable over a network, while traceroute can help you diagnose connectivity problems. </p>
<p>They're both useful commands to know, as understanding how they work, and what the output means, can be very helpful when troubleshooting network connectivity.</p>
<p>You should also know how to use them for networking or security interviews, where questions like 'what port does ping work over (it's a trick question as ping uses ICMP)?' are commonly asked.  </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Subnet Cheat Sheet – 24 Subnet Mask, 30, 26, 27, 29, and other IP Address CIDR Network References ]]>
                </title>
                <description>
                    <![CDATA[ As a developer or network engineer, you may need to occasionally look up subnet mask values and figure out what they mean. To make your life easier, the freeCodeCamp community has made this simple cheat sheet. Just scroll or use Ctrl/Cmd + f to find ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/subnet-cheat-sheet-24-subnet-mask-30-26-27-29-and-other-ip-address-cidr-network-references/</link>
                <guid isPermaLink="false">66ac883115af8baa725ed388</guid>
                
                    <category>
                        <![CDATA[ computer networking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Network Engineering ]]>
                    </category>
                
                    <category>
                        <![CDATA[ networking ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kristofer Koishigawa ]]>
                </dc:creator>
                <pubDate>Fri, 12 Feb 2021 19:06:00 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9c9647740569d1a4ca10a9.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>As a developer or network engineer, you may need to occasionally look up subnet mask values and figure out what they mean.</p>
<p>To make your life easier, the freeCodeCamp community has made this simple cheat sheet. Just scroll or use Ctrl/Cmd + f to find the value you're looking for.</p>
<p>Here are the charts, followed by some explanations of what they mean.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>CIDR</td><td>Subnet mask</td><td>Wildcard mask</td><td># of IP addresses</td><td># of usable IP addresses</td></tr>
</thead>
<tbody>
<tr>
<td>/32</td><td>255.255.255.255</td><td>0.0.0.0</td><td>1</td><td>1</td></tr>
<tr>
<td>/31</td><td>255.255.255.254</td><td>0.0.0.1</td><td>2</td><td>2*</td></tr>
<tr>
<td>/30</td><td>255.255.255.252</td><td>0.0.0.3</td><td>4</td><td>2</td></tr>
<tr>
<td>/29</td><td>255.255.255.248</td><td>0.0.0.7</td><td>8</td><td>6</td></tr>
<tr>
<td>/28</td><td>255.255.255.240</td><td>0.0.0.15</td><td>16</td><td>14</td></tr>
<tr>
<td>/27</td><td>255.255.255.224</td><td>0.0.0.31</td><td>32</td><td>30</td></tr>
<tr>
<td>/26</td><td>255.255.255.192</td><td>0.0.0.63</td><td>64</td><td>62</td></tr>
<tr>
<td>/25</td><td>255.255.255.128</td><td>0.0.0.127</td><td>128</td><td>126</td></tr>
<tr>
<td>/24</td><td>255.255.255.0</td><td>0.0.0.255</td><td>256</td><td>254</td></tr>
<tr>
<td>/23</td><td>255.255.254.0</td><td>0.0.1.255</td><td>512</td><td>510</td></tr>
<tr>
<td>/22</td><td>255.255.252.0</td><td>0.0.3.255</td><td>1,024</td><td>1,022</td></tr>
<tr>
<td>/21</td><td>255.255.248.0</td><td>0.0.7.255</td><td>2,048</td><td>2,046</td></tr>
<tr>
<td>/20</td><td>255.255.240.0</td><td>0.0.15.255</td><td>4,096</td><td>4,094</td></tr>
<tr>
<td>/19</td><td>255.255.224.0</td><td>0.0.31.255</td><td>8,192</td><td>8,190</td></tr>
<tr>
<td>/18</td><td>255.255.192.0</td><td>0.0.63.255</td><td>16,384</td><td>16,382</td></tr>
<tr>
<td>/17</td><td>255.255.128.0</td><td>0.0.127.255</td><td>32,768</td><td>32,766</td></tr>
<tr>
<td>/16</td><td>255.255.0.0</td><td>0.0.255.255</td><td>65,536</td><td>65,534</td></tr>
<tr>
<td>/15</td><td>255.254.0.0</td><td>0.1.255.255</td><td>131,072</td><td>131,070</td></tr>
<tr>
<td>/14</td><td>255.252.0.0</td><td>0.3.255.255</td><td>262,144</td><td>262,142</td></tr>
<tr>
<td>/13</td><td>255.248.0.0</td><td>0.7.255.255</td><td>524,288</td><td>524,286</td></tr>
<tr>
<td>/12</td><td>255.240.0.0</td><td>0.15.255.255</td><td>1,048,576</td><td>1,048,574</td></tr>
<tr>
<td>/11</td><td>255.224.0.0</td><td>0.31.255.255</td><td>2,097,152</td><td>2,097,150</td></tr>
<tr>
<td>/10</td><td>255.192.0.0</td><td>0.63.255.255</td><td>4,194,304</td><td>4,194,302</td></tr>
<tr>
<td>/9</td><td>255.128.0.0</td><td>0.127.255.255</td><td>8,388,608</td><td>8,388,606</td></tr>
<tr>
<td>/8</td><td>255.0.0.0</td><td>0.255.255.255</td><td>16,777,216</td><td>16,777,214</td></tr>
<tr>
<td>/7</td><td>254.0.0.0</td><td>1.255.255.255</td><td>33,554,432</td><td>33,554,430</td></tr>
<tr>
<td>/6</td><td>252.0.0.0</td><td>3.255.255.255</td><td>67,108,864</td><td>67,108,862</td></tr>
<tr>
<td>/5</td><td>248.0.0.0</td><td>7.255.255.255</td><td>134,217,728</td><td>134,217,726</td></tr>
<tr>
<td>/4</td><td>240.0.0.0</td><td>15.255.255.255</td><td>268,435,456</td><td>268,435,454</td></tr>
<tr>
<td>/3</td><td>224.0.0.0</td><td>31.255.255.255</td><td>536,870,912</td><td>536,870,910</td></tr>
<tr>
<td>/2</td><td>192.0.0.0</td><td>63.255.255.255</td><td>1,073,741,824</td><td>1,073,741,822</td></tr>
<tr>
<td>/1</td><td>128.0.0.0</td><td>127.255.255.255</td><td>2,147,483,648</td><td>2,147,483,646</td></tr>
<tr>
<td>/0</td><td>0.0.0.0</td><td>255.255.255.255</td><td>4,294,967,296</td><td>4,294,967,294</td></tr>
</tbody>
</table>
</div><ul>
<li>/31 is a special case detailed in <a target="_blank" href="https://tools.ietf.org/html/rfc3021">RFC 3021</a> where networks with this type of subnet mask can assign two IP addresses as a point-to-point link.</li>
</ul>
<p>And here's a table of the decimal to binary conversions for subnet mask and wildcard octets:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td></td><td>Subnet Mask</td><td></td><td>Wildcard</td></tr>
</thead>
<tbody>
<tr>
<td>0</td><td>00000000</td><td>255</td><td>11111111</td></tr>
<tr>
<td>128</td><td>10000000</td><td>127</td><td>01111111</td></tr>
<tr>
<td>192</td><td>11000000</td><td>63</td><td>00111111</td></tr>
<tr>
<td>224</td><td>11100000</td><td>31</td><td>00011111</td></tr>
<tr>
<td>240</td><td>11110000</td><td>15</td><td>00001111</td></tr>
<tr>
<td>248</td><td>11111000</td><td>7</td><td>00000111</td></tr>
<tr>
<td>252</td><td>11111100</td><td>3</td><td>00000011</td></tr>
<tr>
<td>254</td><td>11111110</td><td>1</td><td>00000001</td></tr>
<tr>
<td>255</td><td>11111111</td><td>0</td><td>00000000</td></tr>
</tbody>
</table>
</div><p>Note that the wildcard is just the inverse of the subnet mask.</p>
<p>If you are new to network engineering, you can <a target="_blank" href="https://www.freecodecamp.org/news/computer-networks-and-how-to-actually-understand-them-c1401908172d/">get a better idea of how computer networks work here</a>.</p>
<p>Finally, this cheat sheet and the rest of the article is focused on IPv4 addresses, not the newer IPv6 protocol. If you'd like to learn more about IPv6, check out the article on computer networks above.</p>
<h2 id="heading-how-do-ip-address-blocks-work">How Do IP Address Blocks Work?</h2>
<p>IPv4 addresses like <code>192.168.0.1</code> are really just decimal representations of four binary blocks.</p>
<p>Each block is 8 bits, and represents numbers from 0-255. Because the blocks are groups of 8 bits, each block is known as an <strong>octet</strong>. And since there are four blocks of 8 bits, every IPv4 address is 32 bits. </p>
<p>For example, here's what the IP address <code>172.16.254.1</code> looks like in binary:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/1125px-Ipv4_address.png" alt="Image" width="600" height="400" loading="lazy">
<em>Source: <a target="_blank" href="https://en.wikipedia.org/wiki/IPv4">IPv4</a></em></p>
<p>To convert an IP address between its decimal and binary forms, you can use this chart:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>128</td><td>64</td><td>32</td><td>16</td><td>8</td><td>4</td><td>2</td><td>1</td></tr>
</thead>
<tbody>
<tr>
<td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td></tr>
</tbody>
</table>
</div><p>The chart above represents one 8 bit octive.</p>
<p>Now lets say you want to convert the IP address <code>168.210.225.206</code>. All you need to do is break the address into four blocks (<code>168</code>, <code>210</code>, <code>225</code>, and <code>206</code>), and convert each into binary using the chart above.</p>
<p>Remember that in binary, 1 is the equivalent to "on" and 0 is "off". So to convert the first block, <code>168</code>, into binary, just start from the beginning of the chart and place a 1 or 0 in that cell until you get a sum of <code>168</code>.</p>
<p>For example:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>128</td><td>64</td><td>32</td><td>16</td><td>8</td><td>4</td><td>2</td><td>1</td></tr>
</thead>
<tbody>
<tr>
<td>1</td><td>0</td><td>1</td><td>0</td><td>1</td><td>0</td><td>0</td><td>0</td></tr>
</tbody>
</table>
</div><p>128 + 32 + 8 = 168, which in binary is <code>10101000</code>.</p>
<p>If you do this for the rest of the blocks, you'd get <code>10101000.11010010.11100001.11001110</code>.</p>
<h2 id="heading-what-is-subnetting">What is Subnetting?</h2>
<p>If you look at the table above, it can seem like the number of IP addresses is practically unlimited. After all, there are almost 4.2 billion possible IPv4 addresses available.</p>
<p>But if you think about how much the internet has grown, and how many more devices are connected these days, it might not surprise you to hear that there's already a <a target="_blank" href="https://whatismyipaddress.com/ipv4-shortage">shortage of IPv4 addresses</a>.</p>
<p>Because the shortage was recognized years ago, developers came up with a way to split up an IP address into smaller networks called subnets.</p>
<p>This process, called subnetting, uses the host section of the IP address to break it down into those smaller networks or subnets.</p>
<p>Generally, an IP address is made up of network bits and host bits:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/network-and-host-bits.png" alt="Image" width="600" height="400" loading="lazy">
<em>Source: <a target="_blank" href="https://support.huawei.com/enterprise/en/doc/EDOC1100145159">What is IPv4</a></em></p>
<p>So generally, subnetting does two things: it gives us a way to break up networks into subnets, and allows devices to determine whether another device/IP address is on the same local network or not.</p>
<p>A good way to think about subnetting is to picture your wireless network at home.</p>
<p>Without subnetting, every internet connected device would need its own unique IP address.</p>
<p>But since you have a wireless router, you just need one IP address for your router. This public or external IP address is usually handled automatically, and is assigned by your internet service provider (ISP).</p>
<p>Then every device connected to that router has its own private or internal IP address:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/home-network-diagram.png" alt="Image" width="600" height="400" loading="lazy">
<em>Source: <a target="_blank" href="https://www.popularmechanics.com/technology/a32729384/how-to-find-ip-address/">What Is My IP Address?</a></em></p>
<p>Now if your device with the internal IP address <code>192.168.1.101</code> wants to communicate with another device, it'll use the IP address of the other device and the subnet mask.</p>
<p>The combination of the IP addresses and subnet mask allows the device at <code>192.168.1.101</code> to figure out if the other device is on the same network (like the device at <code>192.168.1.103</code>), or on a completely different network somewhere else online.</p>
<p>Interestingly, the external IP address assigned to your router by your ISP is probably part of a subnet, which might include many other IP addresses for nearby homes or businesses. And just like internal IP addresses, it also needs a subnet mask to work.</p>
<h3 id="heading-how-subnet-masks-work">How Subnet Masks Work</h3>
<p>Subnet masks function as a sort of filter for an IP address. With a subnet mask, devices can look at an IP address, and figure out which parts are the network bits and which are the host bits.</p>
<p>Then using those things, it can figure out the best way for those devices to communicate.</p>
<p>If you've poked around the network settings on your router or computer, you've likely seen this number: <code>255.255.255.0</code>.</p>
<p>If so, you've seen a very common subnet mask for simple home networks.</p>
<p>Like IPv4 addresses, subnet masks are 32 bits. And just like converting an IP address into binary, you can do the same thing with a subnet mask.</p>
<p>For example, here's our chart from earlier:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>128</td><td>64</td><td>32</td><td>16</td><td>8</td><td>4</td><td>2</td><td>1</td></tr>
</thead>
<tbody>
<tr>
<td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td><td>x</td></tr>
</tbody>
</table>
</div><p>Now let's convert the first octet, 255:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>128</td><td>64</td><td>32</td><td>16</td><td>8</td><td>4</td><td>2</td><td>1</td></tr>
</thead>
<tbody>
<tr>
<td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr>
</tbody>
</table>
</div><p>Pretty simple, right? So any octet that's <code>255</code> is just <code>11111111</code> in binary. This means that <code>255.255.255.0</code> is really <code>11111111.11111111.11111111.00000000</code> in binary.</p>
<p>Now let's look at a subnet mask and IP address together and calculate which parts of the IP address are the network bits and host bits.</p>
<p>Here are the two in both decimal and binary:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Type</td><td>Decimal</td><td>Binary</td></tr>
</thead>
<tbody>
<tr>
<td>IP address</td><td>192.168.0.101</td><td>11000000.10101000.00000000.01100101</td></tr>
<tr>
<td>Subnet mask</td><td>255.255.255.0</td><td>11111111.11111111.11111111.00000000</td></tr>
</tbody>
</table>
</div><p>With the two laid out like this, it's easy to separate <code>192.168.0.101</code> into network bits and host bits.</p>
<p>Whenever a bit in a binary subnet mask is 1, then the same bit in a binary IP address is part of the network, not the host.</p>
<p>Since the octet <code>255</code> is <code>11111111</code> in binary, that whole octet in the IP address is part of the network. So the first three octets, <code>192.168.0</code>, is the network portion of the IP address, and <code>101</code> is the host portion.</p>
<p>In other words, if the device at <code>192.168.0.101</code> wants to communicate with another device, using the subnet mask it knows that anything with the IP address <code>192.168.0.xxx</code> is on the same local network.</p>
<p>Another way to express this is with a network ID, which is just the network portion of the IP address. So the network ID of the address <code>192.168.0.101</code> with a subnet mask of <code>255.255.255.0</code> is <code>192.168.0.0</code>.</p>
<p>And it's the same for the other devices on the local network (<code>192.168.0.102</code>, <code>192.168.0.103</code>, and so on).</p>
<h3 id="heading-what-does-cidr-mean-and-what-is-cidr-notation">What Does CIDR Mean and What is CIDR Notation?</h3>
<p><strong>CIDR</strong> stands for Classless Inter-Domain Routing, and is used in IPv4, and more recently, IPv6 routing.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/1920px-IP_Address_Match.svg.png" alt="Image" width="600" height="400" loading="lazy">
_Source: <a target="_blank" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>_</p>
<p>CIDR was introduced in 1993 as a way to slow the usage of IPv4 addresses, which were quickly being exhausted under the older Classful IP addressing system that the internet was first built on.</p>
<p>CIDR encompasses a couple of major concepts.</p>
<p>The first is Variable Length Submasking (VLSM), which basically allowed network engineers to create subnets within subnets. And those subnets could be different sizes, so there would be fewer unused IP addresses.</p>
<p>The second major concept CIDR introduced is CIDR notation.</p>
<p>CIDR notation is really just shorthand for the subnet mask, and represents the number of bits available to the IP address. For instance, the <code>/24</code> in <code>192.168.0.101/24</code> is equivalent to the IP address <code>192.168.0.101</code> and the subnet mask <code>255.255.255.0</code>.</p>
<h3 id="heading-how-to-calculate-cidr-noation">How to Calculate CIDR Noation</h3>
<p>To figure out the CIDR notation for a given subnet mask, all you need to do is convert the subnet mask into binary, then count the number of ones or "on" digits. For example:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Type</td><td>Decimal</td><td>Binary</td></tr>
</thead>
<tbody>
<tr>
<td>Subnet mask</td><td>255.255.255.0</td><td>11111111.11111111.11111111.00000000</td></tr>
</tbody>
</table>
</div><p>Because there's three octets of ones, there are 24 "on" bits meaning that the CIDR notation is <code>/24</code>.</p>
<p>You can write it either way, but I'm sure you'll agree that <code>/24</code> is a whole lot easier to write than <code>255.255.255.0</code>.</p>
<p>This is usually done with an IP address, so let's take a look at the same subnet mask with an IP address:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Type</td><td>Decimal</td><td>Binary</td></tr>
</thead>
<tbody>
<tr>
<td>IP address</td><td>192.168.0.101</td><td>11000000.10101000.00000000.01100101</td></tr>
<tr>
<td>Subnet mask</td><td>255.255.255.0</td><td>11111111.11111111.11111111.00000000</td></tr>
</tbody>
</table>
</div><p>The first three octets of the subnet mask are all "on" bits, so that means that the same three octets in the IP address are all network bits.</p>
<p>Let's take a look at the last forth octet in a bit more detail:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Type</td><td>Decimal</td><td>Binary</td></tr>
</thead>
<tbody>
<tr>
<td>IP address</td><td>101</td><td>01100101</td></tr>
<tr>
<td>Subnet mask</td><td>0</td><td>00000000</td></tr>
</tbody>
</table>
</div><p>In this case, because all the bits for this octet in the subnet mask are "off", we can be certain that all of the corresponding bits for this octet in the IP address are part of the host.</p>
<p>When you write CIDR notation it's usually done with the network ID. So the CIDR notation of the IP address <code>192.168.0.101</code> with a subnet mask of <code>255.255.255.0</code> is <code>192.168.0.0/24</code>.</p>
<p>To see more examples of how to calculate the CIDR notation and network ID for a given IP address and subnet mask, check out this video:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/XQ3T14SIlV4" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-classful-ip-addressing">Classful IP Addressing</h2>
<p>Now that we've gone over some basic examples of subnetting and CIDR, let's zoom out and look at what's known as Classful IP addressing.</p>
<p>Back before subnetting was developed, all IP addresses fell into a particular class:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/03/subnetting.png" alt="Image" width="600" height="400" loading="lazy">
<em>Source: <a target="_blank" href="https://community.spiceworks.com/networking/articles/2489-subnetting-for-dummies">Subnetting for dummies</a></em></p>
<p>Note that there are class D and E IP addresses, but we'll go into these in more detail a bit later.</p>
<p>Classful IP addresses gave network engineers a way to provide different organizations with a range of valid IP addresses.</p>
<p>There were a lot of issues with this approach that eventually lead to subnetting. But before we get into those, let's take a closer look at the different classes.</p>
<h3 id="heading-class-a-ip-addresses">Class A IP Addresses</h3>
<p>For Class A IP addresses,  the first octet (8 bits / 1 byte) represent the network ID, and the remaining three octets (24 bits / 3 bytes) are the host ID.</p>
<p>Class A IP addresses range from <code>1.0.0.0</code> to <code>127.255.255.255</code>, with a default mask of <code>255.0.0.0</code> (or <code>/8</code> in CIDR).</p>
<p>This means that Class A addressing can have a total of 128 (2<sup>7</sup>) networks and 16,777,214 (2<sup>24</sup>-2) usable addresses per network.</p>
<p>Also, note that the range <code>127.0.0.0</code> to <code>127.255.255.255</code> within the Class A range is reserved for host loopback address (see <a target="_blank" href="https://tools.ietf.org/html/rfc5735">RFC5735</a>).</p>
<h3 id="heading-class-b-ip-addresses">Class B IP Addresses</h3>
<p>For Class B IP addresses, the first two octets (16 bits / 2 bytes) represent the network ID and the remaining two octets (16 bits / 2 bytes) are the host ID.</p>
<p>Class B IP addresses range from <code>128.0.0.0</code> to <code>191.255.255.255</code>, with a default subnet mask of <code>255.255.0.0</code> (or <code>/16</code> in CIDR).</p>
<p>Class B addressing can have 16,384 (2<sup>14</sup>) network addresses and 65,534 (2<sup>16</sup>) usable addresses per network.</p>
<h3 id="heading-class-c-ip-addresses">Class C IP Addresses</h3>
<p>For Class C IP addresses, the first three octets (24 bits / 3 bytes) represent the network ID and the last octet (8 bits / 1 bytes) is the host ID.</p>
<p>Class C IP Addresses range from <code>192.0.0.0</code> to <code>223.255.255.255</code>, with a default subnet mask of <code>255.255.255.0</code> (or <code>/24</code> in CIDR).</p>
<p>Class C translates to 2,097,152 (2<sup>21</sup>) networks and 254 (2<sup>8</sup>-2) usable addresses per network.</p>
<h3 id="heading-class-d-and-class-e-ip-addresses">Class D and Class E IP Addresses</h3>
<p>The last two classes are Class D and Class E.</p>
<p>Class D IP addresses are reserved for multicasts. They occupy the range from <code>224.0.0.0</code> through <code>239.255.255.255</code>.</p>
<p>Class E IP addresses are experimental, and are anything over <code>240.0.0.0</code>.</p>
<h3 id="heading-the-issue-with-classful-ip-addresses">The Issue with Classful IP Addresses</h3>
<p>The main issue with classful IP addresses is that it wasn't efficient, and could lead to a lot of wasted IP addresses.</p>
<p>For example, imagine that you're part of a large organization back then. Your company has 1,000 employees, meaning that it would fall into class B.</p>
<p>But if you look above, you'll see that a class B network can support up to 65,534 usable addresses. That's way more than your organization would likely need, even if each employee had multiple devices with a unique address.</p>
<p>And there was no way your organization could fall back to class C – there just wouldn't be enough usable IP addresses.</p>
<p>So while classful IP addresses were used around the time IPv4 addresses became widespread, it quickly became clear that a better system would be necessary to ensure we wouldn't use up all of the ~4.2 billion usable addresses.</p>
<p>Classful IP addresses haven't been used since they were replaced by CIDR in 1993, and are mostly studied to understand early internet architecture, and why subnetting is important.</p>
<h2 id="heading-i-hope-this-cheat-sheet-has-been-a-helpful-reference-for-you">I hope this cheat sheet has been a helpful reference for you</h2>
<p>If you found this helpful, please share it with your friends so more people can benefit from it.</p>
<p>Also, feel free to reach out on <a target="_blank" href="https://twitter.com/kriskoishigawa">Twitter</a> and let me know what you think.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Must-Have Network Certifications for IT Managers ]]>
                </title>
                <description>
                    <![CDATA[ In this increasingly digital world, Information Technology careers have expanded and blossomed to suit nearly everyone’s skill sets. One such lucrative career is IT Management. IT Managers earn an average of $91,000 a year. This salary bracket can ac... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/must-have-network-certifications-for-it-managers/</link>
                <guid isPermaLink="false">66bb5254074d8d7b12eae37e</guid>
                
                    <category>
                        <![CDATA[ Certification ]]>
                    </category>
                
                    <category>
                        <![CDATA[ computer networking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Network Engineering ]]>
                    </category>
                
                    <category>
                        <![CDATA[ System administration ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ry Vee ]]>
                </dc:creator>
                <pubDate>Thu, 07 Jan 2021 17:09:49 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5ff3d53d7af2371468bb77eb.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this increasingly digital world, Information Technology careers have expanded and blossomed to suit nearly everyone’s skill sets. One such lucrative career is IT Management.</p>
<p>IT Managers earn an average of $91,000 a year. This salary bracket <a target="_blank" href="https://www.indeed.com/career-advice/careers/what-does-an-it-manager-do">can actually range</a> from $21,000 to $180,000 annually, depending on the industry of the IT Manager. In each case, though, the job entails problem-solving and project management.</p>
<p>Specifically, an IT Manager position has the following job description:</p>
<ul>
<li>Analyze, plan, and design the company’s information system needs and execute such plans and designs.</li>
<li>Monitor and improve such a system (which may also include the company’s full telecommunications infrastructure) and recommend any upgrades required to its top management.</li>
<li>Manage the company’s IT policies, including information policy, data/information access, and regulatory compliance.</li>
<li>Hire and lead system administrators and other personnel who will be part of their team.</li>
<li>Identify the training needs of the team and be able to arrange for such training and measure the benefits.</li>
</ul>
<p>The first three above, as you will see, require the IT Manager to be astute in the technical aspects of the job. In particular, they must be competent in network-related areas. They should master these skills if they want to reach the higher tier of the salary scale.</p>
<p>Luckily, there are many training programs designed for IT Management professionals. These aren’t just regular training programs but fully-fledged certification courses. What follows are some of the top programs.</p>
<h2 id="heading-cisco-certified-network-associate-ccnahttpswwwciscocomcenustraining-eventstraining-certificationscertificationsassociateccnahtml"><a target="_blank" href="https://www.cisco.com/c/en/us/training-events/training-certifications/certifications/associate/ccna.html">Cisco Certified Network Associate (CCNA)</a></h2>
<p><img src="https://lh5.googleusercontent.com/f4S28XjFyAb80RUONagOn7wzEbSnvAnrI_jgM_ykBpHnh6EnDMdKiLuHR0giQWGL2zffx0aoOhDZ9Yp6kwcgVlibSCi41DsUKKn1izXd9StcBhgRxmCWl5bveDVAP-dRPg" alt="Image" width="1600" height="882" loading="lazy"></p>
<p>The Cisco Certified Network Associate (CCNA) course is probably the most widely respected certification out there for IT professionals. It is an intermediate-level certification course. A CCNA holder has high competence in configuring, operating, and troubleshooting routed networks.</p>
<p>To get this certification, you must take and pass the CCNA 200-301 examination, which deals with fundamentals on network security, internet protocols, automation, and other security-related skills. </p>
<p>The exam is composed of 120 questions where each question has an associated score. To pass the exam, you must have a score of at least 800 (the highest attainable is 1,000). The cost for this exam is $300.</p>
<h2 id="heading-cisco-certified-network-professional-ccnphttpswwwciscocomcenustraining-eventstraining-certificationscertificationsprofessionalhtml"><a target="_blank" href="https://www.cisco.com/c/en/us/training-events/training-certifications/certifications/professional.html">Cisco Certified Network Professional (CCNP)</a></h2>
<p><img src="https://lh6.googleusercontent.com/u7bKANhre4cxUye5Lnx150ni7d0Dx0rsZuYQmD0wqMpVYSGi19MRmHGAykzCmEGJqNiYpN8FlrrZniaupJkUZxXiX133HGEk13FuAw9SBV2mb16ArYm9g0C-7vmecok_0A" alt="Image" width="1600" height="905" loading="lazy"></p>
<p>Whereas CCNA covers the basic to intermediate skill level, the Cisco Certified Network Professional certification is for those who want to achieve a higher level of certification.</p>
<p>Unlike the CCNA, which requires the candidate to pass one exam, CCNP certification requires two exams: a core exam, covering fundamental networking concepts, and a concentration exam in any one area of intended focus (network design, automation, and so on).</p>
<p>It’s best to get a CCNP certificate after at least three years of experience in this industry. You don't need to take the CCNA before the CCNP examination. The costs for CCNP examinations range anywhere from $900 to $1,200. </p>
<h2 id="heading-secure-access-service-edge-sasehttpswwwcatonetworkscomsasesase-expert-level-1"><a target="_blank" href="https://www.catonetworks.com/sase/sase-expert-level-1/">Secure Access Service Edge (SASE)</a></h2>
<p><img src="https://lh6.googleusercontent.com/3ozE3MSwh2rMMMvJJkzoJfHRGXH3JFgv-gM-04tDn7Ku8vo4Ry7PlPQZoN5JpbeO-K4tWAQB375wabpPhfmvDJlHnlCvOsd719E4rz67F9sHxAhH63QYc8O0sSonpPs54w" alt="Image" width="1600" height="903" loading="lazy"></p>
<p>SASE is a new technology (as described in Gartner’s “<a target="_blank" href="https://thehackernews.com/2019/11/network-security-sase.html">The Future of Network Security is in the Cloud</a>”). This architecture integrates Wide Area Network (WAN) and some native security protocols of the cloud. </p>
<p>Cato Networks is a company that offers a cloud-based SASE platform, and they also offer a certification course for SASE so you can get familiarized with this new technology.</p>
<p>For this particular architecture, the center of a company’s network access is its physical data centers. For SASE, that center transfers over to the cloud. </p>
<p>In a nutshell, SASE makes it more efficient for IT Managers to administer the network as it removes some of the complexities associated with traditional physical data center setup.</p>
<p>To get a SASE certification, you need to take the SASE Expert Level 1 course and pass the associated examination (minimum score must be 85%).</p>
<h2 id="heading-comptia-cloudhttpswwwcomptiaorgcertifications"><a target="_blank" href="https://www.comptia.org/certifications">CompTIA cloud+</a></h2>
<p><img src="https://lh4.googleusercontent.com/UCtX_yh_g-kbwR-weKXWdTBu6gJ78j90l35tcInCuICzy2tJKEmO6nrSvdNTP4P4S1nkFQRkQXpGi2jFmU2SMTkHxdIKE-vMrDcb4iY3BMFlWoj5aPpj1G6oQ-SEK3Jj6A" alt="Image" width="1600" height="903" loading="lazy"></p>
<p>CompTIA’s cloud+ certifications are for those who want to validate their system administration, cloud services maintenance, and other network-related knowledge and skills.</p>
<p>Currently, there are two such exams you can take to get a certification.</p>
<p>The CV0-002 (launched in February of 2018) is designed for candidates whose tasks include integrating various solutions into a business-specific system. It has 90 questions max and can be taken in 90 minutes. The passing score (from 100 to 900) is 750. The cost to take this exam is $329.</p>
<p>The CV0-003 (still in beta mode) is designed to get the candidate vendor-agnostic in creating solutions for their organizations. It has 110 questions that can be answered in 165 minutes. At the moment, there isn’t any finalized passing mark, and since it’s in beta, the cost to take this particular certification is just $50.</p>
<p>In both cases, it is recommended that the candidate has at least two years of experience.</p>
<h2 id="heading-aws-certified-solutions-architecthttpsawsamazoncomcertificationcertified-solutions-architect-professional"><a target="_blank" href="https://aws.amazon.com/certification/certified-solutions-architect-professional/">AWS Certified Solutions Architect</a></h2>
<p><img src="https://lh4.googleusercontent.com/pqePNLAG7Qr0uEJ2hMA78bE39byopwvRHvsnhQNNLdWM4GXj8tSqLCD6FWjvbdKJPVX4O8qx87kFhbw1AErxvg2k5IkGOZJWn-zfEn2epyT5c0UPAUBKkBmpSF-pFqhsvw" alt="Image" width="1600" height="903" loading="lazy"></p>
<p>The AWS Certified Solutions Architect certification is geared for professionals who design network architecture involving AWS. It requires that the candidate has at least two years of experience in operating and administering AWS applications.</p>
<p>It is one of the more sought-after certifications, as Amazon is the top vendor for cloud computing services. Hence, more and more organizations hire professionals that can navigate through this infrastructure.</p>
<p>With a price tag of $300 to take the exam, you should prepare for it thoroughly. The great thing is Amazon provides some <a target="_blank" href="https://aws.amazon.com/certification/certification-prep/">preparatory materials</a> for those interested in acquiring this prized certification. And <a target="_blank" href="https://www.freecodecamp.org/news/pass-the-aws-certified-solutions-architect-exam-with-this-free-10-hour-course/">so does freeCodeCamp</a>.</p>
<h2 id="heading-salesforce-certified-development-lifecycle-and-deploymenthttpstrailheadsalesforcecomcredentialsdevelopmentlifecycledeploymentdesigner"><a target="_blank" href="https://trailhead.salesforce.com/credentials/developmentlifecycledeploymentdesigner">Salesforce Certified Development Lifecycle and Deployment</a></h2>
<p><img src="https://lh5.googleusercontent.com/-3Tgw4LsvcllNhxCS7pnqLOlKpQOaSbXQ7p_oYODhoKnqUKDyTceT9auLA_PibGt3u4o925nBN4ragylZ6A43khtInmWoZ6vZPQ-HJ5XGhpm7pEmVz7WXFGO1BMizNc_iQ" alt="Image" width="1600" height="904" loading="lazy"></p>
<p>As Salesforce is a key enterprise CRM solution, organizations often count on this SaaS platform to manage their relationship with customers as well as provide centralized access for related departments.</p>
<p>This exam also has a hefty price tag - $400. The exam itself has 60 multiple choice questions and requires the candidate to answer at least 60% of them correctly. Those failing the exam are allowed to retake it for a $200 fee.</p>
<h2 id="heading-in-conclusion">In conclusion</h2>
<p>These certifications are by no means the only ones that can enhance an IT Manager’s skills (and hence, career prospects). There are also others related to project management. </p>
<p>What is important to note here is that in the ever-changing technology landscape, it’s always essential to put yourself into continuous learning mode.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Extend Your AWS Infrastructure with Direct Connect Using Terraform ]]>
                </title>
                <description>
                    <![CDATA[ By Serhii Povisenko Sometimes, when you face a challenge, you might be able to solve it with routine processes. But other times you need to try something completely new, something that you know nothing about.  Usually in these scenarios you should ap... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-extend-your-aws-infrastructure/</link>
                <guid isPermaLink="false">66d46089a326133d12440a47</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Network Engineering ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 27 May 2020 21:36:32 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/05/transit-vac-router-service-3-3.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Serhii Povisenko</p>
<p>Sometimes, when you face a challenge, you might be able to solve it with routine processes. But other times you need to try something completely new, something that you know nothing about. </p>
<p>Usually in these scenarios you should apply engineering thinking. For me, these moments are the most insightful and I want to share some of mine with the community.</p>
<p>Here I will guide you through the steps that my team and I took when we connected existing AWS infrastructure to a large private network using <a target="_blank" href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/WorkingWithConnections.html">Direct Connect</a>. </p>
<p>Along the way, I will provide <a target="_blank" href="https://www.terraform.io">Terraform</a> <a target="_blank" href="https://github.com/povisenko/terraform-aws-direct-connect">code snippets</a> that will show you how to implement all of these components as "<a target="_blank" href="https://en.wikipedia.org/wiki/Infrastructure_as_code">infrastructure as code</a>" with accompanying design schemes.</p>
<h2 id="heading-what-well-cover">What we'll cover</h2>
<ol>
<li>Problems to Solve</li>
<li>What is Direct Connect?</li>
<li>How to embed it</li>
<li>Transit VPC using Terraform</li>
<li>Direct Connect using Terraform </li>
<li>Peering between main and transit VPCs</li>
<li>Do you use OpenVPN (optional)?</li>
<li>Router Service</li>
<li>Closing thoughts</li>
</ol>
<h2 id="heading-problems-to-solve">Problems to Solve</h2>
<p>We had services within our <a target="_blank" href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html">VPC</a> that should be able to communicate with other services in a separate virtual private network</p>
<p>In order to establish the connection, we needed to accept an AWS hosted connection from a network provider as part of a signed contract to grant access to the VPN using AWS Direct Connect.</p>
<p>So how were we to implement all of this? How were we going to embed it a current solution that was managed using Terraform? Were there any best practices for doing that?</p>
<h2 id="heading-what-is-direct-connect">What is Direct Connect?</h2>
<blockquote>
<p>AWS Direct Connect makes it easy to establish a dedicated network connection from your premises to your Amazon VPC or among Amazon VPCs. This option can potentially reduce network costs, increase bandwidth throughput, and provide a more consistent network experience than the other VPC-to-VPC connectivity options. (<a target="_blank" href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/aws-direct-connect-network-to-amazon.html">source</a>)</p>
</blockquote>
<p>Essentially you have a network provider who has AWS facilities in a shared data centre. Then you both can make a direct connection between your AWS network components and the network using the provider's hardware (literally a patchcord in the nest) with subsequent access.</p>
<p>Generic implementation in terms of AWS looks like the following: </p>
<ul>
<li>You configure one or two (reserved) Direct Connections in the console, which creates a Direct Connect Gateway. </li>
<li>Then you attach a private VIF (one per connection) to the gateway. </li>
<li>Once you make a few calls with the provider's network engineers and exchange routing policies, it is done. </li>
</ul>
<p>Usually all instructions regarding how to enable the connection will be sent over to you by the provider.</p>
<h2 id="heading-how-to-embed-it">How to embed it</h2>
<p>Our first assumption was that we would enable the connection in the VPC and create the routing configuration to direct connect gateway for the required requests (for example, we'd distinguish them by the header "Host" or by IPs). </p>
<p>On high level, it would look something like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/aws-direct-connect.png" alt="Image" width="600" height="400" loading="lazy">
<em>AWS Direct Connect</em></p>
<p>During a call with the provider's network engineers, they asked us about our IP range that we advertised to the network. We wondered why. It was because Direct Connect work is declared by a protocol called <a target="_blank" href="https://en.wikipedia.org/wiki/Border_Gateway_Protocol">BGP</a>. If you want more info, there are a lot of videos that will teach you about one of the major Internet protocols that are running under the hood. </p>
<p>Our initial thought was that it needed to be a subnet which contained services that we wanted to access the network. After that, we were asked to configure the subnet <code>10.1.2.0/24</code> as an <a target="_blank" href="https://docs.aws.amazon.com/directconnect/latest/UserGuide/allowed-to-prefixes.html">allowed prefix</a> in our Direct Connect configuration. </p>
<p>Long story short,  "allowed prefixes" here stand for an IP range that we were going to advertise to the network provider that they would register in the routing policies.  </p>
<p>Well, after all that, it did not work. The provider did not "see" our advertised routes despite the fact that we could see them. </p>
<p>A bit of <a target="_blank" href="https://aws.amazon.com/directconnect/faqs/#V1,">investigation and voilà</a>:</p>
<blockquote>
<p>AWS will allocate private IPs (/30) in the 169.x.x.x range for the BGP session and will advertise the VPC CIDR block over BGP. You can advertise the default route via BGP.</p>
</blockquote>
<p>Additionally, we found <a target="_blank" href="https://forums.aws.amazon.com/thread.jspa?threadID=130577">other folks</a> who seemed faced the same issue:</p>
<blockquote>
<p>we ended up with creating a new VPC with smaller CIDR our partner wanted.</p>
</blockquote>
<p>So basically, the IP's range that you can advertise over Direct Connect is limited up to <code>/30</code>. Also, you can not advertise subnets – rather you should advertise the whole VPC CIDR. </p>
<p>Our network CIDR was <code>10.1.0.0/16</code> and we had an issue with that - <em>it was too large to accept for the network provider</em>. On top of that, during the call we discovered another thing we had to do when connecting to the network: <em>we needed to contact the network IP access management department (if the network was large enough, I suppose) to ask them to provide us with a unique range within the network. Subsequently, it should be our new VPC CIDR.</em></p>
<p>We decided to create a separate VPC. To get some proofs of work we found some official guides form AWS such as <a target="_blank" href="https://docs.aws.amazon.com/solutions/latest/cisco-based-transit-vpc/appendix-d.html">this</a> one. Shortly after this, we learned that the AWS community would start using separate words for that separate VPC - they'd call it a <strong>transit VPC.</strong></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/05/integration-with-direct-connect.png" alt="Image" width="600" height="400" loading="lazy">
<em><b><strong>Direct Connect using transit VPC</strong></b></em></p>
<p>Before getting a reply to a request a unique IP range in the network, we asked the provider about currently unused IP ranges so we could implement it quickly on our side. This would give us the proof of work we needed for a solution. Everything worked perfectly. </p>
<p>The next step was to implement everything (Direct Connect configurations + VPCs peering) in our existing Terraform configuration. </p>
<h2 id="heading-transit-vpc-using-terraform">Transit VPC using Terraform</h2>
<p>First of all, before we start to dig into the code, I want to say that you can find all the code below on GitHub <a target="_blank" href="https://github.com/povisenko/terraform-aws-direct-connect">here</a>.</p>
<p>Let's first recap what we discussed before. We have conditions where we had an existing VPC. And we wanted some services within it to be able to communicate through the network that we connected to using Direct Connect. </p>
<p>We were granted two AWS-hosted connections (primary and secondary, in order to ensure connection fallback). The main idea was to extend our existing infrastructure somehow. Somehow meant <a target="_blank" href="https://docs.aws.amazon.com/solutions/latest/cisco-based-transit-vpc/appendix-d.html">Transit VPC</a> – the solution that helped us integrate with such connections.</p>
<p>Now let's look at some code to represent what we have discussed. The first thing to define is going to be our main VPC. I want to present it for illustration purposes only, so it makes all further steps seem more consistent.</p>
<p>```hashicorp configuration language
variable "main_vpc_name" {
  description = "Name of your main VPC"
}
variable "main_vpc_cidr" {
  description = "CIDR of your main VPC, e.g. 10.1.0.0/16"
}
variable "public_subnet" {
  description = "pubic subnet of your main VPC (if you have), e.g. 10.1.1.0/24"
}
variable "private_app_subnet" {
  description = "private subnet of your main VPC (if you have), e.g. 10.1.2.0/24"
}
variable "main_vpc_key_name" {
  default     = "main-vpc-key"
  description = "Name of SSH key of your main VPC"
}
variable "aws_availability_zone" {
  description = "Your AWS AZ of your main VPC"
}</p>
<p>provider "aws" {
  profile = "your-profile"
  region  = "your-region"
}</p>
<p>terraform {
  backend "s3" {
    bucket  = "your-terraform-states-bucket"
    key     = "terraform.tfstate"
    profile = "your-profile"
    region  = "your-region"
  }
}</p>
<p>module "vpc" {
  version = "~&gt; v2.0"
  source  = "terraform-aws-modules/vpc/aws"
  name    = var.main_vpc_name
  cidr    = var.main_vpc_cidr</p>
<p>  azs = [
    var.aws_availability_zone,
  ]</p>
<p>  private_subnets = [
    var.private_app_subnet
  ]</p>
<p>  public_subnets = [
    var.public_subnet,
  ]</p>
<p>  single_nat_gateway     = true
  one_nat_gateway_per_az = false
  enable_nat_gateway     = true
  enable_vpn_gateway     = false</p>
<p>  tags = {
    Terraform = "true"
  }
}
/<strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><em>*</em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong>
bellow could be defined any other resources from you infrastructure
e.g. OpenVPN server, instances, security configuration, key pairs etc.</p>
<p>...
<strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><em>*</em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong>/</p>
<pre><code>
Next, some <span class="hljs-keyword">of</span> the main VPC<span class="hljs-string">'s parameters are going to be used in the transit VPC. So let'</span>s define them <span class="hljs-keyword">as</span> output:

<span class="hljs-string">``</span><span class="hljs-string">`hashicorp configuration language
output "main_vpc_id" {
  value = module.vpc.vpc_id
}
output "main_vpc_range" {
  value = module.vpc.vpc_cidr_block
}
output "main_vpc_az" {
  value = module.vpc.azs.0
}
output "main_vpc_key_name" {
  value = var.main_vpc_key_name
}
output "main_public_routing_table_id" {
  value = module.vpc.public_route_table_ids.0
}
output "main_private_routing_table_id" {
  value = module.vpc.private_route_table_ids.0
}</span>
</code></pre><p>Now we can start to configure our transit VPC. Just for sake of good design, we decided to manage it in a separate state under a separate folder (e.g. <em>tranist-vpc/</em>). Let's first import <em>above</em> <em>outputs</em> as <em>locals:</em></p>
<p>```hashicorp configuration language
locals {
  main_private_routing_table = data.terraform_remote_state.main.outputs.main_private_routing_table_id</p>
<p>  main_public_routing_table  = data.terraform_remote_state.main.outputs.main_public_routing_table_id</p>
<p>  main_vpc_id                = data.terraform_remote_state.main.outputs.main_vpc_id</p>
<p> main_vpc_range              = data.terraform_remote_state.main.outputs.main_vpc_range</p>
<p>  main_vpc_az                = data.terraform_remote_state.main.outputs.main_vpc_az</p>
<p>  main_vpc_key_name          = data.terraform_remote_state.main.outputs.main_vpc_key_name
}</p>
<pre><code>
Next, we can start defining the transit VPC configuration. First, I want to list all variables that we need (_pay attention to the IPs <span class="hljs-keyword">of</span> the DNS servers <span class="hljs-keyword">in</span> the network that we want to connect to. You should know them to specify <span class="hljs-keyword">as</span> DNS servers <span class="hljs-keyword">in</span> transit VPC_):

<span class="hljs-string">``</span><span class="hljs-string">`hashicorp configuration language
variable "transit_vpc_name" {
  default = "transit-vpc"
}
variable "transit_vpc_cidr" {
  description = "Transit VPC CIDR. Your unique IP range in the network e.g. 10.10.14.0/24"
}
variable "transit_private_subnet" {
  description = "Transit VPC private subnet e.g 10.10.14.0/25"
}
variable "transit_public_subnet" {
  description = "Transit VPC public subnet for the NAT gateway e.g. 10.10.14.128/25"
}
variable "network_dns_server" {
  description = "IP of one of DNS servers in the network. Distributed by provider"
}
variable "network_dns_server_2" {
  description = "IP of one of DNS servers in the network. Distributed by provider"
}
variable "dhcp_options_domain_name" {
  description = "DHCP option domain name depending on your AWS region e.g. {your_region}.compute.internal"
}</span>
</code></pre><p>And, secondly, the configuration:</p>
<p>```hashicorp configuration language
module "transit-vpc" {
  version = "~&gt; v2.0"
  source  = "terraform-aws-modules/vpc/aws"
  name    = var.transit_vpc_name
  cidr    = var.transit_vpc_cidr</p>
<p>  azs = [
    local.main_vpc_az,
  ]</p>
<p>  private_subnets = [
    var.transit_private_subnet,
  ]</p>
<p>  public_subnets = [
    var.transit_public_subnet,
  ]</p>
<p>  single_nat_gateway               = true
  one_nat_gateway_per_az           = false
  enable_nat_gateway               = true
  enable_vpn_gateway               = false
  enable_dhcp_options              = true
  dhcp_options_domain_name         = var.dhcp_options_domain_name
  dhcp_options_domain_name_servers = [var.network_dns_server, var.network_dns_server_2]</p>
<p>  tags = {
    Terraform = "true"
  }
}</p>
<pre><code>
## Direct Connect using Terraform

Let<span class="hljs-string">'s continue with the Direct Connect configuration. First, let'</span>s define all variables that we need <span class="hljs-keyword">in</span> order to <span class="hljs-keyword">continue</span>. You should get all these values <span class="hljs-keyword">from</span> your network provider. I assume they will be sent over to you (the same worked <span class="hljs-keyword">for</span> us) <span class="hljs-keyword">in</span> a separate <span class="hljs-built_in">document</span> like a spreadsheet:

<span class="hljs-string">``</span><span class="hljs-string">`hashicorp configuration language
variable "bgp_provider_asn" {
  description = "BGP autonomous system number of the provider. Distributed by provider"
}
variable "provider_vln_id" {
  description = "BGP VLN ID of the provider. Distributed by provider"
}
variable "primary_bgp_key" {
  description = "BGP auth key for primary virtual interface. Distributed by provider"
}
variable "secondary_bgp_key" {
  description = "BGP auth key for secondary virtual interface. Distributed by provider"
}
variable "primary_connection_id" {
  description = "BGP auth key for primary virtual interface. Distributed by provider"
}
variable "secondary_connection_id" {
  description = "IP range distributed by provider"
}
variable "primary_amazon_address" {
  description = "IP range distributed by provider"
}
variable "secondary_amazon_address" {
  description = "IP range distributed by provider"
}
variable "primary_customer_address" {
  description = "IP range distributed by provider"
}
variable "secondary_customer_address" {
  description = "IP range distributed by provider"
}</span>
</code></pre><p>And now we can do the rest of the configuration:</p>
<p>```hashicorp configuration language
resource "aws_dx_gateway" "provider-gateway" {
  name            = "provider-dc-gateway"
  amazon_side_asn = "64512" // usually it's a default value
}</p>
<p>resource "aws_dx_gateway_association" "transit" {
  dx_gateway_id         = aws_dx_gateway.provider-gateway.id
  associated_gateway_id = aws_vpn_gateway.transit_vpn_gw.id
  allowed_prefixes = [
    var.transit_vpc_cidr
  ]
}</p>
<p>resource "aws_dx_private_virtual_interface" "primary" {
  connection_id    = var.primary_connection_id
  name             = "provider-vif-primary"
  vlan             = var.provider_vln_id
  address_family   = "ipv4"
  bgp_asn          = var.bgp_provider_asn
  amazon_address   = var.primary_amazon_address
  customer_address = var.primary_customer_address
  dx_gateway_id    = aws_dx_gateway.provider-gateway.id
  bgp_auth_key     = var.primary_bgp_key</p>
<p>}</p>
<p>resource "aws_dx_private_virtual_interface" "secondary" {
  connection_id    = var.secondary_connection_id
  name             = "provider-vif-secondary"
  vlan             = var.provider_vln_id
  address_family   = "ipv4"
  bgp_asn          = var.bgp_provider_asn
  amazon_address   = var.secondary_amazon_address
  customer_address = var.secondary_customer_address
  dx_gateway_id    = aws_dx_gateway.provider-gateway.id
  bgp_auth_key     = var.secondary_bgp_key
}</p>
<pre><code>
Now, <span class="hljs-keyword">if</span> you go to your AWS <span class="hljs-built_in">console</span>, next to Direct Connection you should see something like <span class="hljs-built_in">this</span>:

![Image](https:<span class="hljs-comment">//www.freecodecamp.org/news/content/images/2020/05/dc-connection.png)</span>
_configured direct connections_

## Peering between main and transit VPCs

The last issue to solve is to configure connectivity between our services and transit VPC <span class="hljs-keyword">in</span> order to establish access to the network. 

To accomplish <span class="hljs-built_in">this</span>, we decide to use [VPC peering](https:<span class="hljs-comment">//docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html). Here we will need some of the _locals_' variables that we imported before:</span>

<span class="hljs-string">``</span><span class="hljs-string">`hashicorp configuration language
resource "aws_vpc_peering_connection" "main-to-transit" {
  peer_vpc_id = module.transit-vpc.vpc_id
  vpc_id      = local.main_vpc_id
  auto_accept = true

  tags = {
    Name = "VPC Peering between main and transit VPC"
  }
}

resource "aws_route" "from-main-to-transit" {
  route_table_id            = local.main_private_routing_table
  destination_cidr_block    = var.transit_vpc_cidr
  vpc_peering_connection_id = aws_vpc_peering_connection.main-to-transit.id
}

resource "aws_route" "from-main-public-to-transit" {
  route_table_id            = local.main_public_routing_table
  destination_cidr_block    = var.transit_vpc_cidr
  vpc_peering_connection_id = aws_vpc_peering_connection.main-to-transit.id
}

resource "aws_route" "from-transit-to-main" {
  route_table_id            = module.transit-vpc.private_route_table_ids.0
  destination_cidr_block    = local.main_vpc_range
  vpc_peering_connection_id = aws_vpc_peering_connection.main-to-transit.id
}</span>
</code></pre><p>Next we need to allow inbound HTTP traffic from the main VPC. That configuration can be done like this:</p>
<p>```hashicorp configuration language
resource "aws_security_group" "transit_vpc_sg" {
  name        = "transit-vpc-sg"
  description = "Transit VPC SG"
  vpc_id      = module.transit-vpc.vpc_id</p>
<p>  ingress {
    description = "Allow HTTP from main VPC"
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = [local.main_vpc_range]
  }</p>
<p>  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }</p>
<p>  tags = {
    Name = "transit-vpc"
  }
}</p>
<pre><code>
Great. Now we have two VPCs that are peered and coexist together.

## Do you use OpenVPN (optional)?

In our <span class="hljs-keyword">case</span>, we have an OpenVPN server to manage access (SSH) to the main VPC<span class="hljs-string">'s internal resources. And we wanted to access the transit VPCs resources in the same way. In order to do that we needed to create few additional resources within the transit VPC:

```hashicorp configuration language
resource "aws_vpn_gateway" "transit_vpn_gw" {
  tags = {
    Name = "transit-vpn-gw"
  }
}

resource "aws_vpn_gateway_attachment" "vpn_attachment" {
  vpc_id         = module.transit-vpc.vpc_id
  vpn_gateway_id = aws_vpn_gateway.transit_vpn_gw.id
}

resource "aws_vpn_gateway_route_propagation" "transit" {
  vpn_gateway_id = aws_vpn_gateway.transit_vpn_gw.id
  route_table_id = module.transit-vpc.private_route_table_ids.0
}</span>
</code></pre><p>And then add an <em>ingress rule</em> to <code>transit-vpc-SG</code> that was created on the previous step:</p>
<p>```hashicorp configuration language
ingress {
    description = "Allow SSH from main VPC"
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = [local.main_vpc_range]
}</p>
<pre><code>
To make all <span class="hljs-keyword">of</span> <span class="hljs-built_in">this</span> work you need to specify the transit VPC<span class="hljs-string">'s CIDR along with the main VPC'</span>s CIDR <span class="hljs-keyword">in</span> the OpenVPN server routing setting under the VPN Setting section:

![Image](https:<span class="hljs-comment">//www.freecodecamp.org/news/content/images/2020/05/open-VPC-server-settings.png)</span>
_OpenVPN server routing settings_

So now we are almost there. The last thing to <span class="hljs-keyword">do</span> is to design and configure how our services within the main VPC will be able to programmatically access the network.

## Router Service

To recap, the main reason why we<span class="hljs-string">'ve done all of that is that we need to be able to access other services in the network (for example request or submit data). We found two possible ways to achieve that here:

* Migrate required services to the transit VPC and use them there, assigned with new private IPs. Main VPC internal routing should be adjusted. On top of that, any access to DB servers, logs'</span> storage, and so on should be managed <span class="hljs-keyword">as</span> well.
* Create router service (running HAproxy or NGingx) within the transit VPC. Add router private IP to the <span class="hljs-string">`hosts`</span> file <span class="hljs-keyword">in</span> each service <span class="hljs-keyword">in</span> the main VPC that wants to access the network so the IP will be resolved behind the required domain name.

We choose the second option <span class="hljs-keyword">as</span> it seemed to be the most aligned <span class="hljs-keyword">with</span> the [open-close principle](https:<span class="hljs-comment">//en.wikipedia.org/wiki/Open–closed_principle). Here how it approximately looks:</span>

![Image](https:<span class="hljs-comment">//www.freecodecamp.org/news/content/images/2020/05/transit-vac-router-service-3-2.png)</span>
_transit VPC router service_

Let<span class="hljs-string">'s configure it in Terraform:

```hashicorp configuration language
variable "router_private_ip" {
  description = "Private IP of router instance in transit VPC t route request back and forward e.g. 10.10.14.90"
}

resource "aws_instance" "router" {
  ami               = "ami-0eb89db7593b5d434" // any AMI you prefer
  instance_type     = "t2.micro" //any type you prefer
  availability_zone = local.main_vpc_az
  key_name          = local.main_vpc_key_name
  subnet_id         = module.transit-vpc.private_subnets.0
  private_ip        = var.router_private_ip


  vpc_security_group_ids = [
    aws_security_group.router_sg.id,
  ]

  user_data = file("router_init.sh")

  associate_public_ip_address = false
  tags = {
    Name    = "transit-vpc-router"
    Managed = "terraform"
  }
}

resource "aws_security_group" "router_sg" {
  name        = "router_security_group"
  description = "router_security_group"

  ingress {
    from_port = 80
    to_port   = 80
    protocol  = "tcp"

    cidr_blocks = [
      local.main_vpc_range,
      var.transit_private_subnet
    ]
  }

  ingress {
    from_port = 22
    to_port   = 22
    protocol  = "tcp"

    cidr_blocks = [
      local.main_vpc_az,
    ]
  }

  egress {
    from_port = 0
    to_port   = 0
    protocol  = "-1"

    cidr_blocks = [
      "0.0.0.0/0",
    ]
  }

  vpc_id = module.transit-vpc.vpc_id

  tags = {
    Managed = "terraform"
  }
}</span>
</code></pre><p>Here <code>router_init.sh</code> contains a script to configure and launch the HAproxy service in a container. For illustration purposes, let's assume that we want to access two internal domain names in the network: </p>
<ul>
<li><code>domain-name-1.internal.com</code> </li>
<li><code>domain-name-2.internal.com</code></li>
</ul>
<pre><code class="lang-bash"><span class="hljs-meta">#! /bin/bash</span>

<span class="hljs-comment"># Install Docker</span>
apt-get update

apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
   <span class="hljs-string">"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   <span class="hljs-subst">$(lsb_release -cs)</span> \
   stable"</span>

apt-get update

apt-get install -y docker-ce

usermod -a -G docker ubuntu

chown -R ubuntu:ubuntu /home/ubuntu/.docker/

<span class="hljs-comment"># Create HAproxy configuration</span>
cat &gt; /home/ubuntu/haproxy.cfg &lt;&lt;- <span class="hljs-string">"EOF"</span>
       global
           <span class="hljs-built_in">log</span> stdout local0
           daemon
           maxconn 4000

       defaults
           <span class="hljs-built_in">log</span>               global
           mode              http
           option            httplog
           timeout connect   5s
           timeout check     5s
           timeout client    60s
           timeout server    60s
           timeout tunnel    3600s

       frontend http-in
           <span class="hljs-built_in">bind</span> *:80

           <span class="hljs-comment">#hosts acls</span>
           acl domain1_acl             hdr(host) -i domain-name-1.internal.com
           acl domain2_acl             hdr(host) -i domain-name-2.internal.com


           use_backend domain1         <span class="hljs-keyword">if</span> domain1_acl
           use_backend domain2         <span class="hljs-keyword">if</span> domain2_acl

       backend domain1
           mode http
           option forwardfor
           http-request replace-header Host .* domain-name-1.internal.com
           server domain1 domain-name-1.internal.com:443 ssl verify none

       backend domain2
           mode http
           option forwardfor
           http-request replace-header Host .* domain-name-2.internal.com
           server domain2 domain-name-2.internal.com:443 ssl verify none
EOF

<span class="hljs-comment">#Launch router</span>
docker run -d --restart always --name haproxy --net=host -v /home/ubuntu:/usr/<span class="hljs-built_in">local</span>/etc/haproxy:ro haproxy:2.1-alpine
</code></pre>
<p>The last step is to check that our domains were added to the <code>hosts</code> file on the instances in the main VPC and start making requests over HTTP.</p>
<h2 id="heading-closing-thoughts">Closing Thoughts</h2>
<p>In this article, I showed you how to integrate Direct Connect into your existing AWS infrastructure. I also talked about how you can efficiently manage it using Terraform. </p>
<p>Then I discussed what approach would be appropriate for a network routing configuration that would make the solution transparent and easy to maintain as much as possible. </p>
<p>Transit VPC, which is recommended by AWS to solve such challenges, was indeed easy to configure. And the approach we tried with router service within transit VPC to access the private network showed its proof of work. But it didn't seem to be any better than other alternatives. </p>
<p>Lastly, I introduced Terraform code snippets are will hopefully be useful for anyone who wants to do something similar.</p>
<p>I hope you enjoyed this article and found it helpful!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
