Docker Community Forums

Share and learn in the Docker community.

[RESOLVED] Windows 10: Way to assign container to the same LAN as host?

docker

(Qtimmylin) #1

Hi,

My goal is to make my Linux container live on the same lan as host and other devices.
Because I need to use nmap frequently to scan the devices mac address on the lan. Unfortunately, the nmap scanning is only working when these machines all live on the same subnet.

I’ve tried several ways to make it happen, but all failed.
Although there are lots of instructions about how to do this, seem like they are all for Docker for Linux.

For example, a very detailed instructions from stackoverflow is also not working for me:


Things I’ve tried:

Macvlan:

it seems like Docker for Windows 10 doesn’t support macvlan due to I have no way to make Windows network adapter as parent…

Pipework:

which is only working on Linux system but I am using Windows 10…

Modify bip from daemon.json:

I tried, which will set docker0 to static IP then container is still not able to ping devices on the LAN. I guess it’s because the container is placed at NAT and change docker0 bridge ip won’t be able to achieve my goal.

Run image with --net host:

which ifconfig shows:

docker0   Link encap:Ethernet  HWaddr 02:42:2d:b8:0b:7c
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr: fe80::42:2dff:feb8:b7c/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:540 (540.0 B)

eth0      Link encap:Ethernet  HWaddr 02:50:00:00:00:01
          inet addr:192.168.65.3  Bcast:192.168.65.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:147 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9701 (9.7 KB)  TX bytes:10384 (10.3 KB)

hvint0    Link encap:Ethernet  HWaddr 00:15:5d:0d:52:27
          inet addr:10.0.75.2  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fe0d:5227/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:359819 errors:0 dropped:1303 overruns:0 frame:0
          TX packets:1157 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:54740692 (54.7 MB)  TX bytes:103676 (103.6 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:57 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:5732 (5.7 KB)  TX bytes:5732 (5.7 KB)

It’s able to ping everything on my subnet, but the IP is still not from my subnet but 192.168.65.3.

Then I was trying to change the eth0 ip to static IP by editing /etc/network/interface.d/eth0, after restart networking service, the eth0 ip is changed to static ip from my subnet, but the network is not working anymore.

PLEASE, if anyone here knows how to place Windows 10’s Linux Container on the LAN as same as host’s.


My Docker Version

Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:12:48 2018
OS/Arch: windows/amd64
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:22:38 2018
OS/Arch: linux/amd64
Experimental: false


(Qtimmylin) #2

For who is still struggling with this issue, I’ve figured out how to do it on Windows 10.

Windows 10 HOME user, you can refer to this page for virtual box setting
Windows 10 PROFESSIONAL/ENTERPRISE user, you can refer to this page for hyperV setting
https://hub.docker.com/r/qtimmylin/evt_platform/

I am sorry I cannot release the image due to confidential content, but I believe the instructions are clear enough for anyone even you are new to Docker.

Hope this is helpful enough so you don’t need to waste a whole week on this as I did.


(Feeney) #3

PS C:\Users\pallsopp> docker pull qtimmylin/dockerce.hyperv.evt_testplatform
Using default tag: latest
Error response from daemon: manifest for qtimmylin/dockerce.hyperv.evt_testplatform:latest not found


(Qtimmylin) #4

@feeney I am sorry that image cannot be pulled. I didn’t release any image on the repo, the repo is just for explaining how to do it, it’s just a page that can help ppl to understand the way to assign Docker for Windows’ container to the LAN as host’s.

And actually… even if there’s an image exists, pulling my image cannot achieve the goal as well. You will need to setup vSwitch and modify the source code in Docker/resource/MobyLinux.ps1 so you can place your container in the LAN.

Feel free to ask me any question if you were blocked again.