Well, I was doing something along those lines until I moved to using
l2tpd, which works far better IMO. I have a script in my init.d,
called cables - it runs after l2tpd and before all other internet
requiring scripts. Took some adjustments of the runlevels :-) I've
attached the script, if anyone wants to take a look. By the way, I
also placed scripts in the ip-up.d and ip-down.d to replace the
resolv.conf files when connected, so you have the correct DNS servers
in place. That is, replace the ones you got from DHCP with the ones
from your ISP.

On 00:52 Tue 20 Jul, Tzahi Fadida wrote:
> Hi,
> Thanks, but in the end I connected to netvision. I understood they
> supported linux properly but when I called them they say they
> only supports redhats from version 7 and I have version 5.2
> (originaly). anyway, they gave me a lame script that didn't work
> so I had to figure out for myself, whats the problem.
> I figured out I don't have /etc/dhcpc/dhcpcd-eth1.info 
> which I don't unedrstand why they insist on complicating things.
> so I just took it from ifconfig.
> ok, so when I called back to ofer them the revised script they
> say it doesn't matter because they only support redhats 7+.
> A bit lame if you ask me. In addition they say that they don't really
> know linux and that someone wrote for them the scripts and that they
> don't even know what the messages in the logs mean.
> some support...
> 
> Anyway, here is a simple fix to those who have old distributions:
> 
> #!/bin/bash
> 
> USERNAME="$1"
> CABLE_MODEM_INTERFACE="$2"
> /sbin/ifdown eth1
> /sbin/ifup eth1
> 
> CABLEGW=`/sbin/ifconfig|grep -A1 $CABLE_MODEM_INTERFACE|grep "inet addr"
> |cut -d":" -f2 |cut -d" " -f1`
> 
> /sbin/route add -host cable.netvision.net.il gw $CABLEGW
> 
> /usr/sbin/pptp-linux cable.netvision.net.il debug user $USERNAME remotename
> cable.netvision.net.il mtu 1460 mru 1460 defaultroute
> 
> sleep 5
> 
> NEWGW=$(/sbin/ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d"
> " -f1)
> 
> /sbin/route add default gw $NEWGW
> /sbin/route del default gw $CABLEGW
> 
> 
> Regards,
>       tzahi fadida.
> 
> > == Snip Snip == 

#!/bin/sh
#
cablegw=`cat /var/lib/dhcpc/dhcpcd-eth0.info | grep GATEWAY | cut -d"=" -f2`
dhcpserver=`cat /var/lib/dhcpc/dhcpcd-eth0.info | grep DHCPSID | cut -d"=" -f2`

case "$1" in
  start)
    echo -n "Starting internet link: "
    /sbin/route add 213.8.8.84 gw $cablegw
    /sbin/route add $dhcpserver gw $cablegw

    echo "c izahav" > /var/run/l2tp-control

    sleep 1

    newgw=`ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1`

    /sbin/route add default gw $newgw
    /sbin/route del default gw $cablegw
    echo "cables."
    ;;

  stop)
    echo -n "Stopping internet link: "
    echo "d izahav" > /var/run/l2tp-control

    /sbin/route add default gw $cablegw
    /sbin/route del 213.8.8.84 gw $cablegw
    /sbin/route del $dhcpserver gw $cablegw
    echo "cables."
    ;;

  restart)
    echo -n "Restarting internet link: "
    echo "d izahav" > /var/run/l2tp-control
    sleep 3
    echo "c izahav" > /var/run/l2tp-control
    echo "cables."
    ;;

  *)
    echo "Usage: /etc/init.d/cables {start|stop|restart}"
    exit 1
    ;;
esac

exit 0

-- 
Regards, Itamar Ravid
[EMAIL PROTECTED]

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to