D-Link Forums

The Graveyard - Products No Longer Supported => D-Link Storage => DNS-320 => Topic started by: Moley85 on February 07, 2012, 09:49:29 AM

Title: Make dns320 the master browser
Post by: Moley85 on February 07, 2012, 09:49:29 AM
hey all

im having problems with making my 320 the master browser on my network

im running debian squeeze that came from the dlink ftp. After i ssh into root, and look at the smb.conf file in /etc/samba/, i can see straight away that local master= no

after editing this with nano to yes, adding the lines domain master = yes and prefered master = yes and saving the file i restart my nas drive. This is where i have the problem, looking at the smb.conf file after a reboot, my changes have been overwritten back to the default settings

how can i go about making these changes permenant?

Also how can i manually restart samba to test if what i have edited works, ive tried:
       service smb restart - doesnt work as there is no reference to a samba script in the init.d folder??
       /usr/bin/smb restart - same as above
       /usr/sbin/smb restart - same again

wish dlink would add more options to there firmware!

can anyone help??
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 12:31:28 AM
You can't edit file(s) in /etc directly as it's residing on the RAM and will be lost when the NAS reboot.

One simple solution is to create a copy from /etc/samba and save it somewhere on the HD. Edit this copy and re-copy back whenever the NAS boot-up. You can made use fun_plug.local located in /ffp/etc for this purpose.

I tested it out and work as expected but the question is how does one determine if the NAS has indeed become the Master Browser!
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 01:47:44 AM
Yes that is what I am aiming to do, but it would require a restart of the samba service to make my changes come into affect wouldn't it, or can we make the changes before the samba service starts?

To see if the 320 is the master browser you can use a windows program called LANscanner,  http://scottiestech.info/2009/02/14/how-to-determine-the-master-browser-in-a-windows-workgroup/ (http://scottiestech.info/2009/02/14/how-to-determine-the-master-browser-in-a-windows-workgroup/)
 It will tell u who the master is on your network

If you got it working can you make some step by step instructions on what you did?
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 03:45:31 AM
I have tried the program you mentioned before I posted my earlier reply and output is still the same, ie. my PC is still the Master Browser (MB), before/after the changes to smb.conf.

At the moment, I have no idea how the MB role work on samba so it's hard to determine the exact cause. BTW, why do you need the DNS-320 to be the MB?
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 04:22:18 AM
I'm using an atv2 with xbmc on it

I am unable to add the nas drive as a source unless my pc is on (takes the role of master browser), as the nas is defaulted to never be the master browser, and doesnt have an option to take on the role (which is really odd compared to other nas drives) if I have my pc switched off I cannot browse the nas drive without constantly typing out the device name or it's IP address.

All this wouldn't be a problem if the nas was the master browser, as my pc is hardly on anymore, we're as the nas is on 24/7. It makes sense in my case for the nas to be the master browser
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 04:59:06 AM
The problem will be that the samba service is loaded up before you have copied over your changes, so it's using the old smb.conf

If we can restart the samba service after the change, or manage to copy the changed smb.conf file before the service starts then were onto a winner
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 05:35:04 AM
I did restart smb process using the edited copy and result still the same. Maybe I should power off my PC after that I see if it made a difference.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 07:21:31 AM
Can you tell me the command u used to restart samba?

Turn everything off, then Power on slow time everything starting with the nas first
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 07:25:38 AM
Okay, managed to get it to work.

Changes made to smb.conf save it somewhere on the HD.
Code: [Select]
local master = yes
prefered master = yes

Create or edit /ffp/etc/fun_plug.local and add the following:
Code: [Select]
cp <location of edited smb.conf> /etc/samba
smb restart

The only disadvantage of this solution is that every time you made changes under Account Management you need to made a new copy from original source (/etc/samba/smb.conf) and edit it.

Hope this help.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 08:10:20 AM
You sir are my hero! Thanks very much!

just gonna test it out now, only other thing is that im using debian squeeze, does it still reference to the ffp folder?

edit: "smb restart" doesnt work, comes up "-bash: smb: command not found"
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 08:30:23 AM
If you have "install" debian squeeze, you must already have FFP installed. You should be using either telnet or ssh (started from FFP) to remote into your NAS and not into debian chroot environment.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 08:36:56 AM
ok so if i change the "fun_plug" file from debian squeeze to using fonz fun_plug?

will that mean that debian will not be booted? as i run all my python scripts from debian?
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 08:48:02 AM
Please post only the changes made to fun_plug and other related file(s) if any with regard to debian.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 08:52:37 AM
to boot debian i have to use the fun_plug dlink supplied with their version of debian squeeze:

Code: [Select]
#!/bin/sh

# Root DISK1
export DISK1=/mnt/HD/HD_a2
export DISTDIR=squeeze

cd $DISK1

mount --bind $DISK1 $DISTDIR$DISK1
mount --bind / $DISTDIR/mnt/root
mount --bind /dev $DISTDIR/dev
mount --bind /sys  $DISTDIR/sys
#mount --bind /sys/crfs $DISTDIR/sys/crfs
#mount --bind /web $DISTDIR/web
mount --bind /proc $DISTDIR/proc

cp -f /proc/mounts $DISTDIR/etc/mtab
rm -f $DISTDIR/etc/fstab
touch $DISTDIR/etc/fstab
cp -f /etc/resolv.conf $DISTDIR/etc
hostname >$DISTDIR/etc/hostname
cp -f /etc/hosts $DISTDIR/etc

$DISK1/$DISTDIR/boot/chroot $DISK1/$DISTDIR /boot/linuxrc




heres my linuxrc file

Code: [Select]
#!/bin/sh

#export PATH="/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"

export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
export ETCDIR="/etc"
export SBINDIR="/sbin"
export HOME="/root"
export BINDIR="/bin"
export SHELL="/bin/bash"
export DATADIR="/usr/share"
export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib"

#SYSLOG
/etc/init.d/sysklogd start
/etc/init.d/klogd start
 
# DEVFS (This is only needed for sarge)
#/etc/init.d/devfsd start
 
 
#Makedev
#/etc/init.d/makedev start
 
# PTYs
cd dev
MAKEDEV ptyp
 
# NFS (You need to have portmap and nfs-user-server installed)
#/etc/init.d/portmap start
#/etc/init.d/nfs-common start
#/etc/init.d/nfs-user-server start
 
# Mail (You need to have exim4 installed)
#/etc/init.d/exim4 start
 
# CRON
/etc/init.d/atd start
/etc/init.d/cron start
 
# INETD (This is only available in sarge)
#/etc/init.d/inetd start
 
# Remove no login (For etch you need to add "start" at the end of the line)
/etc/init.d/rmnologin start
 
#SSH (You need to have openssh-server installed)
/etc/init.d/ssh start >/var/log/ssh.log 2>&1
 
# STOP BOOTLOG (For etch you need to add "start" at the end of the line)
/etc/init.d/stop-bootlogd start
/etc/init.d/mysql start
apache2ctl start

# START SickBeard & CouchPotato
/etc/init.d/mediaservers.sh

# START SABnzbd
/etc/init.d/sabnzbd start

Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 09:02:50 AM
Now I understand, basically you have been working within debian chroot environment all this while and FFP is not install. In order to have access to the native environment, FFP is needed because it provide telnet/ssh access. Actually, you can create a script to start debian automatically or manually. Normally I start debian manually mainly because most of the stuff needed is already available in FFP or Optware.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 09:06:03 AM
i have ffp installed, as i was using it orginally, i never deleted it so to get back to it i just change back the fun_plug from fonz, and carry on were i left off in ffp


I still can ssh/telnet into my nas, its just in the debian environment. I mainly went the debian root because the optware version of sabnzbd is well out of date!

so what can i do? is this possible in the debian environment?

edit: if theres a way to get sabnzbd, sickbeard, couchpotato and headphones running their latest versions on ffp, im more than happy to go back to that, but as it stands i cant find away to do it unless im in debian
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 09:32:02 AM
Try adding the following into fun_plug file, restart NAS and edit the mod_smb.conf found in /root folder and reboot again. Hopefully it will work.

Code: [Select]
#!/bin/sh

# Root DISK1
export DISK1=/mnt/HD/HD_a2
export DISTDIR=squeeze


# copy original native smb.conf into debian /root folder
[ ! -f $DISK1/$DISTDIR/root/mod_smb.conf ] && cp /etc/samba/smb.conf $DISK1/$DISTDIR/root/mod_smb.conf
[ -f $DISK1/$DISTDIR/root/mod_smb.conf ] && cp $DISK1/$DISTDIR/root/mod_smb.conf /etc/samba/smb.conf
smb restart


cd $DISK1

