dperson / samba

Samba docker container
GNU Affero General Public License v3.0
1.5k stars 509 forks source link

create samba share with SMBv1 and multiple networks to separate old machine? #450

Open ThomsonIT opened 9 months ago

ThomsonIT commented 9 months ago

Hello everyone,

i have a very specific scenario i'm trying to achieve. I'm using a pretty old machine that relies on SMBv1 AND Netbios Name to find its working data. Currently i'm running a separate computer with windows and two NICs to keep the machine separated from the rest of the network for security measures. Other people need to access the data as well to give the machine new work.

On the windows computer, there is one network with 192.168.178.0/24 and a second one with 192.168.69.0/24. The machine uses 192.168.69.91 and searches for the netbios name PC-MASTER to find its working data. I can't edit the way the machine searches for the share and due to its old windows version it relies on SMBv1 to be enabled.

Is there a way to achieve that with this image? I'm experimenting with different macvlan setups but can't get that to work.

My current docker-compose looks like that:

version: '3.0'

services:
  samba:
    image: dperson/samba
    container_name: mimot_smb
    hostname: pc-master
    environment:
      TZ: 'Europe/Berlin'
    network_mode: "host"
    ports:
      - "137:137/udp"
      - "138:138/udp"
      - "139:139/tcp"
      - "445:445/tcp"
    tmpfs:
      - /tmp
    restart: unless-stopped
    stdin_open: true
    tty: true
    volumes:
      - /tmp/mimot:/mimot
    command: '-n -S -g "netbios name = pc-master" -g "workgroup = ARBEITSGRUPPE" -s "mimot;/mimot;yes;no;yes" -p'

With that one i can find the share on the host but not associated the the netbios name pc-master.

I tried adding a macvlan ignoring the second ip-address first. Just to make sure the netbios is working: docker network create --driver=macvlan --gateway=192.168.0.1 --subnet=192.168.0.1/24 --ip-range=192.168.0.215/28 -o parent=eth0 mimot

and changed the docker-compose accordingly:

version: '3.0'

services:
  samba:
    image: dperson/samba
    container_name: mimot_smb
    hostname: pc-master
    environment:
      TZ: 'Europe/Berlin'
    networks:
      - mimot
    ports:
      - "137:137/udp"
      - "138:138/udp"
      - "139:139/tcp"
      - "445:445/tcp"
    tmpfs:
      - /tmp
    restart: unless-stopped
    stdin_open: true
    tty: true
    volumes:
      - /tmp/mimot:/mimot
    command: '-n -S -g "netbios name = pc-master" -g "workgroup = ARBEITSGRUPPE" -s "mimot;/mimot;yes;no;yes" -p'

networks:
  mimot:
    external: true

With that, the container gets assigned its own ip-adress but the netbios is still not working. I cant get it to work to have multiple ip-addresses AND the netbios working.

Do you have any help on that front?

**Edit: To make it clear: It is not needed that windows lists the server under network but it must be accessible by \\pc-master\mimot\