Subject: Changing addresses on ppp interface
To: None <tech-net@NetBSD.ORG>
From: Paul Mackerras <paulus@cs.anu.edu.au>
List: tech-net
Date: 09/20/1996 12:15:33
With a demand-dialled ppp link, there is the possibility that when the
link is actually established, the peer may insist on IP addresses for
the link which are different from those which were assigned to the ppp
interface when it was configured. For example, this can happen if we
are dialling out to an ISP which has several servers, and which server
we get connected to depends on which one has a free modem at the time.
At present pppd insists that the negotiated addresses for the ppp link
are the same as the addresses configured on the ppp interface
(specified when pppd was invoked). Some users consider this
restriction to be too severe. I'm seeking some information and advice
on what the effect of removing this restriction would be.
Clearly, if the IP address of the local end of the ppp link assigned
to us by the ISP is different from the local address we had previously
configured on the link, then any existing connections will be
stuffed. That is, if we had a connection established to some remote
host, then the link went down and came back up with a different local
IP address, the remote host will be sending data to our old IP
address, and there's no way to tell it the new address.
What would happen to a connection which is just being initiated?
Suppose it is the initial SYN packet which results in the link being
brought up, and the local IP address of the link gets changed before
that SYN packet actually gets sent out. Presumably it would contain
the old local IP address, so we'll never see the reply. Or would a
retransmitted SYN packet contain the new local IP address?
So if you want to use a demand-dialled link, it is at least highly
desirable to get your ISP to give you a statically-allocated IP
address which you can have each time you dial in (presumably after
you've authenticated yourself).
The IP address for the remote end of the link seems to be less
critical in many situations. When dialling out to an ISP, pppd would
typically be invoked with the defaultroute option to create a default
route via the remote address of the ppp link. If this remote address
is different from what is negotiated with the peer, we have basically
two options:
1. Leave the remote address on the ppp interface unchanged. This
could conceivably create routing problems, but this seems unlikely if
there is a default route via the ppp interface. The remote address on
the ppp interface could even be completely bogus. (This could be very
useful with those ISPs which refuse to divulge any IP address for
their end of the link.)
2. Change the remote address on the ppp interface to the new value,
and if we created a default route via the old address, delete it and
replace it with a default route via the new address. How would this
affect existing connections? Does the network code cache for each
connection such information as the gateway IP address to use when
sending packets? Would this get updated quickly and correctly?
If pppd does change either or both addresses on the ppp link, I guess
it should:
delete the default route if we created it
ioctl(SIOCDIFADDR) to delete the old addresses
ioctl(SIOCAIFADDR) to add the new addresses
create a new default route if necessary
Is it necessary/desirable to mark the interface down while this is
done? I assume that the network code will automatically remove and
add the appropriate interface routes.
Will doing this disrupt existing connections?
Corrections to any inaccurate statements above are welcome (at least,
accurate and informed corrections are :-).
Thanks,
Paul Mackerras.