[HOWTO] Bridging on QNAP TS-412

Don't miss a thing. Post your questions and discussion about other uncategorized NAS features here.
Post Reply
Lorenz0
Starting out
Posts: 11
Joined: Sat Apr 09, 2011 12:40 am

[HOWTO] Bridging on QNAP TS-412

Post by Lorenz0 »

Hi everyone,

I’d like to share with you my bridging setup. All credit goes to the guy who write this: http://orion195.muppetslab.org/qnap-gig ... connection. Probably the following will work also on other ARM based QNAPs, but I don’t want to generalize unduly my personal experience. If it worked for you, please post your experiences below…

So why would you want to bridge your two interfaces?
  • You’re a cheap b*stard or for some other reason you don’t want to buy a gigabit switch (e.g. “I just need one more port!”)
  • Compared with routing (ip_forwarding) you don’t have to alter your routing table or — worse — run a routing protocol, and the Bonjour/Zeroconf/SSDP magic will continue to work
  • You want to try out all Linux Kernel features before you die :mrgreen:
And why wouldn’t you want to?
  • You love the comfort of being able to complain if something doesn’t work afterwards — needless to say, but all of this is rigorously unsupported by QNAP!
  • You’re not at ease on the Linux command line
  • Your current setup just works — remember: if it ain’t broken don’t fix it.
Yada, Yada, let’s begin!
  • Install Optware IPKG
  • The bridging functionality is contained in two loadable modules in /usr/local/modules, but we need the bridge-utils package to configure it:

Code: Select all

/opt/bin/ipkg install bridge-utils
  • Put the following script anywhere you like — do not put it yet in /opt/etc/init.d/! I suggest to first modify it and give it a dry run… (script.sh start) That way, if it locks you out you can just reboot the device and your former network settings will be restored. When you are confident that it does its job (do all services work?), put it in /opt/etc/init.d/S05bridge, (don’t forget to chmod +x it!) so that it will be executed after the standard /etc/rcS.d scripts, but before any ipkg services (e.g. named).
/opt/etc/init.d/S05bridge:

Code: Select all

#!/bin/sh
# Setup bridging
SERVICES="atalk.sh twonkymedia.sh Qthttpd.sh rsyncd.sh bonjour.sh ntpclient.sh transmission.sh smb.sh " #Modify this list to suit your needs…

case "$1" in
  start)
    /bin/echo -n "Stopping network services.... "
    for i in $SERVICES
    do
      if [ -f /etc/init.d/$i ]; then
        echo -n "$i "
        /etc/init.d/$i stop 1>>/dev/null 2>>/dev/null
      fi
    done
    sleep 1
    
    /bin/echo "Initializing Bridge"
          insmod /usr/local/modules/stp.ko
          insmod /usr/local/modules/bridge.ko
          ifconfig eth0 0.0.0.0
          ifconfig eth1 0.0.0.0
          /opt/sbin/brctl addbr br0
          /opt/sbin/brctl addif br0 eth0 eth1
          ifconfig br0 192.168.2.10 netmask 255.255.255.0 # Modify this!
          route add default gw 192.168.2.254
  
    /bin/echo -n "Restarting network services... "
    for i in $SERVICES
    do
      if [ -f /etc/init.d/$i ]; then
        echo -n "$i "
        /etc/init.d/$i start 1>>/dev/null 2>>/dev/null
      fi
    done
  ;;

  *)
esac
You’ll have to adapt the services list to your needs, maybe ps will be useful.

Additional remarks regarding services:
  • Obviously you don’t need to do anything for sevices that launch after this script gets executed
  • Philippe (father_mande) informs me below (thanks!) that some (most?) services don’t need to be relaunched iff the new bridge interface has an IP formerly assigned to one of the now bridged interfaces.
    These are (incomplete list):
    • ssh
    • Qthttpd
    • samba
    • ...
  • Some other services use a different way to send packets and won’t simply change over to our new br0 interface. They need to be restarted in any case. These are (incomplete list):
    • dhcpd (Qnap used as dhcp server)
    • atalk (needed for AFP)
    • twonkymedia server (third party UPNP server)
    • upnpd (QNAPs UPNP server)
    • ...
  • Other services have more serious issues and tend to jump off the bridge instead of crossing it! ok, that was lame…
    These are (incomplete list):
    • Vlan
    • MyCloudNas
    • ...
ifconfig output after successful bridging:

Code: Select all

br0       Link encap:Ethernet  HWaddr 00:08:9B:12:34:56  
          inet addr:192.168.2.10  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:24461929 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6977196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3832271112 (3.5 GiB)  TX bytes:652711934 (622.4 MiB)

eth0      Link encap:Ethernet  HWaddr 00:08:9B:12:34:56  
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:11893452 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15910936 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:532 
          RX bytes:871388924 (831.0 MiB)  TX bytes:1173610636 (1.0 GiB)
          Interrupt:15 

eth1      Link encap:Ethernet  HWaddr 00:08:9B:12:34:57 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14415456 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11943097 errors:0 dropped:15 overruns:0 carrier:0
          collisions:0 txqueuelen:532 
          RX bytes:4098383521 (3.8 GiB)  TX bytes:1534105799 (1.4 GiB)
          Interrupt:11 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:68661 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68661 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4484202 (4.2 MiB)  TX bytes:4484202 (4.2 MiB)
Please report you findings below!
Last edited by Lorenz0 on Tue Jun 14, 2011 11:30 pm, edited 1 time in total.
Lorenz0
Starting out
Posts: 11
Joined: Sat Apr 09, 2011 12:40 am

Re: [HOWTO] Bridging on QNAP TS-412

Post by Lorenz0 »

Salut Philippe,

thanks for your suggestions, I will revise the first post!

Regarding the QPKG: unfortunately I am in midst of an exam period, maybe I will look into this in three weeks or so, sorry…!
Also I don’t have any experience regarding QPKGs, can you point me to some useful references?

Best wishes,
Lorenzo
Post Reply

Return to “Miscellaneous”