orbstack / orbstack

Fast, light, simple Docker containers & Linux machines
https://orbstack.dev
MIT License
5.31k stars 41 forks source link

Support for bridged networking (e.g. to Wi-Fi) #342

Open kdrag0n opened 1 year ago

kdrag0n commented 1 year ago

Add an option to bridge machines and containers (via macvlan) to an external network interface, such as the host Mac's Wi-Fi or Ethernet. This would make Linux machines and Docker containers appear as devices on the LAN.

This is not the best networking method in most cases, so it won't be the default and generally wouldn't be recommended unless necessary. There will always be inherent compatibility issues with certain networks, for example.

hululu1068 commented 1 year ago

Add an option to bridge machines and containers (via macvlan) to an external network interface, such as the host Mac's Wi-Fi or Ethernet. This would make Linux machines and Docker containers appear as devices on the LAN.

This is not the best networking method in most cases, so it won't be the default and generally wouldn't be recommended unless necessary. There will always be inherent compatibility issues with certain networks, for example.在大多数情况下,这不是最好的网络方法,因此它不会是默认设置,除非必要,否则通常不会推荐。例如,某些网络总是存在固有的兼容性问题。

As you said, bridging the network allows the web host to have a separate ip address. However, it's better not to use macvlan, configuring routes can be a pain. For example, I use the bridge mode of the NIC on my Parallels desktop and the virtual host has a separate ip address on the LAN. Other devices in the LAN can access and provide other services directly. I hope it will be implemented soon. Go for it!

image
gnattu commented 1 year ago

As you said, bridging the network allows the web host to have a separate ip address. However, it's better not to use macvlan, configuring routes can be a pain. For example, I use the bridge mode of the NIC on my Parallels desktop and the virtual host has a separate ip address on the LAN. Other devices in the LAN can access and provide other services directly. I hope it will be implemented soon. Go for it!

A bridged interface have to use macOS's system bridge and by using that, you will lose the performance benefit of the orbstack's networking stack because that bridge is much slower than orbstack's.

PilchardFriendly commented 1 year ago

+1 for this. Homebridge is main usecase (for me).

linux example here

This example currently doesn't work in orbstack 0.17.1. Containers c1 and c2 have the right IP addresses, but there isn't a path from router to containers (or back).

@kdrag0n mentioned elsewhere this is due to NATing in the vm.

Also, docker complains about the parent interface 'en0', and expects it in the format 'eth.XX', which is linuxese. I suspect this is a feature of the libnetworking library.

To be thorough, i also added a added a 'static' ARP route in my gateway setup, to aid external discovery, but that was probably premature.

donavanbecker commented 1 year ago

+1 for any HAP projects. Homebridge/Scrypted (HomeKit Plugin)/HomeAssistant (HomeKit Integration)

lijinghengforrest commented 1 year ago

+1

mirkokg commented 1 year ago

+1

helmut72 commented 1 year ago

For Docker containers NAT is ok, but for VMs NAT isn't always the best joice. Continue using Multipass.

SuperKenVery commented 8 months ago

+1 please 🙏

hululu1068 commented 2 months ago

Why can't users freely choose to use network modes such as "Shared", "Bridged", or "None"? Fixed CIDR has caused a lot of inconvenience.

Apple's latest Virtualization.framework virtual framework fully supports this, and network performance is also very good.

Looking forward to its implementation soon!👏👏👏

Because of network issues, I've been using Cheetah, it's very convenient and performs well.

image
maxexcloo commented 2 months ago

+1 for any HAP projects. Homebridge/Scrypted (HomeKit Plugin)/HomeAssistant (HomeKit Integration)

+1 for this. Homebridge is main usecase (for me).

Just to confirm there isn't a way to run Homebridge via Orbstack at the moment? I can't seem to add the server it to my phone when in host mode.