<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael de Silva</title>
    <description>The latest articles on DEV Community by Michael de Silva (@bsodmike).</description>
    <link>https://dev.to/bsodmike</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F149223%2Fe00414fe-8d40-468a-9fde-4a7c3a616450.png</url>
      <title>DEV Community: Michael de Silva</title>
      <link>https://dev.to/bsodmike</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bsodmike"/>
    <language>en</language>
    <item>
      <title>Rust Trait Objects Demystified</title>
      <dc:creator>Michael de Silva</dc:creator>
      <pubDate>Sun, 15 Aug 2021 05:44:29 +0000</pubDate>
      <link>https://dev.to/bsodmike/rust-trait-objects-demystified-54dk</link>
      <guid>https://dev.to/bsodmike/rust-trait-objects-demystified-54dk</guid>
      <description>&lt;p&gt;Dealing with Trait Objects in Rust is a trap for young players, especially when you want to obtain a composition of traits.&lt;/p&gt;

&lt;p&gt;Here's a deep-dive with code-examples and a Github repo for you to play with - Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://desilva.io/posts/rust-trait-objects-demystified"&gt;https://desilva.io/posts/rust-trait-objects-demystified&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rust</category>
    </item>
    <item>
      <title>HOWTO Improve your Developer Homelab/network with XCP-ng, pFSense, Ubiquity Unifi</title>
      <dc:creator>Michael de Silva</dc:creator>
      <pubDate>Tue, 18 Jun 2019 13:49:23 +0000</pubDate>
      <link>https://dev.to/bsodmike/howto-improve-your-developer-homelab-network-with-xcp-ng-pfsense-ubiquity-unifi-29nl</link>
      <guid>https://dev.to/bsodmike/howto-improve-your-developer-homelab-network-with-xcp-ng-pfsense-ubiquity-unifi-29nl</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In the background you'll see a simple PC build, in this case&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asus Z270 Prime-A&lt;/li&gt;
&lt;li&gt;16GB Crucial RAM&lt;/li&gt;
&lt;li&gt;Intel 6700K&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/2ISOpz4"&gt;StarTech.com Dual Port PCI Express (PCIe x4) Gigabit Ethernet Server Adapter - 2 Port Network Card - Intel i350 NIC - GbE Network Card&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/31H3Zqo"&gt;EVGA Supernova 750 P2, 80+ Platinum 750W, Fully Modular PSU&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the Asus UEFI make sure to enable Intel Virtualisation option.&lt;/p&gt;

