Samba :- Name Resolution – From Linux, Resolve Windows Host

Background

Here is how to use Samba to perform name resolution from a Linux Host to MS Windows computers.

Lineage

  1. Windows
    • WINS
      • Installing & Configuring WINS
        Link
  2. Linux
    • Samba
      • Samba – Host Name Resolution
        Link

Steps

Outline

  1. Package Installation
    • samba-winbind
  2. Network Configuration
    • Names Service Switch
      • /etc/nsswitch.conf
    • Samba
      • etc/smb.conf
  3. Firewall Configuration
    • Firewall – firewalld
      • Allow tcp/137 and ucp/137
  4. Restart Services
    • winbind

Package Installation

samba-winbind

yum

yum – is package installed?
Objective

Is samba-winbind installed?

Code

sudo yum list installed | grep samba

Output

package.install.yum.list.01.20190711.png

yum – Install Package
Objective

Install samba-winbind

Code

sudo yum -y install samba-winbind

Output

Image – 1

package.install.yum.install.01.20190711.0801PM.png

Image – 2

package.install.yum.install.01.20190711.0802PM.png

Network Configuration

Files

File :- etc/nsswitch.conf
Outline
  1. Load the /etc/nsswitch.conf file in an editor
  2. Ensure that wins is included in the list of hosts to consult for name resolution requests
    • Original Entry
      • hosts : files dns myhostname
    • Revised Entry
      • hosts : files dns myhostname wins
Images
Image – 01

nsswitch.conf.01.20190711.png

Image – 02

nsswitch.conf.03.20190711.0807PM.png

File :- etc/smb.conf
Outline
  1. Load the /etc/smb.conf file in an editor
  2. Sections
    • Section – Global
      • Configuration Entry
        • workgroup
          • Please have your network domain name
        • netbios name
          • Your computer’s host name
        • wins server
          • Please ensure that your wins server is referenced
Images

smb.conf.01.20190712.0436AM.PNG

 

Network Firewall Configuration

Firewalld

Our OS is centOS and our current firewall is firewalld.

Configuration
Command – Syntax

sudo firewall-cmd --zone={zone} --add-port={port-number}/{protocol} --permanent

Command – Sample

sudo firewall-cmd --zone=public --add-port=137/udp --permanent

sudo firewall-cmd --zone=public --add-port=137/tcp --permanent

Images

firewall.allow.01.20190711.png

Restart Services

Outline

Please restart relevant services.  Those are :-

  1. winbind

 

Configuration

Command – Syntax
sudo service {service} restart
Command – Sample

sudo service winbind restart

Troubleshooting

Issues

ping: unknown host <hostname>

  1. Restart Services
    • Restart winbind
  2. Configuration
    • Linux
      • Configuration – File –
        • /etc/smb.conf
          • Ensure that your WINS Server is referenced

Referenced Work

Vladyslav Baidak
Backend Engineer at Scalified
Devops: Configuring Host Name Resolution
Link
September 24, 2017

References

  1. StackExchange
    • Ask Ubuntu
      • Windows Hostnames are not resolved
        Link
      • Why can’t my machine resolve local windows hostnames?
        Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s