A fix for shared dial-up connection issues

Feb 12, '02 08:55:41AM

Contributed by: Anonymous

Hi, not sure whether this was posted already. I had problems sharing a dial-up (Modem) PPP connection. I want to use NAT for security reasons and found that only the first connection after reboot worked. Subsequent connects would fail due to NATD not rebinding the new PPP bindings. Restarting NATD fixed the problem. Luckily PPPD fires off some scripts in /etc/ppp depending on connection status. The following script restarts NATD after every successfull connect if you save it as /etc/ppp/ip-up (don't forget to make it executable):

#!/bin/sh - 
N_P=`ps -uxc -U root | grep ' natd$' | awk '{ print $2 }'`
if [ "$N_P" != "" ]; then
logger -i -t $0 "Sending SIGHUP to natd (PID $N_P)"
kill -HUP $N_P
fi
In that script you can, of course, kick off other useful stuff you only want to happen if the link comes up (e.g. sending spooled mail).

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020212085541251