# Noob qestion , How to configure cables on Gentoo 2004.1

## _nightw0lf

I've just installed Gentoo 2004.1 with kernel 2.4.25

And I have no clue how to configure my cable modem through ppp-pptp.

Thanks in advance.

----------

## NeddySeagoon

_nightw0lf,

How is your cable box connected to your PC?

Common ones are USB or Ethernet.

If its USB we will need the ProductID and VendorID, which you can get from /proc/bus/usb/devices

----------

## Deathwing00

Moved from Installing Gentoo.

Compile either built-in or as a module the CDC Ether USB driver.

----------

## _nightw0lf

Sorry about that one Deathwing00 , I'm new here   :Wink: 

And I'm using an Ethernet cable connection.

I'm having a script to connect to the internet from my isp

The script contains :

```
#!/bin/bash

USERNAME="egrin"

IFACE="eth0"

PPTPS=cable.netvision.net.il

ifdown eth0

ifup eth0

   NVGW=$(host $PPTPS | cut -d" " -f4 | cut -f3 | tail -1)

   CABLEGW=$(ip r l | grep default | cut -d" " -f3)

   

route add -host $NVGW gw $CABLEGW dev $IFACE

./pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns

sleep 7

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

route add default gw $NEWGW

route del default gw $CABLEGW

echo nameserver 194.90.1.5 > /etc/resolv.conf

echo nameserver 212.143.212.143 >> /etc/resolv.conf

```

Now when I execute that , thats what is comming out :

```
line 7: ifdown: command not found.

line 8: ifup: command not found.

line 1: host: command not found.

line 1:ip: command not found.

gw: Unknown host

fatal[get_ip_address:pptp.c:236]: gethostbyname: name server error.

ppp0 error fetching interface information 

device not found.
```

----------

## NeddySeagoon

_nightw0lf,

First, use /sbin/ifconfig to check that

a) you have an eth0

b) that its your real network card, not ethernet over firewire.

Until you get an eth0 none of the rest of this will work. 

Gentoo does not have the ifdown, ifup commands

Use 

```
/etc/init.d/net.eth0 restart
```

to achieve the same thing.

The second set of errors come from the ./pptp script, which is probably complaining about something above not being right.

----------

## Deathwing00

Do as NeddySeagoon says. All that is already in the installation guide:

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8#doc_chap2

----------

## _nightw0lf

Well, I can see eth0 in /sbin/ifconfig

And it configured to dhcpd.

----------

## NeddySeagoon

_nightw0lf,

Good. 

What happens when you hack your script the way I suggested ?

----------

## _nightw0lf

I should do something about the pptp script thing, need to find a way to hack this too.

----------

## NeddySeagoon

_nightw0lf,

The Point to Point Tunneling Protocol script should work

Whats the problem now?

----------

## _nightw0lf

This is my script now :

```
#!/bin/bash

USERNAME="egrin"

IFACE="eth0"

PPTPS=cable.netvision.net.il

/etc/init.d/net.eth0 restart

   NVGW=$(host $PPTPS | cut -d" " -f4 | cut -f3 | tail -1)

   CABLEGW=$(ip r l | grep default | cut -d" " -f3)

   

route add -host $NVGW gw $CABLEGW dev $IFACE

./pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns

sleep 7

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

route add default gw $NEWGW

route del default gw $CABLEGW

echo nameserver 194.90.1.5 > /etc/resolv.conf

echo nameserver 212.143.212.143 >> /etc/resolv.conf

```

After executing that script.. that is the output:

```

*Unmounting network file system     [OK]

*Bringing eth0 down                       [OK]

*Bringing eth0 up                           [OK]

*Mounting network file system         [OK]

./cablestartv.030: line 1: host: command not found.

./cablestartv.030: line 1: ip: command not found.

gw: Unknown host

fatal[get_ip_address:pptp.c:232]: gethostbyname: HOST NOT FOUND.

ppp0: error fetching interface information - Device not found.
```

----------

## NeddySeagoon

_nightw0lf,

It looks like your ./pptp script is running a script called ./cablestartv.030, or just ./cablestartv and this in turn is trying to execute commands 'host' and 'ip'

Can you post both the pptp and cablestartv scripts please.

----------

## _nightw0lf

I think the host and ip command that it trying to execute are here:

```

   NVGW=$(host $PPTPS | cut -d" " -f4 | cut -f3 | tail -1)

   CABLEGW=$(ip r l | grep default | cut -d" " -f3)

    
```

Or might be I'm wrong..

And this is the original cablestart.v030 script:

```
#!/bin/bash

USERNAME="egrin"

IFACE="eth0"

PPTPS=cable.netvision.net.il

ifdown eth0

ifup eth0

   NVGW=$(host $PPTPS | cut -d" " -f4 | cut -f3 | tail -1)

   CABLEGW=$(ip r l | grep default | cut -d" " -f3)

   

route add -host $NVGW gw $CABLEGW dev $IFACE

./pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns

sleep 7

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

route add default gw $NEWGW

route del default gw $CABLEGW

echo nameserver 194.90.1.5 > /etc/resolv.conf

echo nameserver 212.143.212.143 >> /etc/resolv.conf

```

