booting from non-native(dot1q) VLAN



  • Hi,

    I have an environment where I do not have the ability to configure a native VLAN.

    I have the ability to configure a VLAN for PXE in the BIOS, which is working correctly, but I am struggling to see if it’s possible to then have the system continue to use that VLAN ID for imaging etc. It is failing currently to get an IP as I believe it’s dropping back to native vlan once it’s pulled the ‘udionly.kpxe’ loader.

    Any hints/kernel options etc would be appreciated - or a ‘no, this isn’t possible’.


  • Developer

    @george1421 Nice work George!!


  • Moderator

    Ok after a lengthy discussion in chat we have a working solution with the updated bzImageVLAN and the patched vlinit.xz files. Since ipxe WAS getting an ip address in this configuration we could avoid all of the syslinux configuration stuff and just go into FOG and update the kernel and init with the new names, then under kernel args add in vlan=2223. The OP setup a debug task on the FOG server and pxe booted into FOS. FOS picked up the right IP address on the vlan and we are golden. The OP was going to try to image using this setup, but since FOS got the right IP address the reset should be just normal fog stuff.

    @Developers While this is a fringe (one-off) case, I don’t see any real value in integrating it into the FOG kernels, but I’ll document it here.

    1. I added the vlan support by Networking support->Networking options-> 802.1Q/802.1ad VLAN Support then recompiled the kernel.
    2. I unpacked the current inits with the guidance from here: https://wiki.fogproject.org/wiki/index.php/Modifying_the_Init_Image
    3. I updated the /etc/init.d/S40network startup script by adding
    # At the top
    . /usr/share/fog/lib/funcs.sh
    vlid="$vlan"
    
    #then in the ifaces loop
        echo "Starting $iface interface and waiting for the link to come up"
    
        if [ -z "$vlid" ]; then
            echo -e "auto $iface\niface $iface inet dhcp\n\n" >> /etc/network/interfaces
        else
            echo -e "auto $iface\niface $iface inet manual\n\n" >> /etc/network/interfaces
            echo -e "auto $iface.$vlid\niface $iface.$vlid inet dhcp\n    vlan-raw-device $iface\n\n" >> /etc/network/interfaces
            echo "Waiting for physical adapter to be ready"
            /sbin/ip link set $iface up
            sleep 10
            echo "Assigning vlan $vlid to interface $iface"
            vconfig add $iface $vlid
            iface="$iface.$vlid"
        fi
        echo "Brining up network interface $iface"
        /sbin/ip link set $iface up
    
        # Wait till the interface is fully up and ready (spanning tree)
    
    1. Then I repacked the inits and sent them with the bzImageVLAN kernel to the OP for testing.

    With this method I added a new kernel parameter called vlan which sets the proper vlan and brings up that interface. The only caveat with this code is that if there are multiple interfaces that defined VLAN will be created on each interface until it finds one that works.

    Here is the patched S40network startup script.
    S40network.txt


  • Moderator

    @Gribbly Look at the forum chat bubble for a few additional hints.


  • Moderator

    @Gribbly Ok I have a working solution on the FOS/linux side. Below is the grub configuration needed to boot FOS from a USB drive. You will need to take this information and integrate it into your environment.

    The new FOS kernels and inits are bzImageVLAN and vlinit.xz that will be used to boot FOS. Since you don’t have the tight integration with iPXE the grub there are different kernel parameters for different actions that FOG takes. You shall see the examples of these below. The only thing you really have to remember is that when you go to image with FOG using this method you MUST schedule the task first in the web ui before pxe booting the target computer and selecting #1 from the grub menu.

    set myfogip=192.168.1.50
    set myimage=/boot/bzImageVLAN
    set myinits=/boot/vlinit.xz
    set myloglevel=4
    set timeout=-1
    insmod all_video
    
    menuentry "1. FOG Image Deploy/Capture" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=vlinit.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 vlan=2223
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    
    menuentry "2. Perform Full Host Registration and Inventory" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=vlinit.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=manreg vlan=2223
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    
    menuentry "3. Quick Registration and Inventory" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=vlinit.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=autoreg vlan=2223
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    
    menuentry "4. Client System Information (Compatibility)" {
     echo loading the kernel
     linux  $myimage loglevel=$myloglevel initrd=vlinit.xz root=/dev/ram0 rw ramdisk_size=127000 keymap= web=$myfogip/fog/ boottype=usb consoleblank=0 rootfstype=ext4 mode=sysinfo vlan=2223
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    
    menuentry "6. FOG Debug Kernel" {
     echo loading the kernel
     linux  $myimage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 keymap= boottype=usb consoleblank=0 rootfstype=ext4 mdraid=true isdebug=yes vlan=2223
     echo loading the virtual hard drive
     initrd $myinits
     echo booting kernel...
    }
    
    


  • @george1421 Thank you! Please let me know if you need any more info or for me to test anything here!


  • Moderator

    @Gribbly OK let me recompile the FOS kernel and then I’ll load it into by debug environment in the AM. I should know pretty quickly if I can get vlan tagging to work.



  • @george1421

    Yes sir, i’m using VLAN_ID 2223 here.


  • Moderator

    @Gribbly Well then let me see what I can do. The vlid in question is 2223? This sounds just challenging enough to pique my interest to see if I can do it.



  • I am able to load the Ubuntu Installer Kernel, which has VLAN support. Using the Expert configuration, it gives me the ability to configure a VLAN ID.


  • Moderator

    @Gribbly said in booting from non-native(dot1q) VLAN:

    I’ll go back to my pxe ubuntu install

    How are you doing this? This method supports vlan tagging? Can you load a custom bzImage (linux kernel) and inits with this method?



  • @george1421

    Thank you for your time. This is what my conclusion had been - apologies if I wasn’t clear with what I was trying to get across!

    I’ll go back to my pxe ubuntu install - which I am able to get working, but obviously without the benefit of just imaging!


  • Moderator

    @Gribbly said in booting from non-native(dot1q) VLAN:

    The kernel loads and attempts to grab a DHCP address. It does this without the VLAN TAG.

    Ok in this case the iPXE boot kernel knows nothing about vlans so it will always communicate untagged to the network switch. We can bypass iPXE, but then we run into the issue of FOS not (currently) supporting vlans. I’ve done some kernel development work and I know that FOS kernel doesn’t have the 802.1q code installed (but could have). Since FOS is linux we could get it to support vlans. That would just require a custom kernel and inits. The root of the issue at the moment then would be to get FOS to boot on this target computer without using iPXE. I can get FOS to boot from usb as well as from an ISO image but I’m not sure if that will help here. You may be out of luck. But let me think about it. I could compile the linux kernel in the AM to include the 802.1q code and then test getting FOS to support vlan trunking. It shouldn’t be too hard ™.



  • @george1421

    The machine I am trying to image is on a trunk port. I am using ubuntu there. The fog server is natively in the vlan no trunking.

    Effectively this is what happens:

    BIOS -> Allows me to configure a VLAN TAG for PXE.
    Machine boots, PXE gets a DHCP address from the configured trunk port - using the configured VLAN TAG, and downloads the kernel.
    The kernel loads and attempts to grab a DHCP address. It does this without the VLAN TAG.
    As the blade only has access via a trunk port, it fails to get the DHCP at this point and is unable to continue accessing the FOG server.


  • Moderator

    @Gribbly said in booting from non-native(dot1q) VLAN:

    The network which I need to communicate with my fog server from is tagged (on VLAN ID 2223) to the host, not native/untagged.

    Hopefully you are using the wrong words for how you have things setup. I’m trying to understand how you have things setup. So to your fog server and your clients they are all on vlan trunk ports where they only communicate over tagged linked? This is somewhat unusual especially with Win10 and its now complexity to setup vlan tagged adapters.

    Just for clarity the native vlan has nothing to do with the VLID of an access port. Are you saying you can’t change the VLID of any network port where the VLID is always set to the native vlan?



  • @george1421

    In this example, the target machine is a blade in a chassis. The network which I need to communicate with my fog server from is tagged (on VLAN ID 2223) to the host, not native/untagged.

    My BIOS allows me to configure a VLAN ID for the PXE boot. The machine boots, PXE grabs an IP address via the tagged VLAN, and downloads the undionly.kpxe kernel. This is then attempting to get an IP address via DHCP on eth0 and failing, so unable to continue the communication with the Fog server. Ideally, I would like it to be using eth0.2223 (VLAN 2223 on the eth0 interface).


  • Moderator

    What does the native vlan, or vlans in general have to do with imaging? FOG doesn’t understand vlan trunking at all. FOS will only understand untagged network traffic.

    How do you have the switch port configured where the target computer is plugged in?

    If I can read between the lines here. Undionly,kpxe is being transferred tot the target computer, but undionly.kpxe (boot kernel) is failing to get an IP address? Is that what you are saying? If so that sounds more like a spanning tree issue than anything related to vlans. Please explain a bit more about what you are seeing happen during booting.


Log in to reply
 

502
Online

6.1k
Users

13.5k
Topics

127.4k
Posts