Fixing Samba (or other services) connectivity

So you know you’ve got Samba running on your server.  You can connect to it locally.  But you can’t seem to get to it from anywhere else.  What the heck is going on?

Server’s up:

# systemctl status smb
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-10-27 14:06:51 EDT; 56min ago
Main PID: 174091 (smbd)
Status: "smbd: ready to serve connections..."

Firewalls are down (not ideal, but sometimes the only way to make sure is to turn ’em off):

# systemctl status iptables
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
Active: inactive (dead) since Sat 2018-10-27 13:54:19 EDT; 1h 14min ago
# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sat 2018-10-27 13:39:19 EDT; 1h 29min ago

But you can’t mount your Samba shares.  Nor can you even reach the stupid thing from another device:

# nc -vzw 3 sambavm 139
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection refused.

And Samba is definitely listening on 139/tcp:

# netstat -plant | grep 139
tcp 0 0 127.0.0.1:139 0.0.0.0:* LISTEN 174091/smbd

Argh!  What on earth is happening?  I guess let’s look at smb.conf and see if anything funny is going on in there.

interfaces = lo ens160

Well that’s odd.  I know for some RHEL7 VMs, the interface is named ens160.  But I’m pretty sure mine is named eth0.

# ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

Yep.  I wonder what happens if I correct that line and restart Samba.

# vi /etc/samba/smb.conf
interfaces = lo eth0
# systemctl restart smb

Well looky there, I can mount my Samba shares!  Exciting times for all!  Either my NIC card changed names (either as a result of patching, or because I migrated it from ESXi to Nutanix’s Acropolis hypervisor), or somebody was fiddling with my smb.conf (equally likely).  Either way, if your smb.conf restricts what interfaces can be used to access Samba, make sure it has the right NIC.

One Reply to “Fixing Samba (or other services) connectivity”

Comments are closed.