Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Share internet connections on a 192.168.x.x network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Share internet connections on a 192.168.x.x network
Authored by: rajulkabir on Mar 03, '06 07:06:21PM

Ran into a similar problem this week. I'm staying at a hotel that provides wifi with 192.168.2.* addresses, and I wanted to use my VoIP box connected via my iBook's ethernet port. Unfortunately, due to Apple Internet Sharing's inflexible setup, there was an address conflict.

The hint above gets you part of the way, but does not provide DHCP or DNS out the sharing port. So it's not very helpful for dumb devices like the VoIP box that expect to be spoon-fed everything via DHCP.

I puttered around for a while and eventually came up with a working procedure. It's ugly, and probably only useful for someone comfortable at the command line, but it does get the job done.

In this case I am assuming you will use 10.168.2.* for your shared network (to avoid conflict with 192.168.2.* and minimize typing). Also I am assuming you are receiving internet via en1 (airport) and want to share it via en0 (ethernet).

  1. Turn on internet sharing
  2. Copy the file /etc/com.apple.named.conf.proxy to your home directory
  3. Edit your copy of the file, change the 'listen-on' directive to point to 10.168.2.1 instead of 192.168.2.1 (don't change anything else)
  4. Start up Netinfo Manager
  5. Duplicate /config/dhcp/subnets/192.168.2
  6. Edit your duplicate, changing every instance of 192 to 10
  7. Save changes
  8. Turn off internet sharing
  9. Open a shell prompt and get yourself to root (sudo bash or whatever you prefer)
  10. /sbin/ifconfig en0 10.168.2.1 netmask 255.255.255.0 broadcast 10.168.2.255
  11. /usr/libexec/bootpd -P -D
  12. /usr/sbin/natd -interface en1 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface en0
    (this is showing up with awkward line breaks; in every case the - (hyphen) should immediately precede the following letter, with no intervening spaces.
  13. /sbin/ipfw add 100 divert natd ip from any to any via en1
  14. /usr/sbin/named -c ~/com.apple.named.conf.proxy
  15. /usr/sbin/sysctl -w net.inet.ip.forwarding=1

Good luck.

[ Reply to This | # ]

Share internet connections on a 192.168.x.x network
Authored by: jcovert on May 13, '06 05:43:36PM

The above hint with all the bootpd and caching named (etc.) setup was really helpful. One thing though.

The author suggested /usr/libexec/bootpd -P -D

I found that even though I had deleted the 192.168.2 subnet from Netinfo, bootpd was still listening on the WiFi (en1) interface, and though it didn't seem to be trying to give out addresses, when it noticed the other DHCP server running, it would exit. So after a while, when my clients on en0 would request a new lease, the server was gone.

I solved this by adding -i en0 to the command line.

Also, I'm not sure what "-P" is, and when I started using -i en0 I also started using "-B" instead, to disable bootp and only use DHCP.

Thanks again for the excellent work above.

/john



[ Reply to This | # ]