How to set up wireless bridge on same subnet

command lineinternet-sharingNetworkwifi

I have set up Internet Sharing over Wifi on an ethernet-wired desktop Mac running Yosemite 10.10. I have various OS X and iOS clients that are able to connect to the shared Wifi connection and access the internet normally.

The internet Sharing utility that is supplied in System Preferences is easy to use, but provides very few configuration options. I'd like my OS X client devices to see my Bonjour shares, and for that I believe they need to be on the same subnet. Internet Sharing creates its own subnet, however, and I'm forced to use clunky workarounds to access my Bonjour-shared material.

The primary subnet is 192.168.1.X. The subnet created by Internet Sharing is 192.168.2.X. I want any device that connects to the shared wireless to be on 192.168.1.X.

I believe that I could use the ethernet and wireless interfaces on my desktop Mac in bridge mode, where the desktop simply passes any packets it receives from either end straight through.

I have read up on ifconfig at FreeBSD, and got as far as creating a bridge and associating the two interfaces with it:

sudo ifconfig bridge create
(response: bridge1)
sudo ifconfig bridge1 addm en0 addm en1 up
sudo ifconfig en0 up
sudo ifconfig en1 up

Here, en0 is my ethernet interface, and en1 is my wireless interface. The documentation says that the bridge device needs an IP, so I gave it a static one instead of using DHCP:

sudo ifconfig bridge1 inet 192.168.1.3/24

The CIDR notation set up the netmask and broadcast addresses for me. I kinda hoped my wifi clients would be able to see 192.168.1.3 from that point, but no dice.

I have a DHCP server at 192.168.1.1, an Airport at 192.168.1.2 (which is inaccessible for these devices due to range), a router at 192.168.1.254 and DHCP addresses allowed in the range 192.168.1.4-192.168.1.253. The Airport is itself in bridge mode and provides no services other than the Wifi access point.

The issue I have is how to then set up the wireless access point on the desktop Mac. I know that I need to set the SSID, PSK, encryption, password, but the guides I am able to find online refer to various flavours of Linux and differ to what I have. Some guides are downright tantalising with the apparent simplicity of the task, such as this one: Creating a FreeBSD Wireless Access Point. There, one simply supplies parameters to ifconfig, but those parameters are missing from the OS X implementation. I know that OS X has the tools to do this already installed, since it can do it via Internet Sharing. I don't know how it does it and haven't been able to find out with the usual Googling.

Best Answer

I've had the same question, but from the other point of view. I wasn't aware of ifconfig (kinda new to this stuff). I think I got it working by doing it the other way round. I first had OS X share my internet over wifi (via sharing preferences) Then with ifconfig, you'll see that OS X creates a bridge100 (or something) I set the IP manually like you did on that bridge and then I add my network connection supplying the internet access.

Not entirely sure whether it works perfectly, at first glance, everything works OK, but who knows....