Share a Modem over Ethernet (Solution)

RiscIt

Registered
I'm posting this because I came here looking for an answer and had to look _way_ too hard to find one.

This script will setup MacOS X to share your dial-up ppp/modem connection over ethernet:

#!/bin/sh
##
# Start natd and set ipfw rules to enable NAT
# Built in port upstream exposed, no limits
# To disable this service, modify this file
##
/usr/sbin/natd -interface ppp0 -dynamic -s -m
/sbin/ipfw -f flush
/sbin/ipfw add divert natd all from any to any via ppp0
/sbin/ipfw add pass all from any to any
/usr/sbin/sysctl -w net.inet.ip.forwarding=1



simply execute that script as root, and you're set.

Thanx to Theed, who originally posted the bulk of that script.
 
Thanks for your script! PPP0 would have been my next guess.

I've read theed's original version with "en0" as interface, but was unable to locate a table with the names or identifiers of the actual network interfaces (en0 etc.) to address my modem.

Just for my curiosity: Who generates the interface names? The KernelEXTensions, as I read .kext-suffix, on runtime, while booting, or - hard to believe - static? And: where the f*@# to find them?

Sincerly, Thomas
 
heh...

I have no idea who sets the names of devices.

I'm a bit of a linux geek (far from guru, but I've got my share of experience) and remembered, ppp0, but in order to check and refresh my memory I just had a look at /etc/ipfw.conf and found the empty section set aside for my ppp connection labeled with this comment:

####################################################
## BEGIN SECTION
## Interface ppp0
####################################################

That was enough to confirm it for me.

For further discussion... I don't think (or at least I'm not sure) that ppp0 actually refers to the modem as a _device_ name, but rather as a protocol. I say this because I remember ethernet devices as being referred as eth0, eth1, etc.. not en0, en1... But maybe this is simply an inconsistency between darwin/bsd and the Red Hat Linux I'm familiar with.

In any case, the script works (at least for me) and I'm not sure why I'm babbling on about device names... perhaps I'm just hoping that someone will enlighten me =)
 
Back
Top