mount --bind $DISK1 $DISTDIR$DISK1
mount --bind / $DISTDIR/mnt/root
mount --bind /dev $DISTDIR/dev
mount --bind /sys  $DISTDIR/sys
#mount --bind /sys/crfs $DISTDIR/sys/crfs
#mount --bind /web $DISTDIR/web
mount --bind /proc $DISTDIR/proc

cp -f /proc/mounts $DISTDIR/etc/mtab
rm -f $DISTDIR/etc/fstab
touch $DISTDIR/etc/fstab
cp -f /etc/resolv.conf $DISTDIR/etc
hostname >$DISTDIR/etc/hostname
cp -f /etc/hosts $DISTDIR/etc

$DISK1/$DISTDIR/boot/chroot $DISK1/$DISTDIR /boot/linuxrc
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 09:34:37 AM
It very late over at my end so going to bed soon. Let me know the outcome.
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 09:38:26 AM
Just rebooting, will 5 mins, thanks for your time bud  :)

Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 09:43:25 AM
It's not creating the mod_smb file

It's ok if you wanna go sleep, we can look at it again tomorrow?

edit: found it sorry was looking in the wrong place! ill have a play with it now, thanks for your help
Title: Re: Make dns320 the master browser
Post by: Moley85 on February 08, 2012, 10:11:11 AM
thats the ticket, its now the master of my network, confirmed that its copied over the modified smb.conf file and smb was restarted!

thank you so much mate, appreciate it, whats your paypal so i can buy u a beer! had been trying to do this for a week!
Title: Re: Make dns320 the master browser
Post by: albert on February 08, 2012, 06:07:07 PM
You're most welcome, glad to know that the problem has been resolved.

Regarding the beer treat you're just too kind, actually I also learn something new along the way.  ;D
Title: Re: Make dns320 the master browser
Post by: cable2 on September 01, 2013, 11:47:16 AM
Hi guys,
I am bring this thread back from the dead because I have been trying to find some way to force my DNS 320 to become the master browser on my home network in the simplest way possible.  My attempts to find a solution have failed.  I tried and thought I successfully installed ffp 0.7 and have been able to SSH into it but from this point on I am lost.  I should say I am a total noob to linux.  Initally, I looked for the smb.conf file but could find none nor any samba folder in my ffp directory.  Later, I then tried the install debian squeeze thinking I could then follow the thread to a solution.  A total failure, I think because all the files and directions I used were for ffp 0.5 not 0.7 that I have installed but I am not even sure of that.  Anyway, if any of you have a way that a noob can follow, I would appreciate your guidance.  Thanks.
Title: Re: Make dns320 the master browser
Post by: albert on September 07, 2013, 09:13:19 AM
@cable2, have you sorted out your problem? If not, I will look into as the solution given will not work for you.
Title: Re: Make dns320 the master browser
Post by: cable2 on September 08, 2013, 12:39:29 PM
Thanks Albert,
I know you are the guy for this.  My goal was to force one of my 320's to become the master browser.  I have been using the trial and error method without much success.  At this point, I have installed ffp 0.7 ( I believe) and nothing else, i.e., no packages are installed.  I would like if possible to just use ffp with whatever package is necessary to enable the samba service.  My assumption is that I can then try to proceed with your initial directions and somehow make this 320 the master on my home network.  I have done several installs of ffp and at one point think I had debian squeeze installed but I don't want to go the debian route unless absolutely necessary.  I hope I made myself clear.  If it's not too much trouble for you I would appreciate your knowledgable assistance. 
Title: Re: Make dns320 the master browser
Post by: albert on September 09, 2013, 06:52:26 AM
There is no need to install Debian, the main requirement is to get FFP installed and working (ie. able to gain shell access via telnet/ssh).

Next, edit (create if not exist) fun_plug.local located in /ffp/etc folder. I personally prefer to use Nano editor, install this FFP addon if require.

Add the following codes into fun_plug.local and made sure that the file permission is set to executable (ie. 755, use ls -l to verify).
Code: [Select]
# Enable NAS to be local Master Browser
sed -i '/local master = /s/no/yes/' /etc/samba/smb.conf
smb restart

For some reason I keep getting error when testing if the NAS had indeed became the Master Browser using the LANscanner (http://scottiestech.info/2009/02/14/how-to-determine-the-master-browser-in-a-windows-workgroup/) as mentioned by TS. But if I verify this using nbtstat, it show up correctly so give it a try and feedback.