I have a MacBook Pro running OSX Yosemite 10.10.5 and I'm trying to set it up as a server. I have a Realtek USB WiFi dongle (RTL8188cus) plugged in with the drivers installed, showing up as interface en6. I also have the built-in AirPort on interface en0. I don't care which interface is used, I'm just providing options.
Goal
The goal is to allow users to connect to my MBP via WiFi and get an IP address via DHCP. The reason being is that I am running a website on my MBP that I want to share only with people connecting to my MBP directly (via WiFi).
Bonus
A huge bonus would be having a way that I could assign a hostname to my MBP so that people could visit the website without having to type in the IP address of the gateway (my macbook).
Note
This is not internet sharing! I'm not interesting in forwarding any data or connections.
Best Answer
To get that working you have to be able to create an ad-hoc network with one of the two Wi-Fi interfaces. It works at least with Airport but only without any Wi-Fi security like WEP/WPA/WPA2. I don't have access to a RTL8188cus, so I don't know if its driver allows a "safer" wireless networking.
Additionally you have to install a lightweight DNS/DHCP service like dnsmasq.
Install homebrew:
doctor homebrew:
install dnsmasq:
copy config and plist files:
create some additional config files and folders:
Create an ad-hoc network with your Airport Wi-Fi interface including a name.
Open System Preferences -> Network -> Airport Interface and configure an IP-address, a netmask and a DNS-server manually:
Modify /usr/local/etc/hosts/hosts.conf with nano:
Content (append a trailing empty new line):
Modify /usr/local/etc/dnsmasq.conf with nano:
Content:
If you need further settings/options read the comments in the config file.
load the dnsmasq daemon: