Okay, I'm struggling a bit here. I'm not all that good with Terminal and sorting out network issues using it but I've managed to scrape by so far.
Without using Internet Sharing (because controlling that via Terminal as per my question here doesn't actually seem to work in Yosemite) how can I share my internet connection from one interface (lets say en0
) to another (again, lets say en1
)?
I kind of understand that Internet Sharing creates a bridge (usually called bridge100
) and then uses bootpd
(I think) to establish a DHCP server and NAT to route all traffic from 192.168.2.xxx (which is the bridged network) through to your primary network.
How can I get the same result without using the Sharing pref pane?
Best Answer
Here is an interesting solution to share internet with a layer-2 bridge but without using NAT/DHCP (not required)/Internet Sharing Pref Panel at all:
Create a shell script ethernet-bridge.sh in /usr/local/sbin with the following content:
and make it executable:
Then put the following XML into /Library/LaunchDaemons as com.ethernet-bridge.plist
Then modify the file and load it:
The plist will enable the bridge mode while booting.
Check with
ifconfig -a
if the bridge is visible.To stop the bridge mode just enter:
To restart the bridge mode just enter:
Now set up the clients with a fixed IP/netmask/Gateway (the internal IP-address of the briding machine)/DNS or properly set up a DHCP server on the bridging machine.
Additionally you have to set up a static route on your router to the network you provide Internet Sharing to (in your example (en1)).
Until now the syslog messages don't work - I'll try to improve the script pertinently.
A similar approach is outlined here, but I didn't get it to work in Yosemite