2

Gentlemen,

I really need a help from you to configure the "Samba 4" using the "Virtual Box".

Here's the situation:

In certain networks where I work, the Samba 4 works, in other does not. The guest in Virtual box is configured with a network "Host Only" for Samba 4 and other "NAT" for the internet. The only situation where the samba works on all networks is if I disable the "NAT" network and leave only "Host Only". That is, apparently the NAT network (which should be isolated from the external network by using it only as a proxy) is suffering from some kind of negative effect in some cases.

Then... Comes the question that is worth a million:

What causes it?

Believe me, I tried everything and nothing seems to resolve the situation.

Note I: I can not use the guest network with Bridge! Note II: Apparently this only occurs with Samba 4 as the Samba 3 works on any network!

This has been a really difficult situation to solve and I'm "stuck" on it almost 3 weeks.

Someone is also with this problem?

I ask you to help! Thanks!

UPDATE:

If I were to venture an answer to this question, I would say that the problem could be in the gateway. Well, it seems that Samba 4 receives the request from the "Host Only" interface, but attempts to answer by "NAT" interface (as there is only one gateway, "NAT" gateway). I've tried to solve this by entering the following in the section "[global]" in the file "/etc/samba/smb.conf"...

    interfaces = enp0s3 lo
    bind interfaces only = yes

... what actually works (only accepts requests coming in "Host Only" interface). But it does not solve the problem.

PLUS:

Output of the "ifconfig" command:

enp0s3    Link encap:Ethernet  HWaddr 08:00:27:AB:52:E3  
          inet addr:192.168.56.100  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feab:52e3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:602 errors:0 dropped:0 overruns:0 frame:0
          TX packets:849 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81307 (79.4 Kb)  TX bytes:127690 (124.6 Kb)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:09:CC:37  
          inet addr:10.0.3.15  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe09:cc37/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5889 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4340 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6668637 (6.3 Mb)  TX bytes:432330 (422.1 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:519 errors:0 dropped:0 overruns:0 frame:0
          TX packets:519 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:39728 (38.7 Kb)  TX bytes:39728 (38.7 Kb)

"/etc/samba/smb.conf"

# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
[global]
        workgroup = WORKGROUP
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        printcap cache time = 750
        cups options = raw
        map to guest = Bad User
        include = /etc/samba/dhcp.conf
        logon path = \\%L\profiles\.msprofile
        logon home = \\%L\%U\.9xprofile
        logon drive = P:
        usershare allow guests = Yes
        add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
        domain logons = Yes
        domain master = Yes
        local master = Yes
        os level = 65
        preferred master = Yes
        security = user
        usershare max shares = 100
        wins server =
        wins support = No
        interfaces = enp0s3 lo
        bind interfaces only = yes
[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes
[profiles]
        comment = Network Profiles Service
        path = %H
        read only = No
        store dos attributes = Yes
        create mask = 0600
        directory mask = 0700
[users]
        comment = All users
        path = /home
        read only = No
        inherit acls = Yes
        veto files = /aquota.user/groups/shares/
[groups]
        comment = All groups
        path = /home/groups
        read only = No
        inherit acls = Yes
[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No
[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = @ntadmin root
        force group = ntadmin
        create mask = 0664
        directory mask = 0775

[SES_DF]
        comment = SES_DF
        inherit acls = Yes
        path = /home/brlight/DEV_GUESTS/SES_DF
        read only = No

[netlogon]
        comment = Network Logon Service
        path = /var/lib/samba/netlogon
        write list = root

Output of the "route" command when "NAT" interface is active:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.3.2        0.0.0.0         UG    0      0        0 enp0s8
10.0.3.0        *               255.255.255.0   U     1      0        0 enp0s8
192.168.56.0    *               255.255.255.0   U     1      0        0 enp0s3

!!!Important: If I disable the host network, Samba 4 works and I have the same output as above!!!

Output of the "route" command when "NAT" interface is not active (cable unplugged on Virtual Box)(Samba 4 works!):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.56.0    *               255.255.255.0   U     1      0        0 enp0s3

Note: There is no gateway...

In this scenario I would propose two hypothetical solutions:

  • Make the Samba 4 see just "enp0s3" interface in any situation (request and response);
  • Try to set something in VirtualBox to not allow negative influences from the external network on the "NAT". Since the virtual machine works on some networks but not others;

Note: The distro I am using for the guest is the OpenSUSE 13.1 and for the host is Linux Mint 16 KDE.

PLUS:

I tried to change the range of the "NAT" because the host network is in a similar range (192.168.1.x). I used the range "169.254.0.x" to the "NAT" network, but the problem continued.

As you can see, this is a difficult problem and difficult to diagnose, and I need all the help from you!

1
  • This is probably the most difficult problem to solve in the world! More than four distinct forums with the same thread and so far nobody knows anything! =[ Mar 24, 2014 at 13:32

3 Answers 3

1

I have a similar situation and I was able to get it to work by disabling NetBIOS over TCP on all interfaces except the Host-only adapter on all my Windows machines.

VirtualBox VMs:

  • Host: Windows 10 Pro
  • Guest 1: Debian Buster (Samba version 4.5.12)
  • Guest 2: Windows 7 Pro

Networking:

  • Host-only network:
    • Host and both guests
    • DHCP network 169.254.0.0/16
  • NAT interface:
    • Both guests
    • Also worked with guests connected to a NAT network

Host and Windows Guest Configuration

  • Disable NetBIOS over TCP/IP on all interfaces except the Host-only interface
    • Go to the properties of each network adapter and go to IPv4 Properties → Advanced → WINS → NetBIOS Setting
    • I didn't test this with IPv6 adapters

As for why I had to do this, I have no idea. The Windows host and guest never had any problem resolving any host name. It was only the Linux box that had issues, and even it would work once in awhile.

I ran tcpdump/Wireshark on both VMs and I could see the NetBIOS broadcasts and responses going back and forth and nmblookup worked fine from the Linux host, but I couldn't ping or mount network shares from linux.

I also don't know why I didn't need to limit NetBIOS to only the Host-only adapter on the Linux box.

1

Could be that the VirtualBox NAT system is checking all Incoming and Outgoing connections even if we set an interface on the Guest OS ? As VirtualBox NAT is running on the Host is very likely that the issue is not from the Guest OS.

0

I had a similar issue when I wanted to limit access from my Virtualbox guests to Samba on my host machine. Some ip ranges were allowed, others not. When I chose the NAT interface from a guest I could still access the host's Samba shares even if I limited Samba to allow the ip address ranges for my host only networks.

After debugging the issue with Wireshark: Virtualbox NAT checks for routes on the internal host networks before accessing the Internet. Virtualbox also masquerade your internal ip address with the host only networks it checks. This ip address is not the one you get from the 'ip addr' command.

In my case with Samba configuration: I wanted my shares be available from the host only interfaces and not from the NAT.

For Samba to disallow access from NAT, I needed to exclude the host IP. In Wireshark this is showed as the source and target address are the same. Both are the host's IP address in the IP range (usually x.x.x.1).

So my Samba configuration finally became:

hosts allow = 192.168.56. 192.168.57. EXCEPT 192.168.56.1 192.168.57.1
hosts deny = ALL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .