Monday, December 05, 2011

Setting up a SMB server on a HG556a router


Vodafone Huawei HG556a
I wanted to have my external 1TB harddisk available from every computer in the home LAN, but I didn’t want to have a computer running all day. To achieve this challenge I look into the specs of the Vodafone router I have (Huawei HG556a):

Apparently, if a harddisk is connected to the router, it is mounted and can be accessed via FTP or DLNA. However, although it’s not said in the router configuration page, it also runs a SAMBA server which allows MS Windows computers (and other os with smb support) to access the harddisk as a “shared folder”.

It seemed that it was exactly what I wanted, but it wasn’t. I tried to see the contents of the harddrive through a PC and I was able to do it, but when I attempted to copy a 700MB file to the drive an error message appeared saying that it wasn’t enough free space! There was obviously something wrong...
Even if I deleted files, it reported that there was only 29MB left, which made the huge harddrive useless.

Accessing the router through telnet (changing the default admin password is needed) I discoverd that the hardisk was being mount at /var/mnt/USBDrive_1/ and the content of /etc/samba/smb.conf was:
# cat /etc/samba/smb.conf[global]   workgroup = vodafone   netbios name = vodafone   server string = vodafone   security = share[Share]   path = /var/mnt/   comment = Share files   browseable = yes   public = yes   writable = yes   guest ok = yes
With these settings, when accessing through SAMBA it was reported the free space in the router (/var/mnt/), instead of the harddisk.
Changing the path to the real mount-point of the harddisk (/var/mnt/USBDrive_1/) I got ride of that “29MB left” error message, allowing me to copy bigger files.

To modify the smb.conf file I had to copy it to the harddrive, edit it in my laptop and then overwrite the original file, because the small linux installed in the router doesn’t have vi or nano to edit text files. Of course, you need to restart the smbd daemon and repeat these steps every time the adsl router is restarted.

I also improved a bit the data rate killing the snmp and ftp service. However, it is still not very good (<3MBps), but it seems to be a global problem of hg556a. So, if anybody knows how to make this fix permanent or improve the datarate, contact me!