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?

2 Answers 2


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:

#! /bin/sh
# ######################################
#  coded by Nat!
#  2013 Mulle kybernetiK
#  GPL


        sysctl -w net.inet.ip.forwarding=1
        sysctl -w net.inet.ip.fw.enable=1
        if [ "$proxyarp" != "no" ]
                sysctl -w net.link.ether.inet.proxyall=1

        ifconfig bridge0 create
        ifconfig bridge0 addm en0
        ifconfig bridge0 addm en1
        ifconfig bridge0 up
        if [ $? -eq 0 ]
                syslog -s "Ethernet Bridge is up"
                syslog -s "Ethernet Bridge failure"

        ifconfig bridge0 destroy

        sysctl -w net.inet.ip.forwarding=0
        sysctl -w net.inet.ip.fw.enable=0
        sysctl -w net.link.ether.inet.proxyall=0

        syslog -s "Ethernet Bridge is down"

case "$command" in
        start*) start

        stop*)  stop

and make it executable:

chmod 755 /usr/local/sbin/ethernet-bridge.sh

Then put the following XML into /Library/LaunchDaemons as com.ethernet-bridge.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

Then modify the file and load it:

sudo chmod 644 /Library/LaunchDaemons/com.ethernet-bridge.plist
sudo chown root:wheel /Library/LaunchDaemons/com.ethernet-bridge.plist
sudo launchctl load /Library/LaunchDaemons/com.ethernet-bridge.plist

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:

sudo /usr/local/sbin/ethernet-bridge.sh stop

To restart the bridge mode just enter:

sudo /usr/local/sbin/ethernet-bridge.sh start

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

  • This is great, thanks! :) I worked out the bridge part by scratching my head over man ifconfig for a while, but the sysctl bit would have been beyond me. Now to just figure out how to set Airport to AP mode. :P But that's for another question ...
    – Sera H
    Mar 30, 2015 at 7:31

I do it by simply setting up in my Network control panel…

The 'incoming' side (Ethernet 1) as automatic, DHCP (so it picks up whatever info it needs straight from my ISP) & the outgoing 'shared' side (Ethernet 2) as full manual (based on what the other networked machines would normally expect to see from my dedicated gateway), IP address subnet router blank, DNS I set to my ISP's regular DNS address.

Works just fine, if I have to take my gateway down for any length of time.

My ISP router, btw, is always set to be in 'just a modem' mode, so I'm not fighting it.

I have no clue how to do that in terminal, btw - all I do is change my saved "Location" from "Mac as Client" to "Mac as Server" & hit Apply.

  • I'm looking to use it as part of a script so it really needs to be terminal work. :\ But thanks :)
    – Sera H
    Mar 28, 2015 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .