16
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS7でNetBIOSホスト名解決

Last updated at Posted at 2017-07-03

Linuxで、/etc/nsswitch.confhosts行にwinsと記入するとLinuxからNetBIOS名前解決できるという技があるのです。例えば

/etc/nsswitch.conf
hosts: files wins dns myhostname

こんなふうに記入すると

$ ping windowsPC
PING windowsPC (192.168.0.32) 56(84) bytes of data.

こんな感じで名前解決ができるというものです。

これをCentOS7でやろうとしたら、意外とはまったので以下作業メモになります。バージョンは CentOS Linux release 7.3.1611 (Core)、x86_64版です。

手順

まずsambaとwinbindをインストールします。

# yum install samba
# yum install samba-winbind

systemctlコマンドでデーモンを立ち上げます。

# systemctl start winbind
# systemctl enable winbind
# systemctl start nmb
# systemctl enable nmb
# systemctl start smb
# systemctl enable smb

ファイアーウォールに穴をあけます。

# firewall-cmd --zone=public --add-service=samba --permanent

/etc/nsswitch.confwinsを書き加えます。

/etc/nsswitch.conf
hosts: files wins dns myhostname

以上!

。。。なのですが、ここまでやってもダメな場合があります。
現象としては、ホストによっては名前またはサービスが不明ですではなくシステムエラーが出るというものです。

$ ping windowsPC
ping: windowsPC: システムエラー

再現条件は、どうやら複数のネットワークインターフェースを持つWindows相手だと出るらしいのですが、原因は不明です。Ubuntuでは出ない現象なので、CentOS固有のバグかもしれません。

参考

Microsoft Windows ネットワークへのSambaの統合
公式のSamba 3.2.x HOWTOとリファレンスガイド, Chapter 29
http://www.samba.gr.jp/project/translation/Samba3-HOWTO/integrate-ms-networks.html

16
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?