&lt;h1&gt;
  
  
  System Config
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Installed XCP-ng v7.6 onto single SATA SSD.&lt;/li&gt;
&lt;li&gt;XCP-ng is tied to a &lt;em&gt;FreeNAS backend&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Mainboard Intel NIC used for XCP-ng management access - connected to internal EdgeRouter-x (ER-x) at gateway 10.0.0.1/24&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Appliance ports (yes, it's a PC though in this case...)
&lt;/h1&gt;

&lt;p&gt;It's important to note that these are configured accordingly in the XCP-ng control software&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NIC0: Mainboard Intel NIC&lt;/li&gt;
&lt;li&gt;NIC1: I350 port 1 // pfSense WAN (xn0)&lt;/li&gt;
&lt;li&gt;NIC2: I350 port 2 // pfSense LAN (xn1)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Ubiquity Unifi Switch 8 Managed PoE+ Gigabit Switch
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;I have Unifi controller software running in an Ubuntu VM, on my primary XCP-ng server.  This handles all provisioning and control over Unifi hardware.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The switch used here is the &lt;a href="https://www.ui.com/unifi-switching/unifi-switch-8-150w/"&gt;Unifi Switch 8 Managed PoE+ Gigabit Switch with SFP&lt;/a&gt; shown below on the left in silver/grey.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blue cable --&amp;gt; Connects to the 10.0.0.0/24 network from the ER-x router&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Yellow cable --&amp;gt; pfSense LAN&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;pfSense WAN port is also tied to the 10.0.0.0/24 network from the ER-x router&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Black cable --&amp;gt; Connect to my MacBook Pro.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Ubiquity Unifi Switch 8 Port Configuration
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Port 1: Set to default 'All' Network, which by default is VLAN1 (trunking port).&lt;/li&gt;
&lt;li&gt;Port 2: Set to a custom Profile tied to Native LAN &lt;strong&gt;VLAN2&lt;/strong&gt; // This is just a LAN profile with VLAN ID 2 and DHCP set to 'off'.  Profile is called &lt;strong&gt;Profile-VLAN2&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Port 3: Black cable to the MBP - in the image below is set to Network &lt;strong&gt;LAN&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice how the laptop has a 10.0.0.0/24 IP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J8P7sGSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hkqpl66qniacxpidqmif.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J8P7sGSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hkqpl66qniacxpidqmif.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, if we change the switch port Profile to &lt;strong&gt;Profile-VLAN2&lt;/strong&gt; -- the magic happens here -- the laptop now gets a 192.168.100.0/24 IP -- YAY!!  This is crucial, as this is a virtual port (xn1) within pfSense.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZItZ8s53--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/awh06fn0ji0du5k7fsjo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZItZ8s53--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/awh06fn0ji0du5k7fsjo.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Great, so why would you do this?
&lt;/h1&gt;

&lt;p&gt;By simply changing the port profile, any downstream traffic can now either be routed (1) straight from the main router (ER-x) or (2) through the ER-x ---&amp;gt; into the pFSense "Appliance" --&amp;gt; out the Black wire.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This setup allows you to &lt;em&gt;switch&lt;/em&gt; the physical network tied to the Black cable&lt;/strong&gt; 😀&lt;/p&gt;

&lt;p&gt;I've also got IDS (Intrusion detection system) running in pFSense in the form of Suricata, which at the moment monitors the WAN interface.&lt;/p&gt;

&lt;p&gt;I can also configure pFSense as an OpenVPN client, and all traffic through it will then be routed through a VPN -- my ultimate goal.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the advantage of XCP-ng (XenServer)
&lt;/h2&gt;

&lt;p&gt;XCP-ng (an opensource fork of Citrix XenServer) allows us to run pFSense in a Virtual Machine (VM) which allows us to setup periodic backups of said VM via cron-jobs from within XOA (Xen Orchestra).&lt;/p&gt;

&lt;p&gt;Since these are coupled to a FreeNAS backend, all backups are stored securely in ZFS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Downsides to this approach
&lt;/h2&gt;

&lt;p&gt;Right now, I don't have any need for VLANs through pFSense, but had I wanted to tag a VLAN entering the pFSense WAN port -- this is not possible as pfSense reports there are now VLAN capable interfaces attached.&lt;/p&gt;

&lt;p&gt;Xen/XCP-ng has support for SR-IOV but I haven't gone down that rabbit hole.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating VLANs
&lt;/h2&gt;

&lt;p&gt;I wanted to be able to tag traffic coming out of xn1 (pfSense-LAN port) with a custom VLAN tag, but couldn't find away to do this; (1) it seems pFSense doesn't have the ability to do this (??) but only tag/decode incoming traffic via the WAN interface (2) it wouldn't be possible since XCP-ng insulates it from VLAN capable hardware (which the I350 NICs are capable off, 802.1q).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I'd appreciate any correction to my statements above, as I'm sure there'll be someone better informed regarding tagging ports from within pFsense -- if it's possible, do let me know!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you got this far, share your thoughts -- I'm keen to hear from you!!&lt;/p&gt;

&lt;p&gt;Tweet to me &lt;a class="comment-mentioned-user" href="https://dev.to/bsodmike"&gt;@bsodmike&lt;/a&gt;
 :)&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>linux</category>
      <category>xcpng</category>
      <category>unifi</category>
    </item>
  </channel>
</rss>
