LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-12-2002, 05:57 PM   #1
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Rep: Reputation: 15
Automate PPPD


Hi
I have setup a dial up connection to my ISP and all the associated DNS etc. I used the Network Configuration Tool under Red Hat 7.3 to get everything working with the ppp daemon and all is well apart from one thing.

If I start the ppp with a script /etc/sysconfig/network-scripts/ifup ppp0 (logged on as a simple user and putting the process into the background) everything is fine BUT if I use the Network Configuration Tool (for which I have to give the root password) the tool locks up although the pppd starts (I checked the log and used the connection).

This won't be a problem but when I set PPP to start on boot as well as on demand, so that it will always be there when the box starts, the box stopped during the boot sequence saying - starting the PPP daemon - the same behaviour as the Configuration Tool. (I got back into the box by booting to level 1 and using vi to change the setting on ppp0 back.)

I want the damon to start but stay in the background until need - anyone got any ideas?

Thanks

Ash
 
Old 10-12-2002, 09:03 PM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
something is setup wrong most likely in the config file.

It should bootup and not connect, then if you look at ifconfig it shows an interface on ppp0 but it will not be connected. When traffic is sent to the interface it dials and reconfigures the interface.
 
Old 10-13-2002, 09:20 AM   #3
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
Hi
Thanks for that - do you mean the config file for PPP0?

Thanks

ash
 
Old 10-13-2002, 02:03 PM   #4
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
yes,

if you use a file like options.demand you would use this command

pppd file /etc/ppp/options.demand


the file options.demand will be like your options file but contain demand and the ip address

like this

demand
0.0.0.0:10.10.10.10
connect "/usr/sbin/chat -v -f /etc/ppp/yourconnectscript"

or your connection script could be in your home folder

then use connect "/usr/sbin/chat -v -f ~/.myisp1

or whatever

the script has the phone number to dial and other parameters

see man pppd

man chat for more options


what this will do is create the ppp0 interface but not do the connect untill there is traffic on the ppp0 interface

as soon as you get traffic on the interface it will run the script
 
Old 10-14-2002, 02:09 AM   #5
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
Hi
ok - I will try that out. I won't be able to get to the box for a few days but I will let you know how I get on. I have seen the options file.

BTW: I did manage to make everything connect - its just the boot sequence and starting from Control Panel. Would the above not setup still allow connection via the ifup?

Thanks again
Ash
 
Old 10-14-2002, 10:40 AM   #6
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
it should if you just modify the /etc/ppp/options file. It will use that file by default
 
Old 10-20-2002, 10:55 AM   #7
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
Hi
Ok - I did some more digging and have found that

1) Although there are scripts in /etc/ppp including the options file (which is configured) they are not being used.

2) When I run as root services network restart the ppp information is all coming from the folder /etc/sysconfig/network-scripts. In the folder there is the command ifup which is being called by the init.d network scripts to start the interface ppp0 at boot time.

In the network scripts directory we have a file ifcfg-ppp0 which has the details of the connection to make including the WVDIAL section that is to be used. There is a section in there for PPPOPTIONS this has the word demand and the dummy ip addresses along with the commands to allow override when connection occurs.

Did I tell you I am using red hat 7.3?

When as root I restart the network service and the ifcfg-ppp0 file has the line ONBOOT='yes' everything is fine until the daemon starts ppp - at which point it waits until there is data actually going across the link before the script for the daemon carries on. I need it to start ifup in the background NOT wait. This error is what has been stopping the boot - its waiting for data on the link before proceeding but I can't do that until it finished the boot and I start KDE and open Konquorer.

I need the services network restart to complete without data moving across the link. This will give me confidence that the boot will work too.

I am puzzled as to why its not using the ppp-o* scripts in /etc/ppp (I configured them but its taking no notice)

Can anyone help here?

Thanks

Ash
 
Old 10-20-2002, 06:51 PM   #8
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
I think it would be best to put ONBOOT=no in the ifcfg-ppp0 file and use pppd from another script. that way you can specify the files to use or simply use a single command to start pppd.

Last edited by DavidPhillips; 10-20-2002 at 06:53 PM.
 
Old 10-20-2002, 06:59 PM   #9
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
the main reason I say this is because they are using wvdial