----------

## NeddySeagoon

_nightw0lf,

Try this:-

```
#!/bin/bash

USERNAME="egrin"

IFACE="eth0"

PPTPS=cable.netvision.net.il

./pptp $(hostname) debug user $USERNAME mtu 1380 mru 1380 defaultroute persist nobsdcomp usepeerdns

sleep 7

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

route del default

route add default gw $NEWGW

echo nameserver 194.90.1.5 > /etc/resolv.conf

echo nameserver 212.143.212.143 >> /etc/resolv.conf 

```

----------

## _nightw0lf

I've tried it, this is the outputs:

```
fatal[get_ip_address:pptp.c:236]: gethostbyname: name server error

ppp0: error fetching interface information: Device not found.

SIOCADDRT: No such device.
```

----------

## NeddySeagoon

_nightw0lf,

Have you got PPP installed ?

```
emerge ppp -p
```

 if its new, you need to get that.

----------

## _nightw0lf

Yes, I did installed ppp.

Even edited the /etc/ppp/pap-secrets 

and added there the user name and password.

----------

## NeddySeagoon

_nightw0lf,

ppp0 didn't come up for some reason, so the system was unable to get the ip address used by ppp0.

The pptp script must bring up ppp0 before it can tunnel over it.

Is there anything useful in your kernel log at /usr/log/<DependsOnLogger/. Beware of your username and password being there in plain text.

----------

## _nightw0lf

I didn't find anything useful in /var/log

But I did found new Netvision Cable script for gentoo. (nvcables-gentoo-0.3.tar.bz2)

It says to copy the nvstart.conf to /etc/conf.d/nvstart

And copy the nvstart.init to /etc/init.d/nvstart

Now after it done to type: rc-update add nvstart default .

ok

nvstart.init

```
#!/sbin/runscript

depend() {

        need net

}   

start() {

   ebegin "Starting nvcable-gentoo..."

   [ -n $PPTPS ] || eerror "no \$PPTPS set!"  

   [ -n $USERNAME ] || eerror "no \$USERNAME set!"

   NVGW=$(host $PPTPS | cut -d" " -f4 | cut -f3 | tail -n 1)

   echo $NVGW > /boot/pptp-nvgw

   CABLEGW=$(ip r l | grep default | cut -d" " -f3)

   route add -host $NVGW gw $CABLEGW

pptp $NVGW debug user $USERNAME mtu 1380 mru 1380 defaultroute persist

sleep 7 

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

route add default gw $NEWGW

route del default gw $CABLEGW

chmod 644 /etc/resolv.conf

}

stop() {

    ebegin   "stoping nvcables-gentoo..."

    ifconfig ppp0 down

    killall pptp

    [ -f /boot/pptp-nvgw ] || eerror "missing /boot/pptp-nvgw!!!"

    CABLEGW=$(ip r l | grep `cat /boot/pptp-nvgw` | cut -d" " -f3)

    route del `cat /boot/pptp-nvgw` gw $CABLEGW

    rm /boot/pptp-nvgw

    sleep 2

    route add default gw $CABLEGW

    dhcpcd -n

}

```

nvstart.conf

```
USERNAME=username

PPTPS=cable.netvision.net.il

#PPTPS - cable.netvision.net.il for netvision

#PPTPS - aztv.012.net.il for 012 internet zahav

```

I did like the manualy says, And when I start gentoo this is what I get:

```
*Starting nvcable-gentoo.......

/sbin/rc: line 1: host: command not found.

/sbin/rc: line 1: ip: command not found.

gw: Unknown host.

anon fatal[get_ip_address:pptp.c:353]: gethostbyname 'debug': HOST NOT FOUND.

ppp0: error fetching interface information: Device not found

Usage: inet_route [-vF] del {-host|-net} Target[/perfix] [gw GW] [metrin M] [[dev] If]
```

Here is where I've downloaded the script from:

https://sourceforge.net/projects/nvcables-gentoo/

----------

## markkuk

The "ip" command is in package sys-apps/iproute2 and "host" is in net-dns/bind-tools.

----------

## _nightw0lf

to get those packages i need to type emerge sys-app/iproute2 

and emerge net-dns/bind-tools?

or is there another path to those packages?

----------

## NeddySeagoon

_nightw0lf,

Thats right. You can also say

```
emerge package1 package2 ...
```

and emerge will work its way through the list.

----------

## _nightw0lf

Ok thank you guys, I will try it right away.

----------

## _nightw0lf

Well I did emerge to iproute2 and it installed it well.

But when I'm trying to install the other package bind-tools

It send me to the internet to download it..

So I've copied the file name " bind-9.2.3.tar.gz " and installed it manually

I did ./configure 

          make

The first error has disappeared ( the ip : command not found )

And the error with the host thing is still there..

So it seems I didn't install it well, 

Anyone know what exactly should I do?

Thanks in advance.

----------

## _nightw0lf

Anyone?   :Confused: 

----------

## NeddySeagoon

_nightw0lf,

./configure sets up the makefile for your PC

make builds the package in its source directory

You don't mention doing make install to actuallt install it. If thats all it is stop reading now.

bind-9.2.3.tar.gz is the right file, theres no patches to make life difficult.

All I can think of is that portage intalls it in in a non-defualt location,

so its not found.

Provided you have done an emerge sync sometime, you can put the tar file into /usr/portage/distfiles/ and the emerge command will work.

If you have not done emerge sync ever, you will not have /usr/portage/net-dns/bind-tools/

Its quite small, I can tar it and post it on the web if you are still stuck. That way you will be able to emerge it.

----------

## _nightw0lf

Sorry it took me a while, I had no chance to be near the computer.

I've tried what you've posted and the resoults are the same as they were 

before.

I have no clue what to do   :Rolling Eyes: 

----------

## michaely

Hi, did you try using Netvision's linux script?

http://cables2.netvision.net.il/linux/

These were originally made for RedHat but not too much modification is needed to get it to work with other distros, it's mainly about finding where the dhcp cllient info file is located.

I managed to get it to work with lots of othe distros (slackware, debian, mandrake, suse...), and even with a different ISP.

----------

## _nightw0lf

Yes michaely it was my fisrt script.. and its the old one..

I've found new release of it, more simple then that one you know..

and tried him on red hat, slackware, mandrake ..

And it worked well.

now im on gentoo and I can't get it work..

 :Embarassed: 

----------

## -=Avatar=-

Hello all, this will be my first message in this forum,

I hope not the last one.

so, I have the same problem with it, like you.

I just connect to Actcom, I am shore you know them,

and also never been a problem with Red Hat,

and I have the same Gentoo Kernel you have. 2.4.25, from gs-sources.

I found some interesting link about pptpclient in gentoo:

http://pptpclient.sourceforge.net/howto-gentoo.phtml

anyway, lets do it "para - para"  :Wink: 

1. I connect the ethernet cable from cable router to PC.

2. I recive IP from DHCP

3. I have a ping to ISP Gateway (192.117.122.13 and 172.25.32.1)

4. we need to perform 2 route commands, right ?!

are anyone with me ?

----------

## _nightw0lf

Hey, and welcome to the forum.

I've no idea what I need to do.. I've tried everything.

I have no X, only consol (init - 3).

And no Internet connection at all so I can't download some emerge pkg's.

About that howto, I didn't understand it ..   :Sad: 

----------

## Figaro

Rather than going through the whole ./configure thing, if you just download the files that the ebuild is looking for (*.tar.gz for instance) to the /usr/portage/distfiles/ directory then the ebuild will find them there and proceed with the emerge.

----------

## -=Avatar=-

Hi again.

Figaro there is no problem in Portage and no problem in dependencies

pptp and ppp fully installed with all dependencies.

there is a deferense how pptp or ppp configuration works in Gentoo and in other Linux destribution, i.e. RedHat. at least thats what I think so.

I see that I have emerge pptp version:

pptp-linux version 1.3.1

the same version I have in RedHat and it have no problem to connect.

We also need to chek if other RedHat distribution use same ppp as Gentoo, or maybe it use deferent configuration.

anyway from my last message:

as I told before I add 2 route commands: 

4.   route add -host 192.117.122.13 gw 172.27.192.1 dev eth0

192.117.122.13 is ISP Gateway

172.27.192.1 is Cable Gateway

in this as I understand: all trafic with ISP computer (pptp server) will be with Cable Gateway.

5. I delete default GW: route del default

all works fine for now, ping to ISP GW is working 100%

-----------------

6. Now the final stage PPTP connection with ISP PPTP Server:

pptp 192.117.122.13 user $USERNAME mtu 1460 mru 1460 defaultroute usepeerdns noauth

this should create PPP Interface, it's working in RedHat.

no error messages, nothing, and no ppp eather.

check Log files: /var/log/

[pppd] Couldn't set tty to PPP discipline: Invalid argument

[pppd] Exit.

[pptp] anon warn[decaps_hdlc:pptp_gre.c:209]: short read (-1): Input/output error

[pptp] anon warn[decaps_hdlc:pptp_gre.c:210]: pppd may have shutdown, see pppd log

[pptp] anon log[callmgr_main:pptp_callmgr.c:236]: Closing connection

[pptp] anon log[pptp_conn_close:pptp_ctrl.c:357]: Closing PPTP connection

[pptp] anon log[call_callback:pptp_callmgr.c:76]: Closing connection

why is that ? what to do now ?

----------

## -=Avatar=-

I solved my problem.

becouse Gentoo stage 1 is fully customizeble, you compile

your kernel by yourself, and then very important to not make a mistake,

and add PPP and PPtP support in network.

Network device support  --->  

                  <Y> PPP (point-to-point protocol) support

                  <M>   PPP support for async serial ports  (at 10.10.04)

                  <M>   PPP support for sync tty ports  (at 10.10.04)

                  <Y>   PPP Deflate compression (NEW)

                   <Y>   PPP BSD-Compress compression (NEW)

                   <Y>   PPP over Ethernet (EXPERIMENTAL)  (at 10.10.04)

Now all working. Good Luck.

----------

