Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 1998 19:37:26 +0200
From:      Arve Ronning <Arve.Ronning@ah.telia.no>
To:        Stefan Herrmann <stefan@asterix.webaffairs.net>
Cc:        freebsd-isdn@FreeBSD.ORG
Subject:   I4B & NAT (was : succeeded !)
Message-ID:  <3587FED6.167EB0E7@ah.telia.no>

next in thread | raw e-mail | index | archive | help
Stefan wrote:
> 
> Hi Arve,
> 
> > Natd -dynamic in cooperation with sppp doesn't work the way people seem
> > to think. Natd -dynamic opens a routing socket and waits for a routing message
> > which is assumed to arrive when the interface gets a new IP-address.
> > However, sppp doesn't supply a routing message for natd when the IP-address is
> > changed during ppp address negotiation.
> >
> > The result is that the interface IP-address stored in natd doesn't get updated
> > after a redial.
> >
> > However, (as always in the unix world:) there is a way around this problem.
> > I use a script which does a kill -HUP on natd when i4b comes up after a
> > (re)dial. This forces natd to (re)read the interface IP-address. The script
> > is executed by isdnd.
> >
> > I don't have the details here (at work). If you are interested, I'll check the
> > setup (at home).
> 
> I have (naturally) the same problem and am interessted in your script. Thanks :-)
> 
> Ciao
> Stefan
> --

The solution was originally provided by "D. Rock" <rock@cs.uni-sb.de> 
and it's based on the regexpr/regprog facility in isdnd.rc .
The following is an extract from my isdnd.rc:

---------------- in the "system" section, add this -------
regexpr         = "call active"         # look for matches in log
regprog         = isdn_up               # execute program when match
regexpr         = "call disconnected"
regprog         = isdn_down
----------------------------------------------------------

which will make isdnd do the following:
   start:
        if ( "call active" is written to isdnd.log ) run isdn_up;
        if ( "call disconnected" is written to isdnd.log ) run
isdn_down;
	goto start;

So, to make it work, isdnd must be started with the -l option in order
to generate /var/log/isdnd.log . The isdn_up & isdn_down scripts reside 
in /etc/isdn and both are executable and owned by root/wheel.

The isdn_up script:
----------------------------------------------------------
#!/bin/sh
cp /etc/isdn/isdnd.rc /dev/pcaudio
pid=`cat /var/run/natd.pid`
kill -HUP $pid
sleep 1
kill -HUP $pid
sleep 2
kill -HUP $pid
sleep 5
kill -HUP $pid
----------------------------------------------------------

The isdn_down script:
----------------------------------------------------------
#!/bin/sh
cp /etc/isdn/samples/answer /dev/pcaudio
sleep 1
cp /etc/isdn/samples/answer /dev/pcaudio
----------------------------------------------------------

If you don't have /dev/pcaudio, just remove the line in isdn_up and 
the last pair of regexpr/regprog lines in isdnd.rc and 
omit the isdn_down script.

The reason for using /dev/pcaudio is that I have a separate 386-box
configured as an isdn gateway/router. This way I hear a long burst 
of noise when the isdn line connects and 
two shorter bursts when it disconnects.

In short, the main point here is to be sure that natd receives at 
least one -HUP as soon as possible after the interface IP-address 
has changed.

Regards
  -Arve


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isdn" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3587FED6.167EB0E7>