<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vlans on BeyondVM</title>
    <link>https://www.beyondvm.com/tags/vlans/</link>
    <description>Recent content in Vlans on BeyondVM</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Content Copyright 2015&#43; Ben Thomas</copyright>
    <lastBuildDate>Tue, 11 Mar 2014 00:00:00 +0000</lastBuildDate>
    <category>technology</category><category>vmware</category><category>automation</category>
    <atom:link href="https://www.beyondvm.com/tags/vlans/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Quick Tip: Bonding, LACP, and VLANs in Linux</title>
      <link>https://www.beyondvm.com/2014/03/quick-tip-bonding-lacp-and-vlans-in-linux/</link>
      
      <category>Linux</category>
      
      <category>Networking</category>
      
      <category>Quick Tips</category>
      
      <pubDate>Tue, 11 Mar 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.beyondvm.com/2014/03/quick-tip-bonding-lacp-and-vlans-in-linux/</guid>
      <description>

&lt;p&gt;I have been doing a lot of tinkering with linux based storage (more to come on that!) over the past few weeks and I had to hunt and peck around the internet to find all of the information on using bonding/lacp and vlans in linux so I want to bring it all to one place.  All of these configuration files are from Ubnutu but the format should be similar in other distros.  All of the switch configurations were on a Cisco 2960 running IOS 12.2-lanbase which is a fairly old and basic switch.&lt;/p&gt;

&lt;h2 id=&#34;linux-setup:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Linux Setup&lt;/h2&gt;

&lt;p&gt;There are two modules to install for this setup, bonding and 8021q.  As follows:&lt;/p&gt;

&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    Linux Setup
  &lt;/div&gt;
  &lt;pre class=&#34;language-console line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
#install packages
# NOTE: ensure ifenslave 2.6 is what gets installed, required for VLANs
root@filer:~# apt-get install -y ifenslave vlan

#load modules manually to be sure
root@filer:~# modprobe 8021q
root@filer:~# modprobe bonding

#add to modules for reboots
root@filer:~# echo &#39;bonding&#39; &gt;&gt; /etc/modules
root@filer:~# echo &#39;8021q&#39; &gt;&gt; /etc/modules
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2 id=&#34;basic-bonding-using-lacp:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Basic Bonding using LACP&lt;/h2&gt;

&lt;h3 id=&#34;linux:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Linux&lt;/h3&gt;

&lt;p&gt;This is the linux side of this link, the important part here is the bond-mode needs to be set to 802.3ad or mode 4.&lt;/p&gt;

&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    Eth Config
  &lt;/div&gt;
  &lt;pre class=&#34;language-bash line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
#slave interfaces
auto eth4
iface eth4 inet manual
bond-master bond0

auto eth5
iface eth5 inet manual
bond-master bond0

#bond interface
auto bond0
iface bond0 inet static
        address 192.168.1.10
        netmask 255.255.255.0
        #there are several modes, this is also known as mode 4
        bond-mode 802.3ad
        bond-miimon 100
        bond-slaves eth4 eth5
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3 id=&#34;cisco-2960:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Cisco 2960&lt;/h3&gt;

&lt;p&gt;This is the configuration of the two switch ports and the port channel on the Cisco switch.  The important part here is using ‘active’ mode on the channel group.&lt;/p&gt;

&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    Port Channels
  &lt;/div&gt;
  &lt;pre class=&#34;language-cisco line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
!vlan 10 is my storage VLAN
interface Port-channel1
 switchport access vlan 10
end

interface GigabitEthernet0/43
 switchport access vlan 10
 channel-group 1 mode active
end

interface GigabitEthernet0/44
 switchport access vlan 10
 channel-group 1 mode active
end
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2 id=&#34;bonding-with-vlan-trunking:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Bonding with VLAN Trunking&lt;/h2&gt;

&lt;p&gt;Most people need to use both VLANs and 802.3ad trunking in the real world, especially for storage, as it turns out that is pretty easy.  In this example I only have one VLAN but the setup can be repeated for each additional VLAN.  Also on the “base” interface I don’t have any configuration, this is where the “native” IP configuration would go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This configuration can also be applied to a non-bonded interface.&lt;/p&gt;

&lt;h3 id=&#34;linux-1:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Linux&lt;/h3&gt;

&lt;p&gt;This is the linux side of this link, the important part here is the bond-mode needs to be set to 802.3ad or mode 4.&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    Eth Config
  &lt;/div&gt;
  &lt;pre class=&#34;language-bash line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
