MacOS – Internet Sharing, same LAN

internet-sharingmacosNetwork

I'd like to share internet from ethernet (10.0.100.2) to Wi-Fi.

But when I do so and then I connect a device via Wi-Fi I get a whole different network: 192.168.2.0. Is there a way to use the same 10.0.100.0 network?

I need it because I have internal DNS and need to debug stuff over the LAN.

Best Answer

You Mac is getting a single IP address on the LAN. To enable multiple devices to access the LAN, it creates a new private network on the Wi-Fi interface, and does NAT (Network Address Translation) between that network and the LAN. This is the same thing that happens when you connect your LAN (using private addresses) to the Internet using a router that gets a single public IP address.

Devices on your Wi-Fi network will be able to access devices on your LAN. Their IP address will be "translated" to your Mac's IP address, so devices receiving requests will see them as coming from your Mac. When they reply (to your Mac), your Mac will then do the reverse translation and send the packet down to the original device on the Wi-Fi network.

Note that this works well when devices on the Wi-Fi network need to access devices on the LAN. The other way around would be a problem.

An alternative is to use bridging instead of sharing. In that case, devices on both networks will think they're all on the same network (your Mac will forward frames from one network to the other). But this means that any devices on your Wi-Fi network will appear on the LAN (and use IP addresses there). Depending on your LAN's policies, this may or may not be an issue.