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:
Click 'read more' to see the CLI configuration...
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
- Log into your QNAP with SSH.
- 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
- Create the folder for your qpkg
mkdir /share/CACHEDEV1_DATA/.qpkg/my-network/
- 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
- 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
Comments
thank you, for the great howto.
Do you know a way, to bind an specific service, on one vlan? At the moment, there are all services on all vlan's. In the GUI, there is the second not visible, so there, I can't do any configuration.
Thank you.
Fabian
Starting with 4.3.3 qnap provides a new way for enabling autostart scripts.
It's described here: https://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup
So short way:
Enable autorun.sh:
Control Panel → Hardware → General: Run user defined startup processes (autorun.sh)
Enable Jumbo Frames up to MTU 9000:
Control Panel → network → Interfaces → Interface config → set MTU value to 9000
Mount config storage (Valid for AL-based NAS(TS-x31+ and TS-x31X) and TS-x31, other see Wiki Link):
ubiattach -m 6 -d 2
/bin/mount -t ubifs ubi2:config /tmp/config
Create / edit autorun.sh:
vi /tmp/config/autorun.sh
Content:
#!/bin/bash
# Configure MTU JumboFrames on bond0
# (Do it in WebGUI for main interface)
# Configure VLAN ID 90
ip link add link bond0 name bond0.90 type vlan id 90
# Configure IP address for this VLAN (not routed) and enable JumboFrames
/sbin/ifconfig bond0.90 10.10.90.10 broadcast 10.10.90.255 netmask 255.255.255.0
/sbin/ifconfig bond0.90 mtu 9000
# General Network Tuning
/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 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
Make autorun.sh executable and unmount config storage:
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
ubidetach -m 6
Enabling the service binding via WebUI and disabling iSCSI on the trunk where both vlan are configured disables binding to both ips. Even if just the first (via WebUi) configured ip is visible.
Perhaps there might be a way via QPKG to develop a package which is capable of adding multiple vlan interfaces to the WebUI. this might be a good starting point: https://wiki.qnap.com/wiki/QPKG_Development_Guidelines