LoginSignup
5
5

More than 5 years have passed since last update.

UbuntuでSambaの接続ができなくて焦った件(ufwとeno1)

Posted at

Sambaにアクセスできない

自宅でubuntu 15.10で立てていたSambaのサーバに突然アクセスできなかった・・
自分の忘備録として原因と対処をメモ

そもそもSSHもできない(ufw設定ミス)

Sambaにアクセスできない原因を探ろうとsshでのアクセスを試みると、そもそもsshもできない。
ただ、pingは通るので、NWは生きているっぽい。いろいろ調べたところ、数日前に導入したufwの設定が漏れて要るっぽい

ufwとは

Uncomplicated FireWallでファイヤーウォール設定ツール。設定の実態はおなじみiptablesだけども、コマンドがより分かりやすくなっている。
どうも、ufwを有効にしたと同時に、iptablesの設定が変わってしまったよう。

なので、ufwからsshとSambaを有効にしてあげる。

$ sudo ufw allow ssh
$ sudo ufw allow samba
$ sudo ufw app list
利用可能なアプリケーション:
  OpenSSH
  Samba

ポート番号など意識しなくても、アプリケーション名でコマンド一発設定で楽ちん。
あと、この操作だけで設定反映されて再起動後も設定が有効となる。

ちなみに、上記でどんな設定が反映されるかは以下のファイルに定義されている

$ cat /etc/ufw/applications.d/openssh-server
[OpenSSH]
title=Secure shell server, an rshd replacement
description=OpenSSH is a free implementation of the Secure Shell protocol.
ports=22/tcp
$ cat /etc/ufw/applications.d/samba
[Samba]
title=LanManager-like file and printer server for Unix
description=The Samba software suite is a collection of programs that implements the SMB/CIFS protocol for unix systems, allowing you to serve files and printers to Windows, NT, OS/2 and DOS clients. This protocol is sometimes also referred to as the LanManager or NetBIOS protocol.
ports=137,138/udp|139,445/tcp
tamura-y@tamubuntu:~$

これで通るはずが・・・

SSHはできたけど・・・(interface名)

上記でsshは通るようになった。あと、NetBiosでの名前引きもできた。でも、肝心のSamabへのアクセスができない。
で、ここまでくると、Samabの設定ぐらいしか疑いようがない。で、設定を見てみるとこんな設定が。

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
interfaces = 127.0.0.0/8 192.168.1.0/24 eth0

あれ、interface名って、eth0だっけ、と確認してみると

$ ifconfig
eno1      Link encap:イーサネット  ハードウェアアドレス xx:xx:xx:xx:xx:xx
          inetアドレス:192.168.1.xxx  ブロードキャスト:192.168.1.255  マスク:255.255.255.0

ちがうじゃん。
どうも、アップデートで変わったみたいです・・・はい。
Network interface name changes after update to 15.10 - udev changes

なので、smb.cnfのインターフェース名を変更。

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
interfaces = 127.0.0.0/8 192.168.1.0/24 eno1

でめでたく復活!

5
5
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
5
5