Samba: Recipes to Configure Stable Network Browsing on a SOHO LAN

AKA Settings for the Samba Configuration File, smb.conf, to achieve stable network name resolution.

This is a page of recipes with little explanation. The explanation and discussion is on a separate page. If you need to use these recipes you probably should read the explanations page.

These are the configuration options for the SOHO workgroup LAN:

  1. If the LAN contains some (or all) hosts with dynamically assigned IP addresses you could do nothing and accept the Samba Linux & Microsoft Windows SOHO defaults of unenhanced "broadcast name resolution". That provides basic browsing, very flaky and frustrating. I recommend configure beyond the current default install (samba V3x).
  2. Fixed IP addressing only: use static lists of name/address pairs in their lmhosts files. This is recommended for small, fairly static SOHO LANs.
  3. Some or all dynamic addressing: you can enable a Linux Local Master Browser to enhance broadcast name resolution. A Linux LMB very effectively stabilises browsing involving dynamic IP addresses and improves the user experience on the SOHO LAN.
  4. Some or all dynamic addressing: you can create a server environment with a Windows Intenet Name Server. A wins server collates and serves the IPaddress - NetBIOSname pairs for the workgroup. The result for browsing is just splendid.

Really new users might wonder where the GUI tool to edit the Samba configuration file is. There's an ultra-mini tutorial on that in the last paragraph

Using the lmhosts file:

File /etc/samba/smb.conf

[global]
workgroup = SOHOLAN
netbios name = entwhistle
name resolve order = lmhosts bcast host wins

Files /etc/samba/lmhosts in Linux and %SystemRoot%\system32\drivers\etc\lmhosts in Windows are exactly the same:

127.0.0.1 localhost
192.168.0.2 fileserver
192.168.0.3 browseclient
192.168.0.x netbiosname
# etc
# etc
# etc

In Windows TCPIP settings at Control panel --> network connection --> properties --> Internet protocol TCPIP --> properties --> advanced --> WINS: Make these adjustments:

enable lmhosts and netbios over tcpip

Similar settings should be made in the Linux GUI. Here's some pics of the equivalent situation from Yast in Suse 10.2:

enable lmhosts and netbios over tcpip

Using a Linux Local Master Browser

Here's the file /etc/samba/smb.conf for the machine chosen as LMB, in this example with hostname and NetBIOS name both set to fileserver.

[global]
workgroup = SOHOLAN
netbios name = fileserver
domain master = no
local master = yes
preferred master = yes
os level = 65
name resolve order = bcast host lmhosts wins

The LMB doesn't have to have a fixed IP address. If you choose too give your LMB a fixed IP address then configure the network card as shown pictorially in Plate#2 above. If however you choose dynamic IP addressing by DHCP then use the pictorial guide shown below in Plate#3.

Configure NIC for DHCP

Using A WINS Server

Here's the file /etc/samba/smb.conf for the WINS server:

[global]
workgroup = SOHOLAN
netbios name = fileserver
wins support = Yes
name resolve order = wins bcast host lmhosts

A wins server has a fixed IP address so you would use the style of Plate#2 to configure the network card.

Here's the file /etc/samba/smb.conf for a Linux WINS client:

[global]
workgroup = SOHOLAN
netbios name = browseclient
wins server = 192.168.0.2
name resolve order = wins bcast host lmhosts

A wins Linux client (a standard browsing computer) can have either a fixed or a dynamically assigned IP address. You would use the style of Plate#2 to set up the network card in the static case and Plate#3 in the dynamic (DHCP) case.

Plate#4 shows the nettwork card setup for Windows clients, for the cases of fixed IP (4A) and dynamic IP (4B). This is for the windows wins client so the IP address of the wins server must be encoded as in 4C.

IMAGE here but error

Well folks I hope I've covered most common options and cases. But as always constructive criticism is welcomed on my weblink address. In finishing, here's a recipe for new users to edit files owned by root, like lmhosts, hosts, smb.conf and so on.

HowTo Edit the Samba Configuration File (or for that matter, any file owned by root):

There's an easy way and a hard way. The easy way is to issue a command in a non-root terminal that essentially says "open the file in a text editor". The hard way is to navigate in Konqueror (KDE) or Nautilus (Gnome) to the file, R-click it, select to open it and then select which application will do the job.

The easy way in Gnome is to issue this command in a terminal window:

freddie@susebox:~> gnomesu gedit /etc/samba/smb.conf

The easy way in KDE is to issue this command in a terminal window:

freddie@susebox:~> kdesu kwrite /etc/samba/smb.conf

This is how you do it the hard way in KDE: The same principles go for Gnome but there you'd use Nautilus and Gedit instead of Konqueror and Kwrite. Open the file manager Konqueror in super user mode. You'll find it in Suse at Kmenu --> System --> File manager --> File manager super user mode. Supply the root password when asked.

Navigate to the file at /etc/samba/smb.conf: use ↑ to find / --> /etc --> /etc/samba --> scroll to samba.conf. R-click and select "open with". Then if you see Kwrite in a list (or Kate if you prefer) then select it. If you don't see it in the list then select "other" and you'll find Kwrite in the ensuing graphical list under utilities --> editor --> kwrite. Select Kwrite BUT ALSO tick the box "remember application association for this type of file" so you don't have to hunt like this in the future. OK smb.conf will open in superuser version of Kwrite and you can edit it.

I reckon it's time to stop with total dependence on things GUI.

Be well. Swerdna 08 February 2007.