wvdial is not configurable. It just connects using the scripts it has. whereas pppd is still used in the end. why not just use pppd and chat directly and you can have it us files like ~/pppoptions which would be in a users home folder and they could put the phone number they need in it.
 
Old 10-21-2002, 01:49 AM   #10
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
Hi
Sounds good - which script is recommended. I need something that will run as the box comes up.

Ash
 
Old 10-22-2002, 05:58 PM   #11
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
add this command to /etc/rc.d/rc.local

/usr/sbin/pppd file /etc/ppp/options.demand

and setup the interface for ONBOOT=no in ifcfg-ppp0

Last edited by DavidPhillips; 10-22-2002 at 06:01 PM.
 
Old 10-22-2002, 06:30 PM   #12
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
What I found with my connections was that pppd never sent anything back to say it had completed it's task,
at least until the first successful connection.
Having it in the boot sequence meant everything hung waiting for it to provide an exit code, which never came.
I had the same experience with rc.local...

Now I just call it from cron every 8 mins and test for a pid. If no pid, then start, if a pid exists, kill the script.
I found several examples of that script inside the rc.d files.

Another observation,
the first packet that starts the connection never gets a connection.
It takes a 2nd attempt to be routed correctly.
pppd adds a dummy ip number to the routing table, which is replaced by a correct dhcp allocation after the dialling has completed.
Subsequent packets are correctly routed then.

Do you get this behaviour too?

Regards,
Peter

Last edited by peter_robb; 10-22-2002 at 06:32 PM.
 
Old 10-27-2002, 07:13 AM   #13
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
I just open a browser and it connects

The first packet would goto the dummy so I guess it gets lost. Not sure if it's supposed to resend it. I doubt it since it is starting the connect script and was routed to a dummy ip.


so did you get it to work yet?

I am going to go ahead and post some files I have


root@micro:~# cat /etc/ppp/options.demand
# General configuration options for PPPD:
lock
defaultroute
noipdefault
modem
/dev/ttyS2
230400
crtscts
# Uncomment the line below for more verbose error reporting:
#debug
# If you have a default route already, pppd may require the other side
# to authenticate itself, which most ISPs will not do. To work around this,
# uncomment the line below. Note that this may have negative side effects
# on system security if you allow PPP dialins. See the docs in /usr/doc/ppp*
# for more information.
#noauth
passive
asyncmap 0
name "dphillips"
ipcp-accept-local
ipcp-accept-remote
0.0.0.0:10.10.10.10
demand
connect "/usr/sbin/chat -v -f /etc/ppp/pppscript"



root@micro:~# cat /etc/ppp/pppscript
TIMEOUT 60
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
"" "AT&FH0"
OK "atdt9,7772000"
TIMEOUT 75
CONNECT

and I have the pap-secrets file with the user and password

that's all I need for it to work


pppd file /etc/ppp/options.demand
 
Old 10-27-2002, 08:12 AM   #14
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
Hi
I have been away for a couple of days but the behaviour is exactly as you describe - it connects ok second attemp. I will check out the files and come back to you. (But I only get to work on this weekends!)

Thanks for all the help - its appreciated

ash
 
Old 10-27-2002, 09:29 AM   #15
ashleyfrazer
LQ Newbie
 
Registered: Feb 2001
Location: London
Distribution: Red Hat Linux 9.0
Posts: 23

Original Poster
Rep: Reputation: 15
It works! This message is sent using the technique described by David Phillips. I am off to see if I can get the box to bring the interface up to ready a boot time. How do I set the time out of the connection - ie if not used for so long then put the phone down?

Thanks a lot. I have been searching for this info for a long time - could it/is it part of an FAQ somewhere?

Ash
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pppd timeout before pppd interface could start! bioagentice Linux - Software 6 03-27-2005 11:24 AM
automate disconnection of pppd after eftching mails leeno_jos Linux - Networking 0 09-26-2004 12:28 PM
How would I automate this? onewhoknows Linux - Newbie 5 06-22-2004 04:49 AM
pppd died: pppd options error (exit code 2 taveirac Linux - Networking 1 02-12-2004 10:17 AM
pppd died: pppd options error (exit code 2) ianwest Linux - Newbie 2 07-31-2002 08:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration