What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Help needed: Enabling WINS and force-master-browser via script/SSH

Hexabion

Occasional Visitor
Hi,

How do i enable WINS and master-browser forcing via Telnet/ssh?

I have disabled SMB in the webgui because I'm using smb via script/telnet instead to have it use another config-file to my liking, but don't see any options in the smb.conf for wins/master-browser like the gui-setting in the webgui.

Thanks in advance.
 
Last edited:
Code:
nvram set smbd_wins=1
nvram set smbd_master=1
nvram commit
service restart_nasapps

However if you generate your own smb.conf you will also have to configure it. Read the Samba documentation for the appropriate settings to use.
 
Code:
nvram set smbd_wins=1
nvram set smbd_master=1
nvram commit
service restart_nasapps

However if you generate your own smb.conf you will also have to configure it. Read the Samba documentation for the appropriate settings to use.

Thank you very much.

The nvram set is a one-time, (since the "commit"), but what does the service restart_nasapps do? Do i need to do the "service restart_nasapps" at every boot, or is that "service restart_nasapps" to skip having to reboot router?

The smb.conf I have works fine, been using it with sucsess for a couple of weeks now, but it has no option for master browser nor wins, am I good as it is? or do i need to put anything else into it in regards to the wins/master-browser or is the nvram set/commit enough?

My only "problem" is that it units on my network sometimes forget the netbios name of the router, thus having to use its internal ip-address.

I read the smbd man / documentation, but said nothing about wins/master browser settings there, so I googled up on general documentation about samba instead and got the impression that was the problem, that I should force the router to be the master browser since "master browser" is the unit keeping track of all the netbios names for each ip/unit on the network, if no master browser set, then it assigns the role by chance/random to the first unit on the network/workgroup, so if that unit is turned off (could be e.g. a laptop) then the netbios-"cache" goes south.

Am I way off on my conclusions?
 
Last edited:
If you're not using the smb.conf file that would normally be generated by the router you will need the following lines:

os level = 255
local master = yes
preferred master = yes

The following line would only be needed if you had multiple subnets and wanted to be the domain master browser of all of them (be careful if you're connecting to another network that already has a Windows domain controller):

domain master = yes

Being a WINS server is only useful if all of your clients are configured to use it:

wins support = yes


https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/NetworkBrowsing.html
 
Last edited:
Thank you very much.

The nvram set is a one-time, (since the "commit"), but what does the service restart_nasapps do? Do i need to do the "service restart_nasapps" at every boot, or is that "service restart_nasapps" to skip having to reboot router?

Correct. It restarts the NAS-like services such as vsftpd and samba to avoid a reboot.

The smb.conf I have works fine, been using it with sucsess for a couple of weeks now, but it has no option for master browser nor wins, am I good as it is? or do i need to put anything else into it in regards to the wins/master-browser or is the nvram set/commit enough?

You need to add a specific setting to smb.conf to enable master browser support, and another setting to increase your Samba's OSlevel value to give it priority over other servers on your LAN (a master browser is determined through a weighted election).

This code from the firmware should give you the necessary settings:

Code:
 	if (!strcmp(nvram_safe_get("smbd_wins"), "1")) {
fprintf(fp, "wins support = yes\n");
}

if (!strcmp(nvram_safe_get("smbd_master"), "1")) {
     fprintf(fp, "os level = 255\n");
     fprintf(fp, "domain master = yes\n");
     fprintf(fp, "local master = yes\n");
     fprintf(fp, "preferred master = yes\n");
}
 
if no master browser set, then it assigns the role by chance/random to the first unit on the network/workgroup, so if that unit is turned off (could be e.g. a laptop) then the netbios-"cache" goes south.
If the machine acting as the local master browser is turned off then an election will take place to find the most suitable replacement. It could take up to 15 minutes to do this so having a device that is always on is the best choice for the LMB.
 
Right, ColinTaylor and RMerlin, I thank both of you for having patience with me, a million thank you's.


Colin, I'll be sure not to use domain master (connecting from work sometimes with two-way PPTP VPN, could do some damage I suppose (bringing the LAN to client, the client being at my workplace domain if it could "leak" out into the domain (then again probarbly not, since that would beat the whole purpose of a VPN being isolated/sandboxed), either way i'll leave that one alone.

RMerlin, understood - (about saving a reboot with the service command.)

To both of you: I stole the smb.conf from the router-generated/inbuilt one, but for some weird reason those lines were never there. I never generated my own, i just copied the original one to jffs/configs, have smbd start with that configfile as parameter and edited it to my liking, but no "local browser, os level, preferred master in there anywhere.

The way I understand it now, I need BOTH the nvram values set, AND add those mentioned vars (os level, local master, and preferred master) to my smb.conf.

I think i'm good to fly, thank you both again very much.
 
The way I understand it now, I need BOTH the nvram values set, AND add those mentioned vars (os level, local master, and preferred master) to my smb.conf.
If you have Samba turned off in the GUI or you're overwriting the smb.conf file with your own version (not appending/modifying) then it doesn't matter what the nvram is set to because you're not using it.

To put it another way, if you turn on Samba in the GUI then the nvram variables will be used to create the lines in smb.conf. The fact that they were missing from the smb.conf file you originally copied was probably due a mistake you made in the GUI (or applying the changes).
 
Last edited:
If you have Samba turned off in the GUI or you're overwriting the smb.conf file with your own version (not appending/modifying) then it doesn't matter what the nvram is set to because you're not using it.

To put it another way, if you turn on Samba in the GUI then the nvram variables will be used to create the lines in smb.conf. The fact that they were missing from the smb.conf file you originally copied was probably due a mistake you made in the GUI (or applying the changes).

Makes sense, allthough I copied the conf file while samba was on in the gui, then - after copying it - i turned samba off in the gui. I did have master browser and wins turned OFF though when I had samba running from the gui, so it would make sense that those variables were never put in the conf from nvram in the first place instead of applying them to the conf with a value of "0".

It really doesn't matter though, hakuna matata - what matters is that with the excellent ( https://www.youtube.com/watch?v=YKUOB8MN4Kc ) information you've given me - I now know what to do :)

