I need to create a local WLAN using my MacBook Air's built-in network card (I need an IP network on this, with the MacBook being the router and WLAN clients being able to talk to it with its respective IP, etc.).
Basically, I need to turn my MacBook Air into a hotspot. I do not need any internet access on this network. All I need is a wireless LAN.
I've been looking into the Internet Sharing feature in System Preferences → Sharing. However, I've run into the following constraints:
-
"Internet Sharing" will not work if I do not have another interface to share "from". E.g. I need to have an ethernet cable plugged in (and working) or something similar for Internet Sharing to agree to create a hotspot. I don't need Internet on this network, I just need a LAN.
-
It's not doing DHCP. When I do get the hotspot to work (with another interface present, see point above), the LAN clients get self-assigned IPs such as 169.254.203.23, so it's just not handing any IPs out. I've tried messing with
/etc/bootpd.plist
, but it didn't help. -
I can't figure out how to enable all this mess programatically. Not only do I need to create an Internet-less WLAN with only my Wi-Fi interface and do DHCP, but this also needs to be done programatically (AppleScript, shell script, anything works). I have no clue how to do this.
So, how do I create a WLAN that:
-
Runs (preferably) out-of-the-box on any MacBook.
-
Does not need another interface to work, just my Wi-Fi interface.
-
Can be turned on programatically.
-
Does basic DHCP (I can figure this out myself, I've found a node-based
dhcpd
server).
I am running macOS 10.14 Mojave.
Best Answer
This is not a programmatic but a manual solution.
Go to System Preferences → Network and check Show Wi-Fi status in menu bar.
Now click on the Wi-Fi icon shown in the menu bar and select Create Network....
Supply network name in the dialogue box shown (the default name assigned is the computer name set under System Preferences → Sharing).