2014-06-26

How to configure multiple VLANs on QNAP TS-869U

It's unbelievable that QNAP still doesn't support multiple VLANs on a single bond0 interface via GUI when they now just released the QTS v4.1.0 NAS Operation System for QNAP. The underlying Linux OS (QTS) does support it, and there should at least not be any problems with Intel chipsets. Some are reporting problems with Marvell.. but I haven't tried.

I wanted to use the QNAP as a iSCSI storage for my LAB using a second interface while having full redundancy and get max bandwith (2x1GbE) for my ESXi hosts, and I didn't want that interface routed. At the same time I of course need the possibility to manage the QNAP system via the main interface, which is routed.

This CLI "hack" will at configure the QNAP for a second VLAN interface that will be persistent during reboots. It's not been verified that it works after an upgrade of the firmware, but I presumed it will.

To get this to work I presume you already have the following working:
  • Network onfigured with LACP with an IP for management with gateway etc.
  • A small DataVolume created in your StoragePool.
    • I've created a volume of 10GB called 'SysVol01'
    • In this volume there should be a .qpkg folder: /share/CACHEDEV1_DATA/.qpkg
  • QTS v4.1.0 installed (only version I've tested - 2014-06-26)
  • Know how to login with ssh and edit files with 'vi'.

The configuration and output below indicates that I already have a VLAN 10 for management and I'm adding a VLAN 20 for iSCSI without gateway, and enable JumboFrames.

Click 'read more' to see the CLI configuration...

CLI Configuration

  1. Log into your QNAP with SSH.
  2. Edit QPKG config file to define your own "network package"

    vi /etc/config/qpkg.conf

    Input the following:

    [my-network]
    Name = autorun
    Version = 0.1
    Author = joffer
    Date = 2014-06-26
    Shell = /share/CACHEDEV1_DATA/.qpkg/my-network/autorun.sh
    Install_Path = /share/CACHEDEV1_DATA/.qpkg/my-network
    QPKG_File = my-network.qpkg
    Enable = TRUE

  3. Create the folder for your qpkg

    mkdir /share/CACHEDEV1_DATA/.qpkg/my-network/

  4. Create the autorun.sh script that will configure your aditional network settings

    vi /share/CACHEDEV1_DATA/.qpkg/my-network/autorun.sh

    Populate the script:

    #!/bin/bash
    
    # Configure MTU JumboFrames on bond0
    # (disabled here, done in WebGUI for main interface) 
    #/sbin/ifconfig bond0 mtu 9000
    
    # Configure a new VLAN - VLAN ID 20
    /usr/local/bin/vconfig add bond0 20
    
    # Configure IP address for this VLAN (not routed) and enable JumboFrames
    /sbin/ifconfig bond0.20 10.10.20.101 broadcast 10.10.20.255 netmask 255.255.255.0
    /sbin/ifconfig bond0.20 mtu 9000
    
    # General Network Tuning
    # Source: http://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup#Optimized_networking
    /sbin/ifconfig eth0 txqueuelen 50000
    /sbin/ifconfig eth1 txqueuelen 50000
    echo 1 > /proc/sys/net/ipv4/tcp_rfc1337
    echo 2 > /proc/sys/net/ipv4/tcp_frto
    echo 2 > /proc/sys/net/ipv4/tcp_frto_response
    echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing
    echo 1 > /proc/sys/net/ipv4/tcp_window_scaling
    echo 1 > /proc/sys/net/ipv4/tcp_workaround_signed_windows
    echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
    echo 0 > /proc/sys/net/ipv4/tcp_tw_recycle
    echo 1 > /proc/sys/net/ipv4/tcp_low_latency
    echo 1 > /proc/sys/net/ipv4/tcp_ecn

  5. Log out and restart to verify that it works. You need to log into the box with SSH and run 'ifconfig' or 'ip a' to see the extra network configuration. The WebGUI only shows the default configuration. Example (#6 shows the new VLAN Interface):

    [~] # ip a
    
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
    2: eth1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9000 qdisc pfifo_fast master bond0 state DOWN qlen 50000
        link/ether 00:08:9b:d4:ff:32 brd ff:ff:ff:ff:ff:ff
    3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast master bond0 state UP qlen 50000
        link/ether 00:08:9b:d4:ff:32 brd ff:ff:ff:ff:ff:ff
    4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP
        link/ether 00:08:9b:d4:ff:32 brd ff:ff:ff:ff:ff:ff
    5: bond0.10@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
        link/ether 00:08:9b:d4:ff:32 brd ff:ff:ff:ff:ff:ff
        inet 10.10.10.101/24 brd 10.10.10.255 scope global bond0.10
    6: bond0.20@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP
        link/ether 00:08:9b:d4:ff:32 brd ff:ff:ff:ff:ff:ff
        inet 10.10.20.101/24 brd 10.10.20.255 scope global bond0.20

Post a Comment