VirtualBox and Samba 4 on Linux Guest (NAT and Host Only)

eduardolucioac

Junior Member
Feb 18, 2014
2
0
0
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!

MORE INFORMATION ABOUT THE PROBLEM:

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"...

Code:
    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:

Code:
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"

Code:
# 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:

Code:
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!):

Code:
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 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!
 

Scarpozzi

Lifer
Jun 13, 2000
26,391
1,780
126
netstat -tulpn | egrep "samba|smbd|nmbd|winbind"


Run that and see what's listening. Verify the ports are listening and that your firewall is open. Work backwards from the network to the application. The fact that you say Samba3 works, suggests that the VirtualBox networking is sound and that you've got an issue somewhere with the daemon or listener/port configuration.
 

eduardolucioac

Junior Member
Feb 18, 2014
2
0
0
netstat -tulpn | egrep "samba|smbd|nmbd|winbind"


Run that and see what's listening. Verify the ports are listening and that your firewall is open. Work backwards from the network to the application. The fact that you say Samba3 works, suggests that the VirtualBox networking is sound and that you've got an issue somewhere with the daemon or listener/port configuration.

Scarpozzi: "Run that and see what's listening. Verify the ports are listening and that your firewall is open."

Output of the "netstat -tulpn | egrep "samba|smbd|nmbd|winbind"" command on guest when "NAT" interface is active...

Code:
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      963/smbd            
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      963/smbd            
tcp        0      0 :::139                  :::*                    LISTEN      963/smbd            
tcp        0      0 :::445                  :::*                    LISTEN      963/smbd            
udp        0      0 10.0.3.255:137          0.0.0.0:*                           1790/nmbd           
udp        0      0 10.0.3.15:137           0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.255:137      0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.100:137      0.0.0.0:*                           1790/nmbd           
udp        0      0 0.0.0.0:137             0.0.0.0:*                           1790/nmbd           
udp        0      0 10.0.3.255:138          0.0.0.0:*                           1790/nmbd           
udp        0      0 10.0.3.15:138           0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.255:138      0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.100:138      0.0.0.0:*                           1790/nmbd           
udp        0      0 0.0.0.0:138             0.0.0.0:*                           1790/nmbd

... output of the "netstat -tulpn | egrep "samba|smbd|nmbd|winbind"" command on guest when "NAT" interface is not active (Samba 4 works!)...

Code:
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      963/smbd            
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      963/smbd            
tcp        0      0 :::139                  :::*                    LISTEN      963/smbd            
tcp        0      0 :::445                  :::*                    LISTEN      963/smbd            
udp        0      0 192.168.56.255:137      0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.100:137      0.0.0.0:*                           1790/nmbd           
udp        0      0 0.0.0.0:137             0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.255:138      0.0.0.0:*                           1790/nmbd           
udp        0      0 192.168.56.100:138      0.0.0.0:*                           1790/nmbd           
udp        0      0 0.0.0.0:138             0.0.0.0:*                           1790/nmbd

... as we can see the firewall is open for Samba. I also did tests with the firewall stopped.

Note: This host (which runs the hypervisor/virtual box) is a notebook and I use in various networks from different customers.

ADDITIONAL CONSIDERATIONS:

Note also that Samba 4 as the link below "containing the first compatible Free Software implementation of Microsoft's Active Directory protocols". The Samba 4 has many changes (changes concerning how the domain is treated, for example) relative to Samba 3. My home network (where I work too) is in "WORKGROUP" which is a "default" MS domain, different from the corporate network where the things work with Samba 4. I've tried changing the Samba domain to another name, but it did not work too. I also tried to change settings related to PDC, BDC and DC, but it did not work too.

If you have any suggestion to diagnose the problem will be very welcome! Well, this is my main problem! I do not know what is happening, do not know how to diagnose!

Thanks a lot brother! =D

http://www.linuxforums.org/articles/samba-4-linux-active-directory-server_1852.html