# Routing to ppp0 fails

## dark-lord

Hi!

I'm new here (This is my first post), and i just finished installing Gentoo for my first time!   :Very Happy:   :Very Happy:   :Very Happy: 

And here's a littile issue - im trying to connect to the internet with a script from my ISP

Everything work's correctly till the script tries to route the gateway to ppp0, then i get: ppp0: error fetching device......................device not found.

And here is the script:

```

#!/bin/bash

IFACE="eth0"

/sbin/dhclient $IFACE

if [ -f /var/run/ppp0.pid ]; then

echo "Connection already established. To stop the connection execute "stop" script"

exit

fi 

### Clean up

killall l2tpd

rm -f /var/run/l2tp-control /var/run/l2tpd.pid

### Check connectivity to LNS via cables infrastructure

ping -c 1 -w 5 cable.netvision.net.il > /dev/null 2> /dev/null && P="OK" || P="FAIL"

if [ "$P" == "FAIL" ]; then

        echo "You have problems with the connection. Try stopping and starting $1 interface."

        exit 0;

fi

### Get the needed IPs 

CABLEGW=$(grep routers /var/lib/dhcp/dhclient.leases | awk '{print $3}' | tail -1 | cut -d";" -f1)

CABLEDHCP=$(grep dhcp-server-identifier /var/lib/dhcp/dhclient.leases | awk '{print $3}' | tail -1 | cut -d";" -f1)

TUNDEST=$(host cable.netvision.net.il | head -1 | cut -d" " -f 4)

ping -c 1 -w 5 $TUNDEST > /dev/null 2> /dev/null && P="OK" || P="FAIL"

if [ "$P" == "FAIL" ]; then

        echo "You have problems with the connection. Cannot ping LNS server."

   echo "Check if you are using "dhclient" to get an IP address from Cables provider."

        exit 0;

fi

### Fixing the L2TP config file

perl /usr/local/scripts/repl.pl $TUNDEST /etc/l2tp/l2tpd.conf

/usr/sbin/l2tpd > /dev/null

echo "Cable GW: $CABLEGW"

echo "DHCP Server: $CABLEDHCP"

echo "Tunnel dest: $TUNDEST"

if [ "$CABLEGW" == "" ]; then

        echo "You have problems with the connection. Call Cables support."

   exit 0;

fi

### Adding routes to LNS and DHCP server

/sbin/route add -host $TUNDEST gw $CABLEGW

/sbin/route add -host $CABLEDHCP gw $CABLEGW

### Starting L2TP daemon 

NEWGW=""

### Connecting...5 tries

for c in 1 2 3 4 5; do ################Here it fails

   echo "c nv" > /var/run/l2tp-control &

   sleep 5

        NEWGW=$(ifconfig ppp0 | grep inet | cut -d":" -f3 | tail -1 | cut -d" " -f1) ;

   [ "$NEWGW" == "" ] && echo "Connecting attempt $c..." || break;

done

if [ "$NEWGW" == "" ]; then

   echo "Could not connect to Cables. Call Netvision technical support for help."

   killall l2tpd

   rm -f /var/run/l2tp-control /var/run/l2tpd.pid

   exit 0;

fi

echo "Connection established"

echo "PPP Gateway: $NEWGW"

logger -t NVdialer -- Connection established, IP: `/sbin/ip addr list ppp0 | grep inet | awk '{print $2}'` 

/sbin/route add default gw $NEWGW

/sbin/route del default gw $CABLEGW

echo "nameserver 194.90.1.5" > /etc/resolv.conf

echo "nameserver 212.143.212.143" >> /etc/resolv.conf

```

Any idea of what i need to do?

Thank's!

----------

## dark-lord

ugh...

guys?

----------

## jpl888

Dark Lord,

Don't use that ISP script.

Gentoo has full and frank PPP support built in use its' scripts instead. Start by looking at the PPP/DSL section in "/etc/conf.d/net".

Have you got the right kernel support?

What kind of DSL device are you using?

----------

## dark-lord

Gentoo's scripts aint work - my isp got it's own only-working thing,

not DSL, Cable

Thank's for replying  :Very Happy: 

P.S.

When i was at sabayon it printed twice the message and then connected

----------

## jpl888

Ok, I don't know much about cable, but how is it connected to your PC?

Presumably an ethernet connection.

Have you got l2tpd installed?

Please give more information, throw me a freaking bone.

----------

## dark-lord

L2TPD ..yes but not as emerge - i copied a binary that my isp gave me,

About the connection - everithing work's O-K, it just aint recognizes ppp0 and pppconfig aint woks(Some syntax issue)

----------

## Dan

Dark Lord, 

     You really shouldnt need that script from your isp, in fact that may be your problem.

See /etc/conf.d/net.example for some PPP settings.

Follow this guide

http://gentoo-wiki.com/HOWTO_Connect_using_PPPoE

----------

## jpl888

Perhaps post the output of "ifconfig".

----------

## dark-lord

ill give the guide a try.... be back soon  :Very Happy: 

Thank's!

----------

## dark-lord

Hey!

Ok, i'm back but im still in no-go  :Very Happy: 

Same here - it prints: Network device ppp0 not found, and refers me to the kernel to check the drivers, wich are FINE - PPP is fully enabled.

So, the question is: how to make it recognize ppp0?

Thank's again.  :Wink: 

----------

## jpl888

So again if you do "ifconfig" what do you get?

If there is no "ppp0" there do "ifconfig -a" and post that.

If you can't see ppp0 in either of those then the kernel driver is not ok.

----------

## dark-lord

Hey again!

No ppp0 in ifconfig nor in ifconfig -a,

i checked my kernel (Using genkernel --menuconfig all)

and the only thing that was related to ppp && wasnt enabled was old ISDN support, wich i enabled and recompiled the kernel - that did'nt help either.

Is there any module related to PPP that i should load?

Though PPP Support in my kernel isnt marked as module.

----------

## mrness

1) Use a metric > 0 on your external Ethernet interface (see net.example for this). pppd will fail to add a default route if you already have a default route with metric 0.

2) We have net-dialup/l2tpd in our tree, not to mention a more up2date l2tp daemon which is net-dialup/xl2tp. You should try to use one of these.

3) Try to find a professional ISP, one that do not burden its clients with oddities like that. The normal way of connecting through cable links is either DHCP (problematic for ISPs, prone to MAC cloning if they don't have filters on modems) or PPPoE (safe for them, requiring you to authenticate yourself).Last edited by mrness on Sun Apr 08, 2007 7:16 am; edited 1 time in total

----------

## dark-lord

Ok,

U covinced me - i gonna dump my ISP...for Gentoo!

Yet, i think it worth it   :Wink: 

See you later.

Thank you all!

----------

## mrness

 *mrness wrote:*   

> 1) Use a metric > 0 on your external Ethernet interface (see net.example for this). pppd will fail to add a default route if you already have a default route with metric 0.

 

I was wrong, but I fixed it in ppp-2.4.4-r10. Now you can even control what metric will be used in the default route installed by pppd.

----------

