Have a look here for the tutorial
with scripts at the end.
Your only real problem is masquerading, & when to pick up the new ip number.
This can be made separate from the basic ruleset. You only need to reference the new number for the masquerading rule in the nat POSTROUTING chain, and also in the nat PREROUTING chain if you have separate rp_filter rules rather than the /proc/sys/net/conf/*/ built in rp_filter.
All that, means that you can load your rules on boot and only make masquerade changes after the dialling is completed.
dhcp servers can also deliver gateway and dns settings to clients when they request an ip number. If you have a dns caching server on the RH8 box, you can leave the supplied dns number as the RH box rather than the external dns servers, letting the RH box's dns caching server talk to the outside world...