#slave interfaces
auto eth4
iface eth4 inet manual
bond-master bond0

auto eth5
iface eth5 inet manual
bond-master bond0

#bond interface
auto bond0
iface bond0 inet static
        #native vlan, need ip to configure
        address 1.1.1.1
        netmask 255.255.255.0
        bond-mode 802.3ad
        bond-miimon 100
        bond-slaves eth4 eth5

auto vlan10
iface vlan10 inet static
        address 192.168.1.10
        netmask 255.255.255.0
        broadcast 192.168.1.255
        vlan-raw-device bond0
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;h3 id=&#34;cisco-2960-1:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;Cisco 2960&lt;/h3&gt;

&lt;p&gt;This is also similar to the other configuration, the ‘switchport trunk allowed’ section is optional, I wanted to prune the VLANs for this link.&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    Port Channels
  &lt;/div&gt;
  &lt;pre class=&#34;language-cisco line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
!vlan 10 is my storage VLAN
interface Port-channel1
 switchport trunk allowed vlan 10
 switchport mode trunk
end

interface GigabitEthernet0/43
 switchport trunk allowed vlan 10
 switchport mode trunk
 channel-group 1 mode active
end

interface GigabitEthernet0/44
  switchport trunk allowed vlan 10
  switchport mode trunk
 channel-group 1 mode active
end
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;This is a pretty simple setup, post a comment with suggestions or requests for more information and I will keep this post up to date.&lt;/p&gt;

&lt;h2 id=&#34;references:491d5bb752816bfa6ee8267c044fd27e&#34;&gt;References&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://help.ubuntu.com/community/UbuntuBonding&#34;&gt;UbuntuBonding&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://www.cisco.com/c/en/us/td/docs/ios/12_2sb/feature/guide/gigeth.html&#34;&gt;Cisco LACP Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wiki.ubuntu.com/vlan&#34;&gt;Ubuntu VLAN Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://manpages.ubuntu.com/manpages/hardy/man5/vlan-interfaces.5.html&#34;&gt;Ubuntu VLAN Interfaces manpage&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>

    </item>
    
    <item>
      <title>Quick Tip: Register all VMs on a datastore</title>
      <link>https://www.beyondvm.com/2014/03/quick-tip-register-all-vms-on-a-datastore/</link>
      
      <category>CLI</category>
      
      <category>ESXi</category>
      
      <category>Quick Tips</category>
      
      <pubDate>Thu, 06 Mar 2014 00:00:00 +0000</pubDate>
      
      <guid>https://www.beyondvm.com/2014/03/quick-tip-register-all-vms-on-a-datastore/</guid>
      <description>&lt;p&gt;Today I had an entire datastore of VMs to register, probably about 30 in total, and I didn’t want to go through the GUI and register each VM manually.&lt;/p&gt;

&lt;p&gt;I came up with this quick unix one-liner:&lt;/p&gt;

&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    
  &lt;/div&gt;
  &lt;pre class=&#34;language-bash line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
# NOTE: My datastore path is /vmfs/volumes/5317a80e-add165f6-ada9-001517599f73
# replace this with whatever datastore needs searching

#VMs
find /vmfs/volumes/5317a80e-add165f6-ada9-001517599f73 -name &#34;*.vmx&#34; -exec  vim-cmd solo/registervm {} \;

#Templates
find /vmfs/volumes/5317a80e-add165f6-ada9-001517599f73 -name &#34;*.vtmx&#34; -exec  vim-cmd solo/registervm {} \;
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Which gave me this:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;code-wrapper&#34;&gt;
  &lt;div class=&#34;code-header&#34;&gt;
    
  &lt;/div&gt;
  &lt;pre class=&#34;language-bash line-numbers&#34; data-line=&#34;&#34; data-start=&#34;1&#34;&gt;&lt;code class=&#34;codeblock&#34;&gt;
/vmfs/volumes/5317a80e-add165f6-ada9-001517599f73 # find /vmfs/volumes/5317a80e-add165f6-ada9-001517599f73 -name &#34;*.vmx&#34; -exec  vim-cmd solo/registervm {} \;
143
144
...
...
...
148
149
/vmfs/volumes/5317a80e-add165f6-ada9-001517599f73 #
&lt;/code&gt;&lt;/pre&gt;
  &lt;div class=&#34;code-footer&#34;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;There are more elegant ways to do this in PowerCLI that are probably more scaleable (not registering everything on one host, for example) but this is a quick, down and dirty way to get the job done!&lt;/p&gt;
</description>

    </item>
    
  </channel>
</rss>
