Bug 7465 - PPP initscripts with multiple ISPs
Summary: PPP initscripts with multiple ISPs
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-12-01 02:28 UTC by Craig B. Markwardt
Modified: 2014-03-17 02:11 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-12-06 19:27:04 UTC
Embargoed:


Attachments (Terms of Use)

Description Craig B. Markwardt 1999-12-01 02:28:39 UTC
I use my RedHat 6.1 machine to connect to multiple ISPs which have
different name servers.  Each one has its own PPP interface.
Unfortunately, there is no apparent way to select different name
servers for each interface.

Here is are two small patches for ifup-ppp and ifdown-ppp which
allow you to do this. If DNSSRVS is defined in ifcfg-pppX, then these
servers are added to /etc/resolv.conf when the device is brought up.

The DNSSRVS variable is used for the same thing in the PCMCIA package.

Craig

diff -u ifup-ppp.orig ifup-ppp
--- ifup-ppp.orig       Tue Nov  9 23:44:26 1999
+++ ifup-ppp    Tue Nov  9 23:45:32 1999
@@ -75,6 +75,20 @@
   chatdbg="-v"
 fi

+# Set up DNS resolver
+RESOLV=/etc/resolv.conf
+if [ -n "$DNSSRVS" ]; then
+    cp $RESOLV $RESOLV.N
+    echo "# $DEVICE begin" >> $RESOLV.N
+    test "$DOMAIN" && echo "domain $DOMAIN" >> $RESOLV.N
+    test "$SEARCH" && echo "search $SEARCH" >> $RESOLV.N
+    for DNS in $DNSSRVS ; do
+       echo "nameserver $DNS" >> $RESOLV.N
+    done
+    echo "# $DEVICE end" >> $RESOLV.N
+    mv $RESOLV.N $RESOLV
+fi
+
 if [ -z "$WVDIALSECT" ] ; then
   CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$DEVNAME
   [ -f $CHATSCRIPT ] || {

diff -u ifdown-ppp.orig ifdown-ppp
--- ifdown-ppp.orig     Tue Nov  9 23:41:39 1999
+++ ifdown-ppp  Tue Nov  9 23:43:18 1999
@@ -9,6 +9,14 @@

 file=/var/run/pppwatch-$DEVICE.pid

+RESOLV=/etc/resolv.conf
+# Remove nameservers
+if fgrep -q "# $DEVICE begin" $RESOLV ; then
+    sed -e "/# $DEVICE begin/,/# $DEVICE end/d"        \
+       < $RESOLV > $RESOLV.N
+    mv $RESOLV.N $RESOLV
+fi
+
 if [ ! -f $file ]; then
     # ppp isn't running, or we didn't start it
     exit 0

Comment 1 Michael K. Johnson 1999-12-06 19:27:59 UTC
This is already done for you, set
DNS1=foo
and
DNS2=bar
in your /etc/sysconfig/network-scripts/ifcfg-* files and your
/etc/resolv.conf file will be munged appropriately.


Note You need to log in before you can comment on or make changes to this bug.