<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>blog.msbnet.co.uk</title>
    <link href="https://blog.msbnet.co.uk/feed.xml" rel="self" />
    <link href="https://blog.msbnet.co.uk" />
    <updated>2020-11-14T18:27:46+00:00</updated>
    <author>
        <name>Michael Bowen</name>
    </author>
    <id>https://blog.msbnet.co.uk</id>

    <entry>
        <title>Cloudflare adds Kompressor to it&#x27;s engineering toolset...</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/cloudflare-adds-kompressor-to-its-engineering-toolset/"/>
        <id>https://blog.msbnet.co.uk/cloudflare-adds-kompressor-to-its-engineering-toolset/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:25:22+00:00</updated>
            <summary>
                <![CDATA[
                    ...I can dream :) Unfortunately, Cloudflare suffered an outage yesterday. Here's the blurb: Today a configuration error in our backbone network caused an outage for Internet properties and Cloudflare services that lasted 27 minutes. We saw traffic drop by about 50% across our network. Because&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <p>...I can dream :)</p>
<figure class="size-full wp-image-470 aligncenter"><a href="https://github.com/msbnetcouk/Kompressor"><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/10/img_5f1341cc595bd.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-md.png 768w ,https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/10/responsive/img_5f1341cc595bd-2xl.png 1600w"  alt=""></figure></a></p>
<p> </p>
<p>Unfortunately, Cloudflare suffered an outage yesterday. Here's the blurb:</p>
<blockquote>
<p>Today a configuration error in our backbone network caused an outage for Internet properties and Cloudflare services that lasted 27 minutes. We saw traffic drop by about 50% across our network. Because of the architecture of our backbone this outage didn’t affect the entire Cloudflare network and was localized to certain geographies.</p>
<p>https://blog.cloudflare.com/cloudflare-outage-on-july-17-2020/</p>
</blockquote>
<p> </p>
<p>Cloudflare went into some depth to describe the problem which was nice to see. The following snippet is from the router in question.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">from {
    prefix-list 6-SITE-LOCAL;
}
then {
    local-preference 200;
    community add SITE-LOCAL-ROUTE;
    community add ATL01;
    community add NORTH-AMERICA;
    accept;
}</pre>
<p> </p>
<blockquote>
<p>As there was backbone congestion in Atlanta, the team had decided to remove some of Atlanta’s backbone traffic. But instead of removing the Atlanta routes from the backbone, a one line change started leaking all BGP routes into the backbone. The correct change would have been to deactivate the <strong>term</strong> instead of the <strong>prefix-list</strong>.</p>
</blockquote>
<p> </p>
<p>We've all been there, I'm sure!</p>
<p>That moment you commit a BGP change and a sense of dread floods every part of your body as you realise you've just broken the internet. Sometimes, it's nice to have a way to check your work because even the most diligent engineers can make mistakes.</p>
<p><a href="https://github.com/msbnetcouk/Kompressor">Kompressor</a> is a project I've been working on that is designed to help busy network engineers, not replace them :)</p>
<p><a href="https://github.com/msbnetcouk/Kompressor">https://github.com/msbnetcouk/Kompressor</a></p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>Kompressor</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/kompressor/"/>
        <id>https://blog.msbnet.co.uk/kompressor/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:26:15+00:00</updated>
            <summary>
                <![CDATA[
                    Kompressor You're a project network engineer. You arrive at the office. The group calendar shows there are twenty services to migrate this week. You've never logged in to these firewalls before. You've never seen the services that need to be migrated before. Each firewall is&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <figure class="wp-image-432 aligncenter align-center"><img loading="lazy"  style="outline: 3px solid rgba(var(--primary-color-rgb), 0.55)  !important;" src="https://blog.msbnet.co.uk/media/posts/8/img_5ebdc54d89f7b.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-md.png 768w ,https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/8/responsive/img_5ebdc54d89f7b-2xl.png 1600w"  alt="" width="274" height="185"></figure>
<p class="align-center" style="text-align: center;"><span style="font-size: 18pt; font-family: arial black, sans-serif;">Kompressor</span></p>
<p> </p>
<p>You're a project network engineer.</p>
<p>You arrive at the office. The group calendar shows there are twenty services to migrate this week.</p>
<p>You've never logged in to these firewalls before.<br>You've never seen the services that need to be migrated before.<br>Each firewall is considered critical national infrastructure.<br>Lives could be at stake.</p>
<p>There's at least two other engineers on your team. There is no work scheduling or queue. You've no idea who has started work on what.</p>
<p>After thumbing through the 200 page LLD for the information you need, you login to the first firewall.</p>
<p>You issue the command <em>show system commit</em> to find at least two other people have committed changes to this box today. You can see at least half of the change is present in the config but due to the length and complexity, it's not immediately obvious, from the CLI, whether this change has been successful.</p>
<p>You catch a glimpse of the time. It's lunchtime and you've achieved nothing.</p>
<p> </p>
<p>msbnet::<strong>Kompressor</strong> - <a href="https://github.com/msbnetcouk/Kompressor">https://github.com/msbnetcouk/Kompressor</a></p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>The best tool for the job?</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/the-best-tool-for-the-job/"/>
        <id>https://blog.msbnet.co.uk/the-best-tool-for-the-job/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:26:37+00:00</updated>
            <summary>
                <![CDATA[
                    For SRE, any manual, structurally mandated operational task is abhorrent. As a contract network engineer, I tend to move around a bit. I get to work in lots of different places with lots of different people which is quite fun. Recently, I was asked to&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <blockquote>
<p>For SRE, any manual, structurally mandated operational task is abhorrent.</p>
</blockquote>
<p> </p>
<p>As a contract network engineer, I tend to move around a bit. I get to work in lots of different places with lots of different people which is quite fun. Recently, I was asked to configure a few boxes <em>(Juniper SRXs)</em> for a service that was being migrated. In some places, the work changes day by day but occasionally, you start to see the same jobs come around which opens up the inevitable question... <em>"Is there a better way?"</em></p>
<p>What's my definition of better? Minimum effective dose, as Tim Ferriss says.</p>
<p>Before heading straight to the Ansible <em>(or similar CoolTooling of the moment)</em> download page, it's worth remembering that I could be gone any day and some organisations take months <em>(I tried to get TCPping added to the toolset whitelist in one such place...)</em> to sign off new tooling. This is especially true in roles that demand Security Clearance. It's also worth remembering that junior engineers cut their teeth on jobs like this where visibility of the syntax is essential. To this end, the XML equivalent of the commit is not always desirable.</p>
<p>A rough outline of the service configuration, in this particular, instance was as follows:</p>
<p><strong># Set up the interface with the appropriate VLAN, IP address and subnet mask:</strong><br>set interfaces ge-0/0/4 vlan-tagging<br>set interfaces ge-0/0/4 unit 333 vlan-id 333<br>set interfaces ge-0/0/4 unit 333 family inet address 10.33.33.1/29</p>
<p><strong># Add the interface to the relevant VRF:</strong><br>set routing-instances LOB interface ge-0/0/4.333</p>
<p><strong># Add the interface and prefix to the address book within the relevant zone:</strong><br>set security zones security-zone SERVICE1 address-book address SERVICE1NET 10.33.33.0/29<br>set security zones security-zone SERVICE1 interfaces ge-0/0/4.330</p>
<p><strong># Create the prefix list and the BGP community:</strong><br>set policy-options prefix-list SERVICE1NET 10.33.33.0/29<br>set policy-options community SERVICE1 members 65001:333</p>
<p><strong># Create the export policy to tag the community:</strong><br>set policy-options policy-statement Export_to_LOB term SERVICE1 from prefix-list SERVICE1NET<br>set policy-options policy-statement Export_to_LOB term SERVICE1 then community add SERVICE1<br>set policy-options policy-statement Export_to_LOB term SERVICE1 then accept</p>
<p><strong># Create the security policy:</strong><br>set security policies from-zone SERVICE1 to-zone LOB policy SERVICE1_Access match source-address SERVICE1NET<br>set security policies from-zone SERVICE1 to-zone LOB policy SERVICE1_Access match destination-address any<br>set security policies from-zone SERVICE1 to-zone LOB policy SERVICE1_Access match application any<br>set security policies from-zone SERVICE1 to-zone LOB policy SERVICE1_Access then permit<br>set security policies from-zone SERVICE1 to-zone LOB policy SERVICE1_Access then log session-init</p>
<p>The same VLAN ID was used for this service at each site which means we have four variables we need to consider:</p>
<p>1. The base interface <em>(ge-0/0/4)</em><br>2. The interface IP <em>(10.33.33.1/29)</em><br>3. The address-book entry <em>(10.33.33.0/29)</em><br>4. The prefix-list entry <em>(10.33.33.0/29)</em></p>
<p>With the last two being identical, we'll only need to supply three arguments as the input to whichever script we create to generate a complete configuration to be pushed to the device. Part of me immediately wondered if I could just use the first two. It seemed possible the prefix-list entry might take 10.33.33.1/29 as input and automatically convert it to 10.33.33.0/29 for me:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">{primary:node0}[edit]
root@msbnet_node0# set policy-options prefix-list SERVICE1NET 10.33.33.1/29  
error: host portion is not zero (10.33.33.0/29): 10.33.33.1/29</pre>
<p>Negative on that, Houston!</p>
<p>Fine! What about the address-book entry, though?</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">{primary:node0}[edit]
root@msbnet_node0# set security zones security-zone SERVICE1 address-book address SERVICE1NET 10.33.33.1/29     

{primary:node0}[edit]
root@msbnet_node0# commit check                                               
[edit security zones security-zone SERVICE1 address-book]
  'address SERVICE1NET'
    Invalid address entry
error: configuration check-out failed</pre>
<p>That's a negative, too, it seems!</p>
<p>So I created a batch script which took those three essential arguments, swapped them into the variables in a template and then echoed the results to a file. That worked well enough for that day as I needed to get those services live ASAP but that night, I wondered how I might be able to get that down to just two arguments and have the script work out the network address itself. I had no idea how I was going to do this but I did have the vaguest recollection, from my CCNA days, bouncing around the back of my head...</p>
<blockquote>
<p>Computers deduce their network address by performing a logical AND on the binary equivalent of the IP address.</p>
</blockquote>
<p> </p>
<p>So I started Googling 'logical AND' and then rummaging through StackOverflow and GitHub. Someone must have solved this problem before...?</p>
<p>After several minutes of ingesting a dizzying array of complex sounding terms, I decided to re-familiarise myself with the basics. From Wikipedia:</p>
<blockquote>
<p>Logical conjunction is often used for bitwise operations, where 0 corresponds to false and 1 to true:</p>
<p>0 AND 0 = 0<br>0 AND 1 = 0<br>1 AND 0 = 0<br>1 AND 1 = 1</p>
<p>The AND of a set of operands/inputs is true if and only if ALL of it's operands are true.</p>
</blockquote>
<p> </p>
<p>It was at this point I realised I'd been googling the wrong thing. It seemed what I was actually trying to achieve was a 'bitwise AND'. It is the bitwise AND which takes a normal number <em>(or tiny integer if you prefer)</em>, converts it to it's binary form and <strong>then</strong> performs a logical AND on it. This subtle difference cost me a good few hours!</p>
<p>A quick example for our use case:</p>
<p> </p>
<p>An IP <em>(IPv4)</em> address is said to be a 32 bit address, written in 'dot decimal' notation. A better description might be that it's four lots of 8 bit addresses <em>(octets)</em> wedged together by a period/full stop: 10.33.33.1</p>
<p>An 8 bit address simply means there are a maximum of 8 bits or place holders available to represent a number. imagine a table, with 8 fields, that are labelled like this:</p>
<table style="border-collapse: collapse; width: 100%;">
<tbody>
<tr>
<td style="width: 12.5%; text-align: center;"><strong>128</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>64</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>32</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>16</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>8</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>4</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>2</strong></td>
<td style="width: 12.5%; text-align: center;"><strong>1</strong></td>
</tr>
<tr>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
<td style="width: 12.5%;"> </td>
</tr>
</tbody>
</table>
<p>You can place the digit <strong>one</strong> or <strong>zero</strong> in any field. The maximum value we can represent is 255. We would do this by placing the digit one in all eight columns. If we wanted to represent a number higher than 255, we'd need more bits. Going left, each additional field added would double the size of the one that preceded it.</p>
<p>Back to 8 bits. Let's work out, for example, my age in binary. I'm 37.</p>
<p>Starting from the <strong>leftmost bit</strong>, sometimes referred to as the <strong>most significant bit</strong>, navigate from left to right until you find a column where your age fits within either perfectly or with a remainder:</p>
<p>128 = no<br>64 = no<br>32 = yes, remainder 5!</p>
<table style="border-collapse: collapse; width: 100%;">
<tbody>
<tr>
<td style="width: 12.5376%; text-align: center;"><strong>128</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>64</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>32</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>16</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>8</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>4</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>2</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>1</strong></td>
</tr>
<tr>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%;"> </td>
<td style="width: 12.5376%;"> </td>
</tr>
</tbody>
</table>
<p>We've now accounted for 32 out of the 37 total years. Where do we put the remaining 5?</p>
<p>16 = no<br>8 = no<br>4 = yes, remainder 1!</p>
<table style="border-collapse: collapse; width: 100%; height: 44px;">
<tbody>
<tr style="height: 22px;">
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>128</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>64</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>32</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>16</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>8</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>4</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>2</strong></td>
<td style="width: 12.5376%; text-align: center; height: 22px;"><strong>1</strong></td>
</tr>
<tr style="height: 22px;">
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
</tr>
</tbody>
</table>
<p>2 = no<br>1 = yes, perfect fit!</p>
<table style="border-collapse: collapse; width: 100%; height: 44px;">
<tbody>
<tr style="height: 22px;">
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>128</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>64</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>32</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>16</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>8</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>4</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>2</strong></td>
<td style="width: 12.5376%; height: 22px; text-align: center;"><strong>1</strong></td>
</tr>
<tr style="height: 22px;">
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;"> </td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
</tr>
</tbody>
</table>
<p>Put zeros in any remaining columns:</p>
<table style="border-collapse: collapse; width: 100%; height: 47px;">
<tbody>
<tr style="height: 25px;">
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>128</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>64</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>32</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>16</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>8</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>4</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>2</strong></td>
<td style="width: 12.5376%; height: 25px; text-align: center;"><strong>1</strong></td>
</tr>
<tr style="height: 22px;">
<td style="width: 12.5376%; height: 22px; text-align: center;">0</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">0</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">0</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">0</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">0</td>
<td style="width: 12.5376%; height: 22px; text-align: center;">1</td>
</tr>
</tbody>
</table>
<p>Now write out the set of zeros and ones and we have my age, in 8 bit binary: <strong>00100101</strong></p>
<p>Armed with this information, let's attempt to, manually, perform a bitwise AND on the IP address we've specified earlier against the subnet mask we also specified; 10.33.33.1/29.</p>
<p>Let's do the IP first. Take each octet in turn and convert it into the binary equivalent.</p>
<p>00001010.00100001.00100001.00000001 = 10.33.33.1</p>
<p>This leaves us with the subnet mask. Sometimes, the subnet mask will be written in the same format as the IP address - dot decimal - and sometimes it will be written in shorthand or 'CIDR' notation. /29 is an example of CIDR notation.</p>
<p><strong>/29 simply means the first 29 bits of the subnet mask, from the most significant bit, are set to one.</strong> The remaining bits will be set to zero.</p>
<p>For prefixes longer than 24 bits (<em>the overwhelming majority of all prefixes you're likely to configure on Customer Edge devices</em>), the first three octets will always be 'maxed out'. This means we can skip to the last octet just like we did before. Let's set the first five bits of the last octet to one and see what value that gives us:</p>
<table style="border-collapse: collapse; width: 100%;">
<tbody>
<tr>
<td style="width: 12.5376%; text-align: center;"><strong>128</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>64</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>32</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>16</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>8</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>4</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>2</strong></td>
<td style="width: 12.5376%; text-align: center;"><strong>1</strong></td>
</tr>
<tr>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%; text-align: center;">1</td>
<td style="width: 12.5376%; text-align: center;">0</td>
<td style="width: 12.5376%; text-align: center;">0</td>
<td style="width: 12.5376%; text-align: center;">0</td>
</tr>
</tbody>
</table>
<p>128 + 64 + 32 + 16 + 8 = <strong>248</strong></p>
<figure class="wp-image-331 aligncenter"><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/6/img_5e485db32d8aa.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-md.png 768w ,https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/6/responsive/img_5e485db32d8aa-2xl.png 1600w"  alt="" width="313" height="329"></figure>
<p>The calculator appears to agree!<br>To summarise:</p>
<p>/29 = 8 bits.8 bits.8 bits.<strong>5 bits</strong><br>/29 = 11111111.11111111.11111111.<strong>11111000</strong><br>/29 = 255.255.255.<strong>248</strong></p>
<p> </p>
<p>Now that we have the binary representation of both, we can attempt the logical AND. We do this by comparing the most significant bit of <strong>A</strong> with the most significant bit of <strong>B</strong> with the <em>all or nothing</em> mindset that epitomises a logical AND.</p>
<p>We'll put the result into <strong>C</strong>. If they're not both 1, the result is 0.</p>
<p>Why are we doing this again? We hope the result of performing a logical AND on A <em>(IP address)</em> and B <em>(subnet mask)</em> will yield the network/base address in C which will save us from having to manually work it out and submit it as a script argument for the next 100 potential sites. We'll use the <strong>&amp;</strong> operator below to indicate we're performing a logical AND.</p>
<p>A: <span style="color: #ff6600;">00001010</span>.<span style="color: #808000;">00100001</span>.<span style="color: #00ccff;">00100001</span>.<span style="color: #cc99ff;">00000001</span> <em>(10.33.33.1)</em><br>B: <span style="color: #ff6600;">11111111</span>.<span style="color: #808000;">11111111</span>.<span style="color: #00ccff;">11111111</span>.<span style="color: #cc99ff;">11111000</span> <em>(255.255.255.248)</em></p>
<p><span style="color: #ff6600;"><strong>First octet</strong><br>0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #ff6600;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #ff6600;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #ff6600;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #ff6600;">1&amp;1</span>=<span style="color: #993366;">1</span><br><span style="color: #ff6600;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #ff6600;">1&amp;1</span>=<span style="color: #993366;">1</span><br><span style="color: #ff6600;">0&amp;1</span>=<span style="color: #993366;">0</span></p>
<p><span style="color: #808000;"><strong>Second octet</strong><br>0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">1&amp;1</span>=<span style="color: #993366;">1</span><br><span style="color: #808000;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #808000;">1&amp;1</span>=<span style="color: #993366;">1</span></p>
<p><span style="color: #00ccff;"><strong>Third octet</strong><br>0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">1&amp;1</span>=<span style="color: #993366;">1</span><br><span style="color: #00ccff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #00ccff;">1&amp;1</span>=<span style="color: #993366;">1</span></p>
<p><span style="color: #cc99ff;"><strong>Fourth octet</strong><br>0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;1</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;0</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">0&amp;0</span>=<span style="color: #993366;">0</span><br><span style="color: #cc99ff;">1&amp;0</span>=<span style="color: #993366;">0</span></p>
<p><strong>Result</strong><br>C: <span style="color: #993366;">00001010</span>.<span style="color: #993366;">00100001</span>.<span style="color: #993366;">00100001</span>.<span style="color: #993366;">00000000</span><em> (10.33.33.0) &lt;------ As expected, the network address is zero in this instance. The theory holds!<br></em></p>
<p>Now, the actual work can begin. Let's remind ourselves of the desired outcome. I want to run a script and specify the absolute minimum number of arguments in order to generate the configuration for SERVICE1. Something like:</p>
<p>script.bat &lt;ARG1&gt; &lt;ARG2&gt;<br>SERVICE1.bat ge-0/0/4 10.33.33.1/29</p>
<p>The quickest way forward now would be to create a first draft of sorts that simply accepts a prefix as input and then echoes the subsequent network address back to us.</p>
<p> </p>
<pre class="EnlighterJSRAW" data-enlighter-language="msdos">@echo off
set ADDR="%1"
set C=255.255.255.
for /f "tokens=4 delims=./" %%a in (%ADDR%) do set OCTET4=%%a
for /f "tokens=1,2,3 delims=." %%x in (%ADDR%) do set OCTET123=%%x.%%y.%%z.
for /f "tokens=2 delims=/ " %%m in (%ADDR%) do set SLASH=%%m
set /a MASKOCTET4="255 - (255 &gt;&gt; (%SLASH%-24))"
set SUBNETMASK=%C%%MASKOCTET4%
set /a SUBN="%OCTET4% &amp; %MASKOCTET4%"
echo.
echo NETWORK ADDRESS: %OCTET123%%SUBN%/%SLASH%
echo SUBNET MASK: %SUBNETMASK%</pre>
<p>Save this file with a .bat extension <em>(prefix.bat)</em> and then call it from a command prompt:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">C:\Users\Michael&gt;prefix 10.33.33.1/29

NETWORK ADDRESS: 10.33.33.0/29
SUBNET MASK:     255.255.255.248</pre>
<p>Job done!</p>
<p>So what exactly are we doing here? Essentially, we chop up the prefix into more usable chunks before re-assembling it and spitting it out at the end. We also perform a logical shift <em>(where, using the table above, we simply fast forward over the bits)</em> to calculate MASKOCTET4 using the CIDR notation from the prefix to calculate how many bits to shift right. Finally, we perform the bitwise AND on the fourth octet of the prefix vs the fourth octet of the calculated subnet mask.</p>
<p>The easiest way to see what's going on is to echo the variables out as we're setting / calculating them:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="msdos">@echo off
echo.
set ADDR="%1"
set C=255.255.255.
for /f "tokens=4 delims=./" %%a in (%ADDR%) do set OCTET4=%%a
echo OCTET4:          %OCTET4%
for /f "tokens=1,2,3 delims=." %%x in (%ADDR%) do set OCTET123=%%x.%%y.%%z.
echo OCTET123:        %OCTET123%
for /f "tokens=2 delims=/ " %%m in (%ADDR%) do set SLASH=%%m
echo SLASH:           %SLASH%
set /a MASKOCTET4="255 - (255 &gt;&gt; (%SLASH%-24))"
echo MASKOCTET4:      %MASKOCTET4%
set SUBNETMASK=%C%%MASKOCTET4%
set /a SUBN="%OCTET4% &amp; %MASKOCTET4%"
echo SUBN:            %SUBN%
echo.
echo NETWORK ADDRESS: %OCTET123%%SUBN%/%SLASH%
echo SUBNET MASK:     %SUBNETMASK%</pre>
<p>Save this file with a .bat extension <em>(prefix_debug.bat)</em> and then call it from a command prompt and try a few prefixes:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="msdos">C:\Users\Michael&gt;prefix_debug 10.33.33.1/29

OCTET4:          1
OCTET123:        10.33.33.
SLASH:           29
MASKOCTET4:      248
SUBN:            0

NETWORK ADDRESS: 10.33.33.0/29
SUBNET MASK:     255.255.255.248

C:\Users\Michael&gt;prefix_debug 10.33.33.1/28

OCTET4:          1
OCTET123:        10.33.33.
SLASH:           28
MASKOCTET4:      240
SUBN:            0

NETWORK ADDRESS: 10.33.33.0/28
SUBNET MASK:     255.255.255.240

C:\Users\Michael&gt;prefix_debug 10.33.33.1/27

OCTET4:          1
OCTET123:        10.33.33.
SLASH:           27
MASKOCTET4:      224
SUBN:            0

NETWORK ADDRESS: 10.33.33.0/27
SUBNET MASK:     255.255.255.224

C:\Users\Michael&gt;prefix_debug 10.33.33.103/29

OCTET4:          103
OCTET123:        10.33.33.
SLASH:           29
MASKOCTET4:      248
SUBN:            96

NETWORK ADDRESS: 10.33.33.96/29
SUBNET MASK:     255.255.255.248

C:\Users\Michael&gt;prefix_debug 10.33.33.221/27

OCTET4:          221
OCTET123:        10.33.33.
SLASH:           27
MASKOCTET4:      224
SUBN:            192

NETWORK ADDRESS: 10.33.33.192/27
SUBNET MASK:     255.255.255.224</pre>
<p> </p>
<p>A few minutes later, we have a script that takes just the two essential arguments and will run on any Windows box without installing any additional software. A far cry from full blown automation but infinitely more scalable than find and replace?</p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>vSRX - your personal laptop firewall!</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/vsrx-your-personal-laptop-firewall/"/>
        <id>https://blog.msbnet.co.uk/vsrx-your-personal-laptop-firewall/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:27:20+00:00</updated>
            <summary>
                <![CDATA[
                    I love to lab. One of the problems of running anything in a 'lab' environment, however, is that it can be a bit too clinical. Traffic generation can become a chore. Earlier this week, I was using Vagrant to spin up some vSRX labs on&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <p>I love to lab.</p>
<p>One of the problems of running anything in a 'lab' environment, however, is that it can be a bit too clinical. Traffic generation can become a chore. Earlier this week, I was using <a href="https://www.vagrantup.com/">Vagrant</a> to spin up some vSRX labs on my laptop when it occurred to me that I could probably just gateway my native traffic through a VM.</p>
<p>There's probably a few ways to achieve this but here are the steps I followed:</p>
<p>1. sudo apt update<br>2. sudo apt install virtualbox<br>3. wget https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb   <em>(earlier versions are plagued with bugs)</em><br>4. sudo dpkg -i vagrant_2.2.6_x86_64.deb<br>5. vagrant plugin install vagrant-host-shell<br>6. vagrant plugin install vagrant-junos<br>7. mkdir vsrx<br>8. cd vsrx<br>9. vagrant init juniper/ffp-12.1X47-D15.4<br>10. vagrant up</p>
<p> </p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Michael@schumacher:/vsrx$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

Michael@schumacher:/vsrx$ vagrant ssh default
--- JUNOS 12.1X47-D15.4 built 2014-11-12 02:13:59 UTC
root@vsrx% cli
root@vsrx&gt; show interfaces terse 
Interface               Admin Link Proto    Local                 Remote
ge-0/0/0                up    up  
ge-0/0/0.0              up    up   inet     10.0.2.15/24    
gr-0/0/0                up    up  
ip-0/0/0                up    up  
lsq-0/0/0               up    up  
lt-0/0/0                up    up  
mt-0/0/0                up    up  
sp-0/0/0                up    up  
sp-0/0/0.0              up    up   inet    
                                   inet6   
sp-0/0/0.16383          up    up   inet     10.0.0.1            --&gt; 10.0.0.16
                                            10.0.0.6            --&gt; 0/0
                                            128.0.0.1           --&gt; 128.0.1.16
                                            128.0.0.6           --&gt; 0/0
dsc                     up    up  
gre                     up    up  
ipip                    up    up  
irb                     up    up  
lo0                     up    up  
lo0.16384               up    up   inet     127.0.0.1           --&gt; 0/0
lo0.16385               up    up   inet     10.0.0.1            --&gt; 0/0
                                            10.0.0.16           --&gt; 0/0
                                            128.0.0.1           --&gt; 0/0
                                            128.0.0.4           --&gt; 0/0
                                            128.0.1.16          --&gt; 0/0
lo0.32768               up    up  
lsi                     up    up  
mtun                    up    up  
pimd                    up    up  
pime                    up    up  
pp0                     up    up  
ppd0                    up    up  
ppe0                    up    up  
st0                     up    up  
tap                     up    up  
vlan                    up    down

root@vsrx&gt; exit 

root@vsrx% exit
logout
Connection to 127.0.0.1 closed.

Michael@schumacher:/vsrx$ vagrant destroy -f
==&gt; default: Forcing shutdown of VM...
==&gt; default: Destroying VM and associated drives...</pre>
<p> </p>
<p>So that gets us a basic vSRX up and running.</p>
<p>Next, we'll need to define an inside (tap0) interface and an outside (wlan0) interface that we can bridge the VM to. Wireless access points tend to be picky about allowing foreign MACs through the front door so we'll allow the native adapter to authenticate to the AP but we'll remove the ability to initialise the IP stack, before gifting the native MAC to vSRX.</p>
<p> </p>
<p>First, let's check the MAC address on wlan0:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Michael@schumacher:/vsrx$ ifconfig wlan0 | grep ether
        ether a1:b1:c1:d1:e1:f1  txqueuelen 1000  (Ethernet)</pre>
<p> </p>
<p>Next, let's replace the Vagrantfile. Don't forget to pop your MAC address in there:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Vagrant.configure(2) do |config|
  config.vm.box = "juniper/ffp-12.1X47-D15.4"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = 512
    vb.cpus = 2
    vb.gui = false
  end

config.vm.define "vsrx" do |vsrx|
    vsrx.vm.host_name = "vSRX"
    vsrx.vm.network "public_network", auto_config: false, bridge: "wlan0", :mac =&gt; "a1b1c1d1e1f1"
    vsrx.vm.network "public_network", auto_config: false, bridge: "tap0"
    vsrx.vm.provision "file", source: "scripts/vsrx.sh", destination: "/tmp/vsrx.sh"
    vsrx.vm.provision :host_shell do |host_shell|
      host_shell.inline = 'vagrant ssh vsrx -c "/usr/sbin/cli -f /tmp/vsrx.sh"'
    end
  end
end</pre>
<p> </p>
<p>We'll also need to create a 'scripts' directory within the vsrx folder to hold the vsrx.sh file we've referenced above. Vagrant commandeers ge-0/0/0 for management, which leaves us with ge-0/0/1 for wlan0 and ge-0/0/2 for our virtual adapter, tap0:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">configure

set system services web-management http interface ge-0/0/2.0

set security zones security-zone untrust interfaces ge-0/0/1 host-inbound-traffic system-services dhcp 
set security zones security-zone untrust host-inbound-traffic system-services ping

set security zones security-zone trust interfaces ge-0/0/2 host-inbound-traffic system-services protocols all
set security zones security-zone trust host-inbound-traffic system-services all

set routing-instances INTERNET instance-type virtual-router
set routing-instances INTERNET interface ge-0/0/1.0
set routing-instances INTERNET interface ge-0/0/2.0

set security nat source rule-set TRUST-TO-UNTRUST from zone trust
set security nat source rule-set TRUST-TO-UNTRUST to zone untrust
set security nat source rule-set TRUST-TO-UNTRUST rule TRUST-TO-INTERNET match source-address 10.88.88.0/24
set security nat source rule-set TRUST-TO-UNTRUST rule TRUST-TO-INTERNET match destination-address 0.0.0.0/0
set security nat source rule-set TRUST-TO-UNTRUST rule TRUST-TO-INTERNET then source-nat interface

set interfaces ge-0/0/1 description "Bridged - wlan0"
set interfaces ge-0/0/1 unit 0 family inet dhcp

set interfaces ge-0/0/2 description "Bridged - tap0"
set interfaces ge-0/0/2 unit 0 family inet address 10.88.88.1/24

commit and-quit</pre>
<p>The vsrx.sh is simply the config we will automatically push to the device every time it's instantiated.</p>
<p> </p>
<p>Next, let's bring up the virtual interface and fire some DNS into resolv.conf:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">ip tuntap add tap0 mode tap
ip addr add 10.88.88.111/24 dev tap0
ip link set dev tap0 up
ip route add default via 10.88.88.1

echo "nameserver 8.8.8.8" &gt;&gt; /etc/resolv.conf</pre>
<p> </p>
<p>Let's not forget to disable any IP allocation on the wireless interface. Do the same for IPv6, too. All traffic must go via vSRX:</p>
<figure class="wp-image-266 aligncenter"><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/5/img_5e001a4b79d7f.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-md.png 768w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001a4b79d7f-2xl.png 1600w"  alt="" width="464" height="316"></figure>
<p> </p>
<p>Time to bring up the VM and test:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@vSRX&gt; ping routing-instance INTERNET 8.8.8.8 
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=57 time=30.447 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=14.362 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=15.521 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=14.575 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=57 time=15.369 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=57 time=17.851 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max/stddev = 14.362/18.021/30.447/5.671 ms
</pre>
<p> </p>
<p>Silky smooth but does the host, my laptop, actually have internet connectivity?</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">Michael@schumacher:/vsrx$ ping bbc.co.uk
PING bbc.co.uk (151.101.128.81) 56(84) bytes of data.
64 bytes from 151.101.128.81 (151.101.128.81): icmp_seq=1 ttl=59 time=14.7 ms
64 bytes from 151.101.128.81 (151.101.128.81): icmp_seq=2 ttl=59 time=18.3 ms
64 bytes from 151.101.128.81 (151.101.128.81): icmp_seq=3 ttl=59 time=15.3 ms
64 bytes from 151.101.128.81 (151.101.128.81): icmp_seq=4 ttl=59 time=15.2 ms
64 bytes from 151.101.128.81 (151.101.128.81): icmp_seq=5 ttl=59 time=15.4 ms
^C
--- bbc.co.uk ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 14.743/15.812/18.377/1.307 ms

Michael@schumacher:/vsrx$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    0      0        0 tap0
10.88.88.0      0.0.0.0         255.255.255.0   U     0      0        0 tap0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 virbr0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
192.168.123.0   0.0.0.0         255.255.255.0   U     0      0        0 green_net
192.168.124.0   0.0.0.0         255.255.255.0   U     0      0        0 red_net


root@vSRX&gt; show security flow session | match icmp    
  In: 10.88.88.111/2 --&gt; 151.101.128.81/13698;icmp, If: ge-0/0/2.0, Pkts: 1, Bytes: 84
  Out: 151.101.128.81/13698 --&gt; 10.14.41.109/29492;icmp, If: ge-0/0/1.0, Pkts: 1, Bytes: 84
  In: 10.88.88.111/3 --&gt; 151.101.128.81/13698;icmp, If: ge-0/0/2.0, Pkts: 1, Bytes: 84
  Out: 151.101.128.81/13698 --&gt; 10.14.41.109/22708;icmp, If: ge-0/0/1.0, Pkts: 1, Bytes: 84

</pre>
<p>Job done!</p>
<p> </p>
<p>If you prefer, you could manage the firewall from the web interface, jweb, too:</p>
<figure class="wp-image-270 aligncenter"><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/5/img_5e001e006aaf0.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-md.png 768w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e006aaf0-2xl.png 1600w"  alt="" width="550" height="440"></figure>
<p> </p>
<p>Login with root / Juniper:</p>
<figure class="alignnone size-full wp-image-272 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/5/img_5e001e7db59b8.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-md.png 768w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/5/responsive/img_5e001e7db59b8-2xl.png 1600w"  alt=""></figure>
<p>Problems? Just 'vagrant destroy' and start again. Other things to consider? Do you really need to keep UFW running? :)</p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>Pseudowire Headend Termination - PART2</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/pseudowire-headend-termination-part2/"/>
        <id>https://blog.msbnet.co.uk/pseudowire-headend-termination-part2/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:27:29+00:00</updated>
            <summary>
                <![CDATA[
                    As network engineers, I think it's fair to say we like to try and spend our time making a difference? Despite being considered the 'bread and butter' of the Service Provider world, provisioning and decommissioning are two areas that can still demand our attention. More&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <p>As network engineers, I think it's fair to say we like to try and spend our time making a difference?</p>
<p>Despite being considered the 'bread and butter' of the Service Provider world, <strong>provisioning</strong> and <strong>decommissioning</strong> are two areas that can still demand our attention. More specifically:</p>
<ol>
<li>Connecting subscribers from remote POPs or external access providers.</li>
<li>Applying the necessary limiters to sub-rate services.</li>
<li>Upgrading or downgrading subscriber services.</li>
<li>VLAN and/or IP allocation... spreadsheets!</li>
</ol>
<blockquote>
<p>"Isn't this what network engineers do, though, Michael?"</p>
</blockquote>
<p> </p>
<p>Is your home fitted with taps?</p>
<p>Imagine, if, several times a day, you were asked to go and draw water from the well, as a matter of urgency. Dumbfounded, you would probably find yourself pointing at the sink whilst mouthing the words, "Taps... but we have taps?" Just me, perhaps.</p>
<p>The lab has changed slightly from the previous article. We are now up to 5 vMX routers. The latest addition, LIx, based at the Llanelli site, is now the BNG:</p>
<figure class="alignnone size-full wp-image-180 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/4/img_5daced12c5579.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-md.png 768w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5daced12c5579-2xl.png 1600w"  alt=""></figure>
<p> </p>
<p><strong>GOAL</strong>: Modify the network so as to allow our colleagues in the <em>Provisioning</em> or <em>Customer Service</em> departments to be able to help the customer directly. This allows us to focus on support exceptions, research or revenue generating opportunities.</p>
<blockquote>
<p>"If a human operator needs to touch your system during normal operations, you have a bug."<br>Carla Geisser, Google SRE</p>
</blockquote>
<p> </p>
<p>In this example, I've simulated attaching a BT GEA cablelink circuit (single tagged) to the network. These are used to connect <a href="https://www.btplc.com/SINet/sins/pdf/506v1p5.pdf">GEA FTTC/FTTP subscribers via Openreach</a>'s access network. What's the minimum required effort to successfully provision and decommission any associated IPoE subscribers?</p>
<p>The final two steps include RADIUS and a beefed up dynamic profile on the BNG, LIx.</p>
<p>The RADIUS config:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set access radius-server 10.10.11.9 secret "$9$YQ4JUqmT/CujHCuO1yrYgoJjH"
set access radius-server 10.10.11.9 timeout 6
set access radius-server 10.10.11.9 retry 5
set access radius-server 10.10.11.9 max-outstanding-requests 1000

set access profile ACCESS1 authentication-order radius
set access profile ACCESS1 radius authentication-server 10.10.11.9
set access profile ACCESS1 radius accounting-server 10.10.11.9
set access profile ACCESS1 radius options nas-identifier LIx
set access profile ACCESS1 accounting order radius
set access profile ACCESS1 accounting accounting-stop-on-failure
set access profile ACCESS1 accounting accounting-stop-on-access-deny
set access profile ACCESS1 accounting immediate-update
set access profile ACCESS1 accounting coa-immediate-update
set access profile ACCESS1 accounting address-change-immediate-update
set access profile ACCESS1 accounting update-interval 60
set access profile ACCESS1 accounting statistics volume-time

set access-profile ACCESS1</pre>
<p> </p>
<p>The dynamic 'client' profile to instantiate the logical interface:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" no-traps
set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" proxy-arp restricted
set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" vlan-tags outer "$junos-stacked-vlan-id"
set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" vlan-tags inner "$junos-vlan-id"
set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" family inet unnumbered-address lo0.0
set dynamic-profiles VLAN-BASIC interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" family inet unnumbered-address preferred-source-address 203.0.113.1
</pre>
<p> </p>
<p>The dynamic 'service' profile for the goodies. This is where we'll <em>dynamically</em> shape the downstream, police the upstream and classify EF traffic from the subscriber. This could be targeted at gamers or voip users:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set dynamic-profiles EAD-PROFILE variables DNSTREAM default-value 10m
set dynamic-profiles EAD-PROFILE variables UPSTREAM default-value 2m
set dynamic-profiles EAD-PROFILE variables UPSTREAM uid
set dynamic-profiles EAD-PROFILE variables POLICER default-value policerv4
set dynamic-profiles EAD-PROFILE variables POLICER uid
set dynamic-profiles EAD-PROFILE variables IFILTER default-value ifilterv4
set dynamic-profiles EAD-PROFILE variables IFILTER uid
set dynamic-profiles EAD-PROFILE variables OFILTER default-value ofilterv4
set dynamic-profiles EAD-PROFILE variables OFILTER uid
set dynamic-profiles EAD-PROFILE interfaces "$junos-interface-ifd-name" unit "$junos-underlying-interface-unit" family inet filter input "$IFILTER"
set dynamic-profiles EAD-PROFILE interfaces "$junos-interface-ifd-name" unit "$junos-underlying-interface-unit" family inet filter output "$OFILTER"
set dynamic-profiles EAD-PROFILE class-of-service traffic-control-profiles SHAPER scheduler-map SMAP_BE_EF
set dynamic-profiles EAD-PROFILE class-of-service traffic-control-profiles SHAPER shaping-rate "$DNSTREAM"
set dynamic-profiles EAD-PROFILE class-of-service traffic-control-profiles SHAPER overhead-accounting frame-mode
set dynamic-profiles EAD-PROFILE class-of-service traffic-control-profiles SHAPER overhead-accounting bytes -4
set dynamic-profiles EAD-PROFILE class-of-service interfaces "$junos-interface-ifd-name" unit "$junos-underlying-interface-unit" output-traffic-control-profile SHAPER
set dynamic-profiles EAD-PROFILE class-of-service interfaces "$junos-interface-ifd-name" unit "$junos-underlying-interface-unit" classifiers dscp EAD_CLASSIFIER
set dynamic-profiles EAD-PROFILE class-of-service scheduler-maps SMAP_BE_EF forwarding-class BE scheduler BE_SCH
set dynamic-profiles EAD-PROFILE class-of-service scheduler-maps SMAP_BE_EF forwarding-class EF scheduler EF_SCH
set dynamic-profiles EAD-PROFILE class-of-service schedulers BE_SCH transmit-rate remainder
set dynamic-profiles EAD-PROFILE class-of-service schedulers BE_SCH priority low
set dynamic-profiles EAD-PROFILE class-of-service schedulers EF_SCH transmit-rate 128k
set dynamic-profiles EAD-PROFILE class-of-service schedulers EF_SCH transmit-rate rate-limit
set dynamic-profiles EAD-PROFILE class-of-service schedulers EF_SCH priority strict-high
set dynamic-profiles EAD-PROFILE firewall family inet filter "$IFILTER" interface-specific
set dynamic-profiles EAD-PROFILE firewall family inet filter "$IFILTER" term term1 then policer "$POLICER"
set dynamic-profiles EAD-PROFILE firewall family inet filter "$IFILTER" term term1 then service-accounting
set dynamic-profiles EAD-PROFILE firewall family inet filter "$IFILTER" term rest then accept
set dynamic-profiles EAD-PROFILE firewall family inet filter "$OFILTER" interface-specific
set dynamic-profiles EAD-PROFILE firewall family inet filter "$OFILTER" term term1 then service-accounting
set dynamic-profiles EAD-PROFILE firewall family inet filter "$OFILTER" term rest then accept
set dynamic-profiles EAD-PROFILE firewall policer "$POLICER" if-exceeding bandwidth-limit "$UPSTREAM"
set dynamic-profiles EAD-PROFILE firewall policer "$POLICER" if-exceeding burst-size-limit 15k
set dynamic-profiles EAD-PROFILE firewall policer "$POLICER" then discard
</pre>
<p> </p>
<p>We'll also need a sprinkle of CoS:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set class-of-service forwarding-classes class BE queue-num 0
set class-of-service forwarding-classes class BE priority low
set class-of-service forwarding-classes class AF queue-num 1
set class-of-service forwarding-classes class AF priority low
set class-of-service forwarding-classes class EF queue-num 2
set class-of-service forwarding-classes class EF priority high
set class-of-service forwarding-classes class NC queue-num 3
set class-of-service forwarding-classes class NC priority high

set class-of-service classifiers dscp EAD_CLASSIFIER forwarding-class BE loss-priority high code-points be
set class-of-service classifiers dscp EAD_CLASSIFIER forwarding-class EF loss-priority low code-points ef
</pre>
<p> </p>
<p>Some final tweaks to the DHCP server config. Here we include a pre-defined prefix for the username (the cablelink ID) as well as the interface name which allows us to build a unique, dynamic, username. The reauthenticate lease-renewal cvar is particularly useful for what comes next in our FreeRADIUS setup:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set system services dhcp-local-server group ps0 authentication password Juniper1
set system services dhcp-local-server group ps0 authentication username-include user-prefix OGHP12345678
set system services dhcp-local-server group ps0 authentication username-include interface-name
set system services dhcp-local-server group ps0 interface ps0.0
set system services dhcp-local-server group ps0 reauthenticate lease-renewal
</pre>
<p> </p>
<p>When we hope to empower our non-technical colleagues, it becomes necessary to disambiguate. Finding some sort of frontend to your RADIUS solution may be key. In this instance, I'm using FreeRADIUS on top of pfSense.</p>
<p>This is the point where you can probably handover to another department to populate the usernames:</p>
<figure class="alignnone size-full wp-image-202 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/4/img_5dad395a4bf28.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-md.png 768w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad395a4bf28-2xl.png 1600w"  alt=""></figure>
<p> </p>
<p>If we double click on Elon's username we are presented with a myriad of options. Scroll all the way down and you'll see something like this:</p>
<figure class="alignnone size-full wp-image-205 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/4/img_5dad3a89995d6.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-md.png 768w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3a89995d6-2xl.png 1600w"  alt=""></figure>
<p> </p>
<p>That final box is all we really need. It took some time to get the dynamic profile set up just so but from here, the customer 'service profile' can be configured by any of your non-technical colleagues. Initially, it might have been set to <strong>|ERX-Service-Activate:1 += "EAD-PROFILE(40m, 10m)" </strong>which simply denotes a 40Mb/s downstream speed and a 10Mb/s upstream speed. If the customer calls up wanting to be upgraded to an 80/20 service, a quick edit in that box <strong>|ERX-Service-Activate:1 += "EAD-PROFILE(80m, 20m)"</strong> will automatically see the customer's speed updated shortly after.</p>
<p>No need to ask them to power cycle kit and risk them breaking something and causing more calls / truck rolls. When the DHCP lease expires, the dynamic profile will check back here for any updates. What's the lease expiry in our IPv4 exhausted world? Typically 1 - 4 hours but it can be whatever you want.</p>
<p>Want to disconnect a user for non-payment? Simply change their RADIUS password:</p>
<figure class="alignnone size-full wp-image-208 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/4/img_5dad3dc87777b.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-md.png 768w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3dc87777b-2xl.png 1600w"  alt=""></figure>
<p>Want to issue a static IP? Just pop one in this box:</p>
<figure class="alignnone size-full wp-image-210 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/4/img_5dad3e5ecac28.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-md.png 768w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/4/responsive/img_5dad3e5ecac28-2xl.png 1600w"  alt=""></figure>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show subscribers                 
Interface             IP Address/VLAN ID                      User Name                      LS:RI
ps0.3221225476         13                                                               default:default      
ps0.3221225476        203.0.113.111                           OGHP12345678.ps0:13       default:default</pre>
<p> </p>
<p>If, for some reason, you want to login to the router, there are a few commands you can issue to check all is well:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show subscribers extensive 
Type: VLAN
Logical System: default
Routing Instance: default
Interface: ps0.3221225476
Interface type: Dynamic
Underlying Interface: ps0
Dynamic Profile Name: VLAN-BASIC
Dynamic Profile Version: 1
State: Active
Session ID: 7
PFE Flow ID: 14
VLAN Id: 13
Login Time: 2019-10-21 06:22:38 BST

Type: DHCP
User Name: OGHP12345678.ps0:13
IP Address: 203.0.113.111
IP Netmask: 255.255.255.0
Logical System: default
Routing Instance: default
Interface: ps0.3221225476
Interface type: Static
Underlying Interface: ps0.3221225476
MAC Address: 20:cf:30:23:ca:a6
State: Active
Radius Accounting ID: 8
Session ID: 8
PFE Flow ID: 14
VLAN Id: 13
Login Time: 2019-10-21 06:22:38 BST
Service Sessions: 1
DHCP Options: len 42
35 01 01 3d 07 01 20 cf 30 23 ca a6 0c 02 71 6c 3c 08 4d 53
46 54 20 35 2e 30 37 0e 01 03 06 0f 1f 21 2b 2c 2e 2f 77 79
f9 fc
DHCP Header: len 44
01 01 06 00 cc e4 5d 08 00 00 80 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 20 cf 30 23 ca a6 00 00 00 00 00 00
00 00 00 00
IP Address Pool: TEST-NET-3
Accounting interval: 3600

   Service Session ID: 9                
   Service Session Name: EAD-PROFILE
   Service Session Version: 1
   State: Active
   Family: inet
   IPv4 Input Filter Name: ifilterv4_UID1019-ps0.3221225476-in
   IPv4 Output Filter Name: ofilterv4_UID1020-ps0.3221225476-out
   Service Activation time: 2019-10-21 06:22:39 BST
   Dynamic configuration: 
     DNSTREAM: 40m
     IFILTER: ifilterv4_UID1019
     OFILTER: ofilterv4_UID1020
     POLICER: policerv4_UID1018
     UPSTREAM: 10m
</pre>
<p> </p>
<p>Check the dynamically created traffic control profile:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show class-of-service traffic-control-profile SHAPER_UID1017 
Traffic control profile: SHAPER_UID1017, Index: 4294967363
  Shaping rate: 40000000
  Scheduler map: SMAP_BE_EF_UID1016
  Overhead accounting mode: Frame Mode
  Overhead bytes: -4</pre>
<p> </p>
<p>Check the dynamically created scheduler map:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show class-of-service scheduler-map SMAP_BE_EF_UID1016                   
Scheduler map: SMAP_BE_EF_UID1016, Index: 4294967357

  Scheduler: BE_SCH_UID1014, Forwarding class: BE, Index: 4294967360
    Transmit rate: remainder, Rate Limit: none, Buffer size: remainder, Buffer Limit: none, Priority: low
    Excess Priority: unspecified
    Drop profiles:
      Loss priority   Protocol    Index    Name
      Low             any             1    &lt;default-drop-profile&gt;      
      Medium low      any             1    &lt;default-drop-profile&gt;      
      Medium high     any             1    &lt;default-drop-profile&gt;      
      High            any             1    &lt;default-drop-profile&gt;      

  Scheduler: EF_SCH_UID1015, Forwarding class: EF, Index: 4294967361
    Transmit rate: 128000 bps, Rate Limit: rate-limit, Buffer size: remainder, Buffer Limit: none, Priority: strict-high
    Excess Priority: unspecified
    Drop profiles:
      Loss priority   Protocol    Index    Name
      Low             any             1    &lt;default-drop-profile&gt;      
      Medium low      any             1    &lt;default-drop-profile&gt;      
      Medium high     any             1    &lt;default-drop-profile&gt;      
      High            any             1    &lt;default-drop-profile&gt;</pre>
<p> </p>
<p>Check the policer and accounting stats:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show firewall 

Filter: __default_bpdu_filter__                                

Filter: ifilterv4_UID1019-ps0.3221225476-in                    
Counters:
Name                                                Bytes              Packets
__junos-dyn-service-counter                      29317545               138097
Policers:
Name                                                Bytes              Packets
policerv4_UID1018-term1-ps0.3221225476-in              1506492                 1015

Filter: ofilterv4_UID1020-ps0.3221225476-out                   
Counters:
Name                                                Bytes              Packets
__junos-dyn-service-counter                      80939623                99292

</pre>
<p> </p>
<p>Check if the subscriber is making use of the QoS in the dynamic profile?</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@LIx&gt; show interfaces queue ge-0/0/0 | find EF    
Queue: 2, Forwarding classes: EF
  Queued:
    Packets              :                212186                   135 pps
    Bytes                :              17415738                 81920 bps
  Transmitted:
    Packets              :                212186                   135 pps
    Bytes                :              17415738                 81920 bps
    Tail-dropped packets :                     0                     0 pps
    RL-dropped packets   :                     0                     0 pps
    RL-dropped bytes     :                     0                     0 bps
    RED-dropped packets  :                     0                     0 pps
     Low                 :                     0                     0 pps
     Medium-low          :                     0                     0 pps
     Medium-high         :                     0                     0 pps
     High                :                     0                     0 pps
    RED-dropped bytes    :                     0                     0 bps
     Low                 :                     0                     0 bps
     Medium-low          :                     0                     0 bps
     Medium-high         :                     0                     0 bps
     High                :                     0                     0 bps
</pre>
<p>Yes!</p>
<p>As always, there is so much more that can be done but hopefully I've provided the foundations from which you can try and seize more control of your working day whilst providing a high quality and consistent experience to your paying customers.</p>
<p> </p>
<p><strong>Configs</strong></p>
<p><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/10/3_LIx.txt">3_LIx</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/10/3_LI.txt">3_LI</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/10/3_SA.txt">3_SA</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/10/3_NT.txt">3_NT</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/10/3_CF.txt">3_CF</a></p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>Pseudowire Headend Termination - in 8 steps - PART1</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/pseudowire-headend-termination-in-8-steps-part1/"/>
        <id>https://blog.msbnet.co.uk/pseudowire-headend-termination-in-8-steps-part1/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:27:39+00:00</updated>
            <summary>
                <![CDATA[
                    PROBLEM: Swansea, Newport and Cardiff subscribers have been, temporarily, terminated on vACX hardware at those sites. The vACX routers are typically used for mobile backhaul and generally don't have the 'grunt' to terminate subscribers. They don't support per-unit-scheduling, for example. We need to get them&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <p><strong>PROBLEM:</strong> Swansea, Newport and Cardiff subscribers have been, temporarily, terminated on vACX hardware at those sites. The vACX routers are typically used for mobile backhaul and generally don't have the 'grunt' to terminate subscribers. They don't support per-unit-scheduling, for example. We need to get them off these routers.</p>
<p><strong>GOAL: </strong>Terminate all subscribers from the Access Provider at Cardiff, on to the new vMX960 at Llanelli.</p>
<p>Juniper's <a href="https://www.juniper.net/documentation/en_US/release-independent/nce/topics/example/nce-141-example-seamless-mpls.html"><em>Configuring the Broadband Edge as a Service Node Within Seamless MPLS Network Designs</em></a> article was the main inspiration for this post.</p>
<figure class="alignnone size-full wp-image-115 "><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/2/img_5d86180f2f221.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-md.png 768w ,https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/2/responsive/img_5d86180f2f221-2xl.png 1600w"  alt=""></figure>
<p> </p>
<p> </p>
<p>Let's log on to Llanelli and get cracking! Before we begin, let's check reachability to the loopbacks:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; ping 172.16.99.1 count 1    
PING 172.16.99.1 (172.16.99.1): 56 data bytes
64 bytes from 172.16.99.1: icmp_seq=0 ttl=64 time=0.066 ms

--- 172.16.99.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.066/0.066/0.066/0.000 ms

root@Llanelli&gt; ping 172.16.99.2 count 1    
PING 172.16.99.2 (172.16.99.2): 56 data bytes
64 bytes from 172.16.99.2: icmp_seq=0 ttl=64 time=93.739 ms

--- 172.16.99.2 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 93.739/93.739/93.739/0.000 ms

root@Llanelli&gt; ping 172.16.99.3 count 1    
PING 172.16.99.3 (172.16.99.3): 56 data bytes
64 bytes from 172.16.99.3: icmp_seq=0 ttl=64 time=21.710 ms

--- 172.16.99.3 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 21.710/21.710/21.710/0.000 ms

root@Llanelli&gt; ping 172.16.99.4 count 1    
PING 172.16.99.4 (172.16.99.4): 56 data bytes
64 bytes from 172.16.99.4: icmp_seq=0 ttl=63 time=281.251 ms

--- 172.16.99.4 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 281.251/281.251/281.251/0.000 ms
</pre>
<p> </p>
<ol>
<li><strong>Add secondary IP to lo0.0:</strong><br>set interfaces lo0 unit 0 family inet address 203.0.113.1/32</li>
<li><strong>Configure the dynamic VLAN profile with versioning:</strong><br>set system dynamic-profile-options versioning<br>set dynamic-profiles DYNINTF-DHCP-INET interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" proxy-arp restricted<br>set dynamic-profiles DYNINTF-DHCP-INET interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" vlan-tags outer "$junos-stacked-vlan-id"<br>set dynamic-profiles DYNINTF-DHCP-INET interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" vlan-tags inner "$junos-vlan-id"<br>set dynamic-profiles DYNINTF-DHCP-INET interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" family inet unnumbered-address lo0.0<br>set dynamic-profiles DYNINTF-DHCP-INET interfaces "$junos-interface-ifd-name" unit "$junos-interface-unit" family inet unnumbered-address preferred-source-address 203.0.113.1</li>
<li><strong>Enable tunnel-services on the PFE:</strong><br>set chassis fpc 0 pic 0 tunnel-services bandwidth 1g<br>set chassis fpc 0 pic 0 traffic-manager egress-shaping-overhead 0<br>set chassis network-services enhanced-ip<br>set chassis pseudowire-service device-count 4</li>
<li><strong>Configure the pseudowire (ps0) interface for single and double tagged traffic:</strong><br>set interfaces ps0 anchor-point lt-0/0/10<br>set interfaces ps0 flexible-vlan-tagging<br>set interfaces ps0 auto-configure stacked-vlan-ranges dynamic-profile DYNINTF-DHCP-INET accept any<br>set interfaces ps0 auto-configure stacked-vlan-ranges dynamic-profile DYNINTF-DHCP-INET ranges any,any<br>set interfaces ps0 auto-configure vlan-ranges dynamic-profile DYNINTF-DHCP-INET accept any<br>set interfaces ps0 auto-configure vlan-ranges dynamic-profile DYNINTF-DHCP-INET ranges any<br>set interfaces ps0 auto-configure remove-when-no-subscribers<br>set interfaces ps0 no-gratuitous-arp-request<br>set interfaces ps0 unit 0 encapsulation ethernet-ccc</li>
<li><strong>Configure DHCP and bind it to the transport logical (ps0.0) interface:</strong><br>set system services dhcp-local-server pool-match-order ip-address-first<br>set system services dhcp-local-server authentication username-include interface-name<br>set system services dhcp-local-server group local interface ps0.0</li>
<li><strong>Enable subscriber management:</strong><br>set system services subscriber-management enable<br>set system configuration-database max-db-size 104857600</li>
<li><strong>Configure the access profile and DHCP scope. Apply the access-profile:</strong><br>set access profile local authentication-order none<br>set access address-assignment pool TEST-NET-3 family inet network 203.0.113.0/24<br>set access address-assignment pool TEST-NET-3 family inet range 1 low 203.0.113.2<br>set access address-assignment pool TEST-NET-3 family inet range 1 high 203.0.113.250<br>set access address-assignment pool TEST-NET-3 family inet dhcp-attributes maximum-lease-time 3600<br>set access address-assignment pool TEST-NET-3 family inet dhcp-attributes domain-name msbnet.co.uk<br>set access address-assignment pool TEST-NET-3 family inet dhcp-attributes router 203.0.113.1<br>set access-profile local</li>
<li><strong>Configure the l2circuit at both sites:</strong><br># Llanelli<br>set protocols l2circuit neighbor 172.16.99.4 interface ps0.0 virtual-circuit-id 1<br>set protocols l2circuit neighbor 172.16.99.4 interface ps0.0 ignore-mtu-mismatch<br># Cardiff<br>set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1 virtual-circuit-id 1<br>set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1 encapsulation-type ethernet<br>set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1 ignore-mtu-mismatch<br>set interfaces ge-0/0/3 unit 1 encapsulation vlan-ccc<br>set interfaces ge-0/0/3 unit 1 vlan-id-range 2-10</li>
</ol>
<p> </p>
<p>Finally, commit the configuration at both sites. Llanelli displays the follow message upon commit:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli# commit and-quit 
[edit system services subscriber-management]
  'enable'
    warning: Chassis configuration for subscriber-management has been changed. A system reboot is mandatory.  Please reboot the system NOW. Continuing without a reboot might result in unexpected system behavior.

Message from syslogd@Llanelli at Sep 20 17:18:05  ...
Llanelli fpc0 CMLC: Going disconnected; Routing engine chassis socket closed abruptly 
commit complete
Exiting configuration mode
</pre>
<p>If we take a sneaky peak at the PFE directly after the commit, we see the following:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show chassis fpc 
                     Temp  CPU Utilization (%)   CPU Utilization (%)  Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      1min   5min   15min  DRAM (MB) Heap     Buffer
  0  Offline         ---Restarted by cli command---
  1  Empty           
  2  Empty           
  3  Empty           
  4  Empty           
  5  Empty           
  6  Empty           
  7  Empty           
  8  Empty           
  9  Empty           
 10  Empty           
 11  Empty           
</pre>
<p>Enabling tunnel services caused the PFE to restart. It is at this point it gives birth to the logical tunnel interface, lt-0/0/10, amongst others. Periodically check the chassis to see if the PFE has come back up:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show chassis fpc    
                     Temp  CPU Utilization (%)   CPU Utilization (%)  Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      1min   5min   15min  DRAM (MB) Heap     Buffer
  0  Online           Testing  20         0       30     33     32    2047        7          0
  1  Empty           
  2  Empty           
  3  Empty           
  4  Empty           
  5  Empty           
  6  Empty           
  7  Empty           
  8  Empty           
  9  Empty           
 10  Empty           
 11  Empty           
</pre>
<p>Excellent! Now reboot the routing engine as indicated after the commit:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; request system reboot 
Reboot the system ? [yes,no] (no) yes 

                                                                               
*** FINAL System shutdown message from root@Llanelli ***                     

System going down IMMEDIATELY                                                  

                                                                               
Waiting (max 60 seconds) for system process `vnlru' to stop... done
Waiting (max 60 seconds) for system process `bufdaemon' to stop... done
Waiting (max 60 seconds) for system process `syncer' to stop... 
Syncing disks, vnodes remaining... 0 0 0 done
All buffers synced.
Uptime: 1h4m47s
Khelp module "jsocket" can't unload until its refcount drops from 4 to 0.
Rebooting...
cpu_reset: Stopping other CPUs</pre>
<p>Once the routing engine has come back up, it whistles to the packet forwarding engine to come hither. Once they're back in sync, we can proceed:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show chassis fpc    
                     Temp  CPU Utilization (%)   CPU Utilization (%)  Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      1min   5min   15min  DRAM (MB) Heap     Buffer
  0  Online           Absent   0          0        0      0      0      0         0          0
  1  Empty           
  2  Empty           
  3  Empty           
  4  Empty           
  5  Empty           
  6  Empty           
  7  Empty           
  8  Empty           
  9  Empty           
 10  Empty           
 11  Empty                
</pre>
<p>Not yet.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show chassis fpc    
                     Temp  CPU Utilization (%)   CPU Utilization (%)  Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      1min   5min   15min  DRAM (MB) Heap     Buffer
  0  Online           Testing  40         0       17      4      1    2047        7          0
  1  Empty           
  2  Empty           
  3  Empty           
  4  Empty           
  5  Empty           
  6  Empty           
  7  Empty           
  8  Empty           
  9  Empty           
 10  Empty           
 11  Empty</pre>
<p>Job done.</p>
<p> </p>
<p>Now let's check the pseudowire has come up:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show l2circuit connections status    
Layer-2 Circuit Connections:

Legend for connection status (St)   
EI -- encapsulation invalid      NP -- interface h/w not present   
MM -- mtu mismatch               Dn -- down                       
EM -- encapsulation mismatch     VC-Dn -- Virtual circuit Down    
CM -- control-word mismatch      Up -- operational                
VM -- vlan id mismatch           CF -- Call admission control failure
OL -- no outgoing label          IB -- TDM incompatible bitrate 
NC -- intf encaps not CCC/TCC    TM -- TDM misconfiguration 
BK -- Backup Connection          ST -- Standby Connection
CB -- rcvd cell-bundle size bad  SP -- Static Pseudowire
LD -- local site signaled down   RS -- remote site standby
RD -- remote site signaled down  HS -- Hot-standby Connection
XX -- unknown

Legend for interface status  
Up -- operational            
Dn -- down                   
Neighbor: 172.16.99.4 
    Interface                 Type  St     Time last up          # Up trans
    ps0.0(vc 1)               rmt   Up     Sep 20 17:29:48 2019           1
      Remote PE: 172.16.99.4, Negotiated control-word: Yes (Null)
      Incoming label: 16, Outgoing label: 299872
      Negotiated PW status TLV: No
      Local interface: ps0.0, Status: Up, Encapsulation: ETHERNET
      Flow Label Transmit: No, Flow Label Receive: No
</pre>
<p>It has!</p>
<p> </p>
<p>Now, let's check that our Cardiff subscribers have found their way over to us:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show subscribers 
Total subscribers: 0, Active Subscribers: 0</pre>
<p>Oh dear. What have I missed?</p>
<p> </p>
<p>A quick glance at Cardiff's access port highlights the error of my ways. I've enabled the CVLANs on the pseudowire instead of the SVLAN. Easily corrected:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Cardiff&gt; show configuration interfaces ge-0/0/3 | display set 
set interfaces ge-0/0/3 description "Access Provider 1"
set interfaces ge-0/0/3 flexible-vlan-tagging
set interfaces ge-0/0/3 encapsulation flexible-ethernet-services
set interfaces ge-0/0/3 unit 1 encapsulation vlan-ccc
set interfaces ge-0/0/3 unit 1 vlan-id-range 2-10	&lt;--------- CVLANs


root@Cardiff&gt; edit 
Entering configuration mode
root@Cardiff# set interfaces ge-0/0/3 unit 1 vlan-id 101          
root@Cardiff# commit and-quit 
commit complete
Exiting configuration mode</pre>
<p> </p>
<p>Let's check if that worked:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; show subscribers 
Interface             IP Address/VLAN ID                      User Name                      LS:RI
ps0.3221225472        0x8100.101 0x8100.2                                               default:default      
ps0.3221225473        0x8100.101 0x8100.3                                               default:default      
ps0.3221225474        0x8100.101 0x8100.4                                               default:default      
ps0.3221225475        0x8100.101 0x8100.5                                               default:default      
ps0.3221225476        0x8100.101 0x8100.6                                               default:default      
ps0.3221225477        0x8100.101 0x8100.7                                               default:default      
ps0.3221225478        0x8100.101 0x8100.8                                               default:default      
ps0.3221225479        0x8100.101 0x8100.9                                               default:default      
ps0.3221225480        0x8100.101 0x8100.10                                              default:default      
ps0.3221225472        203.0.113.2                             ps0:101-2                 default:default      
ps0.3221225473        203.0.113.3                             ps0:101-3                 default:default      
ps0.3221225474        203.0.113.4                             ps0:101-4                 default:default      
ps0.3221225475        203.0.113.5                             ps0:101-5                 default:default      
ps0.3221225476        203.0.113.6                             ps0:101-6                 default:default      
ps0.3221225477        203.0.113.7                             ps0:101-7                 default:default      
ps0.3221225478        203.0.113.8                             ps0:101-8                 default:default      
ps0.3221225479        203.0.113.9                             ps0:101-9                 default:default      
ps0.3221225480        203.0.113.10                            ps0:101-10                default:default</pre>
<p>Can we ping a subscriber?</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">root@Llanelli&gt; ping 203.0.113.2 count 3    
PING 203.0.113.2 (203.0.113.2): 56 data bytes
64 bytes from 203.0.113.2: icmp_seq=0 ttl=255 time=34.714 ms
64 bytes from 203.0.113.2: icmp_seq=1 ttl=255 time=40.958 ms
64 bytes from 203.0.113.2: icmp_seq=2 ttl=255 time=41.267 ms

--- 203.0.113.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 34.714/38.980/41.267/3.019 ms
</pre>
<p>Job done!</p>
<p>We've covered the basics of pseudowire headend termination.<br>In part 2, we'll look at RADIUS and CoS profiles, assuming I can coax vMX to comply :)</p>
<p> </p>
<p><strong>Versions<br></strong>vMX: 18.2R1.9<br>IOS: 15.2(4)M7</p>
<p><strong>Configs</strong><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/09/2_Llanelli.txt">2_Llanelli</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/09/2_Swansea.txt">2_Swansea</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/09/2_Newport.txt">2_Newport</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/09/2_Cardiff.txt">2_Cardiff</a><br><a href="http://www.msbnet.co.uk/wp-content/uploads/2019/09/2_AccessProvider1.txt">2_AccessProvider1</a></p>
            ]]>
        </content>
    </entry>
    <entry>
        <title>VLAN-Based Layer 2 Circuits with EoMPLS and l2circuit</title>
        <author>
            <name>Michael Bowen</name>
        </author>
        <link href="https://blog.msbnet.co.uk/vlan-based-layer-2-circuits-with-eompls-and-l2circuit/"/>
        <id>https://blog.msbnet.co.uk/vlan-based-layer-2-circuits-with-eompls-and-l2circuit/</id>
            <category term="Networks &amp; Security"/>

        <updated>2020-11-14T18:27:46+00:00</updated>
            <summary>
                <![CDATA[
                    I was recently asked to set up a LAN extension for a customer. After a spot of research, I was very impressed by this particular method which I've illustrated below. Based on IETF RFC 4447 (Pseudowire Setup and Maintenance Using the Label Distribution Protocol). Layer&hellip;
                ]]>
            </summary>
        <content type="html">
            <![CDATA[
                <p>I was recently asked to set up a LAN extension for a customer. After a spot of research, I was very impressed by this particular method which I've illustrated below.</p>
<p>Based on <a href="https://tools.ietf.org/html/rfc4447">IETF RFC 4447</a> <em>(Pseudowire Setup and Maintenance Using the Label Distribution Protocol).</em></p>
<p> </p>
<blockquote>
<p><em>Layer 2 services (such as Frame Relay, Asynchronous Transfer Mode, and Ethernet) can be "emulated" over an MPLS backbone by encapsulating the Layer 2 Protocol Data Units (PDU) and transmitting them over "pseudowires".</em></p>
</blockquote>
<p> </p>
<p>The service provider network is coloured orange and represents four towns/cities.<br>The customer network is coloured green with one site in Llanelli and one in Cardiff.</p>
<p><strong>Goal</strong><br>Extend the 10.77.11.0/24 network from Llanelli to Cardiff.</p>
<p> </p>
<figure class="size-full wp-image-51 aligncenter"><img loading="lazy"  src="https://blog.msbnet.co.uk/media/posts/1/img_5d448a31a20b8.png" sizes="(max-width: 48em) 100vw, 768px" srcset="https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-xs.png 300w ,https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-sm.png 480w ,https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-md.png 768w ,https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-lg.png 1024w ,https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-xl.png 1360w ,https://blog.msbnet.co.uk/media/posts/1/responsive/img_5d448a31a20b8-2xl.png 1600w"  alt=""></figure>
<p> </p>
<p>The end result should look like this when pinging the Llanelli site from Cardiff:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">TurboKart-LLA#show ip int br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down    
GigabitEthernet1/0         unassigned      YES NVRAM  up                    up      
GigabitEthernet1/0.11      10.77.11.1      YES NVRAM  up                    up      
GigabitEthernet2/0         unassigned      YES NVRAM  administratively down down    
GigabitEthernet3/0         unassigned      YES NVRAM  administratively down down    
GigabitEthernet4/0         unassigned      YES NVRAM  administratively down down    

TurboKart-LLA#ping 10.77.11.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.77.11.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/594/1012 ms
</pre>
<p> </p>
<p>I'm using vMX 18.2R1.9 for the service provider network. You can get a free trial from <a href="https://www.juniper.net/us/en/dm/free-vmx-trial/">Juniper's website</a>.<br>The customer network employs version 15.2 of the trusty C7200-ADVENTERPRISEK9-M.</p>
<p> </p>
<p><strong>Configuring the service provider network<br></strong>vMX is a hungry beast, requiring 2GB of RAM for the virtual control plane and 4GB for the virtual forwarding plane so, first things first, we'll configure the FPC for lite-mode. This reduces the requirement to 1GB and 2GB, respectively:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set chassis fpc 0 lite-mode</pre>
<p> </p>
<p>Next, pop an address on the loopback and then IP the core facing interfaces. Nothing fancy here. Enable the MPLS family on each interface, too:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set interfaces lo0 unit 0 family inet address 172.16.99.1/32
set interfaces lo0 unit 0 family mpls

set interfaces ge-0/0/1 unit 0 family inet address 10.10.1.1/24
set interfaces ge-0/0/1 unit 0 family mpls

set interfaces ge-0/0/2 unit 0 family inet address 10.10.2.1/24
set interfaces ge-0/0/2 unit 0 family mpls</pre>
<p> </p>
<p>Next, enable OSPF, LDP and MPLS under the protocols stanza:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set protocols mpls interface lo0.0
set protocols mpls interface ge-0/0/1.0
set protocols mpls interface ge-0/0/2.0
 
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface ge-0/0/2.0

set protocols ldp interface ge-0/0/1.0
set protocols ldp interface ge-0/0/2.0
set protocols ldp interface lo0.0</pre>
<p> </p>
<p>That's the core configuration wrapped up. Repeat for all four routers, tweaking the IPs.</p>
<p> </p>
<p><strong>Configuring the access ports<br></strong>For the customer-specific configuration, we'll need to configure an access port at each BT exchange (Llanelli and Cardiff) and a pseudowire (l2circuit) to transport the contents of that access port/VLAN to the other site. In this instance, we transport seven VLANs; 10 - 16. The following additional config is required:</p>
<p> </p>
<p><strong>Llanelli Exchange<br></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set interfaces ge-0/0/3 description "Access port"
set interfaces ge-0/0/3 flexible-vlan-tagging
set interfaces ge-0/0/3 encapsulation flexible-ethernet-services
set interfaces ge-0/0/3 unit 1000 description "TurboKart - Llanelli"
set interfaces ge-0/0/3 unit 1000 encapsulation vlan-ccc
set interfaces ge-0/0/3 unit 1000 vlan-id-range 10-16

set protocols l2circuit neighbor 172.16.99.4 interface ge-0/0/3.1000 virtual-circuit-id 1000
set protocols l2circuit neighbor 172.16.99.4 interface ge-0/0/3.1000 encapsulation-type ethernet
set protocols l2circuit neighbor 172.16.99.4 interface ge-0/0/3.1000 ignore-mtu-mismatch</pre>
<p> </p>
<p><strong>Cardiff Exchange<br></strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">set interfaces ge-0/0/3 description "Access port"
set interfaces ge-0/0/3 flexible-vlan-tagging
set interfaces ge-0/0/3 encapsulation flexible-ethernet-services
set interfaces ge-0/0/3 unit 1000 description "TurboKart - Cardiff"
set interfaces ge-0/0/3 unit 1000 encapsulation vlan-ccc
set interfaces ge-0/0/3 unit 1000 vlan-id-range 10-16

set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1000 virtual-circuit-id 1000
set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1000 encapsulation-type ethernet
set protocols l2circuit neighbor 172.16.99.1 interface ge-0/0/3.1000 ignore-mtu-mismatch</pre>
<p> </p>
<p>All done, time to test.<br>Let's ping our fictitious customer's Llanelli site from VLAN 11 at Cardiff:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">TurboKart-CAR#show ip int br    
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES NVRAM  administratively down down    
GigabitEthernet1/0         unassigned      YES NVRAM  up                    up      
GigabitEthernet1/0.11      10.77.11.2      YES NVRAM  up                    up      
GigabitEthernet2/0         unassigned      YES NVRAM  administratively down down    
GigabitEthernet3/0         unassigned      YES NVRAM  administratively down down    
GigabitEthernet4/0         unassigned      YES NVRAM  administratively down down    

TurboKart-CAR#sh run int g1/0.11
Building configuration...

Current configuration : 100 bytes
!
interface GigabitEthernet1/0.11
 encapsulation dot1Q 11
 ip address 10.77.11.2 255.255.255.0
end

TurboKart-CAR#ping 10.77.11.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.77.11.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 544/816/1676 ms
</pre>
<p>Job done!</p>
<p>There's lots more we could do here to compliment this setup so stay tuned :)</p>
            ]]>
        </content>
    </entry>
</feed>
