Coder Social home page Coder Social logo

Comments (5)

Southseast avatar Southseast commented on July 23, 2024 1

Sorry, it's my problem. It's unfortunately I tried setting up two different static IPs, and they were both occupied repeatedly in vlan. Now it work.

from windows.

kroese avatar kroese commented on July 23, 2024

You can just use macvlan mode with DHCP=N. This will allow you to choose any IP you like, but the traffic will still be tunneled to the VM (this means Windows does not know what outside IP it has).

If for some reason you also really need Windows to know its own IP (normally there are no reasons for that), then you must set DHCP=Y. But the name "DHCP" for the setting is a bit misleading, because what it really does is to create a macvtap interface. And you will also need that interface if you want to assign a static IP on the network.

So in that case set DHCP=Y, boot the container and then go inside the Window Control Panel and set a static IP for the network adaptor so that it ignores the DHCP server.

from windows.

Southseast avatar Southseast commented on July 23, 2024

When I use macvlan mode with DHCP=Y and enter ipconfig on the cmd, it is shown as follows.

C:\Users\Docker\Desktop>ipconfig

Windows IP Configuration


Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::4192:558f:7082:a7b1%12
   IPv4 Address. . . . . . . . . . . : 172.22.108.102
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 172.22.108.254

Tunnel adapter isatap.{167133D2-1830-4B68-A65C-1A019F1A5D7B}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

So I use netsh interface ip set address "Ethernet" static 172.22.108.75 255.255.255.0 172.22.108.254 to modify the network configuration. But now it shows "no internet access" and I can't connect Windows via RDP.

from windows.

Southseast avatar Southseast commented on July 23, 2024

And this is my docker-compose.yml

version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    environment:
      DHCP: "Y"
    volumes:
      - ./2012.iso:/storage/custom.iso
      - ./storage:/storage
    devices:
      - /dev/kvm
      - /dev/vhost-net
    device_cgroup_rules:
      - 'c *:* rwm'
    cap_add:
      - NET_ADMIN
    stop_grace_period: 2m
    restart: on-failure
    networks:
      vlan:
        ipv4_address: 172.22.108.98
        
networks:
  vlan:
    driver: macvlan
    driver_opts:
      parent: ens33
    ipam:
      config:
        - subnet: "172.22.108.0/24"
          ip_range: "172.22.108.0/24"
          gateway: "172.22.108.254"

from windows.

kroese avatar kroese commented on July 23, 2024

I am not sure why.. I use the same network code in another project ( https://github.com/vdsm/virtual-dsm ) and I know for sure that it works there to set a static IP. Because macvtap provides a direct connection to the network, it should not matter at all if you use dynamic or static IP. I never tested it with this container, I just expected it would work for Windows too since I cannot think of any reason why it would work with DSM (Linux) and not with Windows.

For a quick solution, wouldnt it be an alternative for you to just configure your DHCP server to give Windows the IP you want? That would solve your problem also.

from windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.