Again, thank you :)
 
If you have Samba turned off in the GUI or you're overwriting the smb.conf file with your own version (not appending/modifying) then it doesn't matter what the nvram is set to because you're not using it.

You'd still want at least smbd_wins enabled, so dnsmasq will now it should advertise it over DHCP (tho I suspect that code is currently broken and will require a look at, but might as well be ready for once it gets fixed).
 
You'd still want at least smbd_wins enabled, so dnsmasq will now it should advertise it over DHCP (tho I suspect that code is currently broken and will require a look at, but might as well be ready for once it gets fixed).

I'm going to use all the nvram settings, including the smbd_wins + all the conf settings together except for "domain master".

When you say "broken", I assume you mean that activating these settings won't help, meaning the router will still only respond to its IP and not its "friendly" / netbios name?
 
I'm going to use all the nvram settings, including the smbd_wins + all the conf settings together except for "domain master".

When you say "broken", I assume you mean that activating these settings won't help, meaning the router will still only respond to its IP and not its "friendly" / netbios name?

By broken, I mean that DHCP clients will not know that the router is a WINS server, so they won't make use of it. You'd have to either modify the dnsmasq.conf content for option 44 to push your router's IP instead of 0.0.0.0, or manually set the WINS IP on your clients.
 
Personally, I don't like the idea of enabling WINS unless you actually have a use for it. I know that Samba says it's recommended but they also say:

WINS will work correctly only if every client TCP/IP protocol stack is configured to use the WINS servers. Any client that is not configured to use the WINS server will continue to use only broadcast-based name registration, so WINS may never get to know about it. In any case, machines that have not registered with a WINS server will fail name-to-address lookup attempts by other clients and will therefore cause workstation access errors.

https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/NetworkBrowsing.html#id2583597

In 99% of cases this is not an issue, but I have come across kit like printers or fax machines do not support WINS in which case name resolution doesn't work.

I think, at the end of the day, we should be using DNS for name resolution not WINS.
 
By broken, I mean that DHCP clients will not know that the router is a WINS server, so they won't make use of it. You'd have to either modify the dnsmasq.conf content for option 44 to push your router's IP instead of 0.0.0.0, or manually set the WINS IP on your clients.

That makes sense. I wil try to use force master browser at first and see if that solves my no-names-just-ip-in-the-LAN problem.

Thanks again for the straight forward information.
 
Personally, I don't like the idea of enabling WINS unless you actually have a use for it. I know that Samba says it's recommended but they also say:



https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/NetworkBrowsing.html#id2583597

In 99% of cases this is not an issue, but I have come across kit like printers or fax machines do not support WINS in which case name resolution doesn't work.

I think, at the end of the day, we should be using DNS for name resolution not WINS.


I will try just master browser force first and see how if that solves my problem, if not then I'll play with WINS as a last resort.

Again, thank you for the enlightenment.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Back
Top