AMD-Z
6th April 2004, 05:39 PM
I am using cable+pptp script...
Here is the log:
which: no dhcpcd in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
which: no dhcpcd in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
No DHCP client running for eth0 (good)
Killing PPtP client 4738
/usr/bin/kill: 4738: No such process
IP address from cable modem is 172.23.231.68
which: no dhclient in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
Adding route via 172.23.224.1
Starting PPtP
Waiting 10 seconds for IP.........
Deleting old default route
Setting default route to 212.143.205.238
Fixing resolv.conf
[root@localhost michael]# netstat -r -n
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
212.143.205.238 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
212.143.205.8 172.23.224.1 255.255.255.255 UGH 0 0 0 eth0
172.23.224.0 0.0.0.0 255.255.224.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 212.143.205.238 0.0.0.0 UG 0 0 0 ppp0
and the pptp script:
#!/bin/bash
### DIALER ###
#!ppp0
# Based on a script from the CABLE-DHCP-PPTP-HOWTO
# Save resolv.conf
cp /etc/resolv.conf /etc/resolv.conf.sv
if [ $? -ne 0 ]
then
exit -1
fi
# Get address from DHCP server
if [ -x `which dhcpcd` ]
then
/sbin/dhcpcd
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhcpcd`"
elif [ -x `which dhcpd3` ]
then
dhcpd3
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhcpd3`"
elif [ -x `which dhclient` ]
then
dhclient
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhclient`"
else
exit -1
fi
# See if we already have DHCP client running
PS=`ps -ax | grep ${DHCPCLIENT} | grep eth0 | awk "{print \\$1}"`
if [ " " != " $PS" ]
then
# If so, /usr/bin/kill it
echo "Killing DHCP client for eth0 " $PS
/usr/bin/kill -KILL $PS
else
echo "No DHCP client running for eth0 (good)"
fi
# See if we already have a pptp client running
PS=`ps -ax | grep pptp | awk "{print \\$1}"`
if [ " " != " $PS" ] ; then
# If so, usr/bin/kill it
echo "Killing PPtP client " $PS
/usr/bin/kill -KILL $PS
else
echo "No PPtP client running (good)"
fi
# See if we got an address from DHCP server
INET=`/sbin/ifconfig eth0 | grep inet | grep addr | awk "{print \\$2}" | awk -F: "{print \\$2}"`
echo "IP address from cable modem is " $INET
# If we didn't, we must have a DHCP client running, try to kill it again and quit.
if [ " " == " $INET" ]
then
PS=`ps -ax | grep ${DHCPCLIENT} | grep eth0 | awk "{print \\$1}"`
if [ " " != " $PS" ]
then
echo "Killing DHCP client for eth0 " $PS
/usr/bin/kill -KILL $PS
echo "Giving up."
exit 1
fi
fi
# Gateway
if [ "${DHCPCLIENT}" == "`which dhclient`" ]
then
CABLEGW=`cat /etc/dhcpc/dhcpcd-eth0.info | grep GATEWAY | cut -d"=" -f2`
else
CABLEGW=""
fi
# Add route
echo "Adding route via " $CABLEGW
/sbin/route add -host cable.netvision.net.il gw $CABLEGW dev eth0
if [ $? -ne 0 ]
then
exit -1
fi
echo "Starting PPtP"
/usr/sbin/pptp cable.netvision.net.il user zgenaz12 debug remotename cable.netvision.net.il mtu 1452 mru 1452 noauth defaultroute
if [ $? -ne 0 ]
then
exit -1
fi
echo -n "Waiting 10 seconds for IP"
counter=1
while [ $counter -lt 10 ]
do
echo -n .
sleep 1
counter=`expr $counter + 1`
done
echo
# New gateway
NEWGW=$(/sbin/ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)
echo "Deleting old default route"
/sbin/route del default dev eth0
if [ $? -ne 0 ]
then
exit -1
fi
echo "Setting default route to " $NEWGW
/sbin/route add default gw $NEWGW
if [ $? -ne 0 ]
then
exit -1
fi
echo "Fixing resolv.conf"
cp /etc/resolv.conf.sv /etc/resolv.conf
if [ $? -ne 0 ]
then
exit -1
fi
# Surf the web
### end of DIALER ###
exit 0
what can i do?
Here is the log:
which: no dhcpcd in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
which: no dhcpcd in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
No DHCP client running for eth0 (good)
Killing PPtP client 4738
/usr/bin/kill: 4738: No such process
IP address from cable modem is 172.23.231.68
which: no dhclient in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/michael/bin)
Adding route via 172.23.224.1
Starting PPtP
Waiting 10 seconds for IP.........
Deleting old default route
Setting default route to 212.143.205.238
Fixing resolv.conf
[root@localhost michael]# netstat -r -n
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
212.143.205.238 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
212.143.205.8 172.23.224.1 255.255.255.255 UGH 0 0 0 eth0
172.23.224.0 0.0.0.0 255.255.224.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 212.143.205.238 0.0.0.0 UG 0 0 0 ppp0
and the pptp script:
#!/bin/bash
### DIALER ###
#!ppp0
# Based on a script from the CABLE-DHCP-PPTP-HOWTO
# Save resolv.conf
cp /etc/resolv.conf /etc/resolv.conf.sv
if [ $? -ne 0 ]
then
exit -1
fi
# Get address from DHCP server
if [ -x `which dhcpcd` ]
then
/sbin/dhcpcd
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhcpcd`"
elif [ -x `which dhcpd3` ]
then
dhcpd3
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhcpd3`"
elif [ -x `which dhclient` ]
then
dhclient
if [ $? -ne 0 ]
then
exit -1
fi
DHCPCLIENT="`which dhclient`"
else
exit -1
fi
# See if we already have DHCP client running
PS=`ps -ax | grep ${DHCPCLIENT} | grep eth0 | awk "{print \\$1}"`
if [ " " != " $PS" ]
then
# If so, /usr/bin/kill it
echo "Killing DHCP client for eth0 " $PS
/usr/bin/kill -KILL $PS
else
echo "No DHCP client running for eth0 (good)"
fi
# See if we already have a pptp client running
PS=`ps -ax | grep pptp | awk "{print \\$1}"`
if [ " " != " $PS" ] ; then
# If so, usr/bin/kill it
echo "Killing PPtP client " $PS
/usr/bin/kill -KILL $PS
else
echo "No PPtP client running (good)"
fi
# See if we got an address from DHCP server
INET=`/sbin/ifconfig eth0 | grep inet | grep addr | awk "{print \\$2}" | awk -F: "{print \\$2}"`
echo "IP address from cable modem is " $INET
# If we didn't, we must have a DHCP client running, try to kill it again and quit.
if [ " " == " $INET" ]
then
PS=`ps -ax | grep ${DHCPCLIENT} | grep eth0 | awk "{print \\$1}"`
if [ " " != " $PS" ]
then
echo "Killing DHCP client for eth0 " $PS
/usr/bin/kill -KILL $PS
echo "Giving up."
exit 1
fi
fi
# Gateway
if [ "${DHCPCLIENT}" == "`which dhclient`" ]
then
CABLEGW=`cat /etc/dhcpc/dhcpcd-eth0.info | grep GATEWAY | cut -d"=" -f2`
else
CABLEGW=""
fi
# Add route
echo "Adding route via " $CABLEGW
/sbin/route add -host cable.netvision.net.il gw $CABLEGW dev eth0
if [ $? -ne 0 ]
then
exit -1
fi
echo "Starting PPtP"
/usr/sbin/pptp cable.netvision.net.il user zgenaz12 debug remotename cable.netvision.net.il mtu 1452 mru 1452 noauth defaultroute
if [ $? -ne 0 ]
then
exit -1
fi
echo -n "Waiting 10 seconds for IP"
counter=1
while [ $counter -lt 10 ]
do
echo -n .
sleep 1
counter=`expr $counter + 1`
done
echo
# New gateway
NEWGW=$(/sbin/ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1)
echo "Deleting old default route"
/sbin/route del default dev eth0
if [ $? -ne 0 ]
then
exit -1
fi
echo "Setting default route to " $NEWGW
/sbin/route add default gw $NEWGW
if [ $? -ne 0 ]
then
exit -1
fi
echo "Fixing resolv.conf"
cp /etc/resolv.conf.sv /etc/resolv.conf
if [ $? -ne 0 ]
then
exit -1
fi
# Surf the web
### end of DIALER ###
exit 0
what can i do?