0

I just need to send/receive a messages through a unix-socket with PPP. But at first I want to launch the pppd with an usual serial port to make sure I know how it works. As I see, if I bind a pppd to a serial, all the packets that has come there will be unwrapped from PPP/IP/..., and redirected to some port with my application. As I understand this could be only done by creating a new network interface by the pppd. So I am need to give an IP to pppd. After reading a manuals, and getting some problems I figure out an options that seems to be right, but I still can't get it working:

$ pppd local -detach 10.5.57.198: /dev/ttyS4
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS4
LCP: timeout sending Config-Requests
Connection terminated.
Modem hangup

Before the title LCP: timeout sending Config-Requests appears I have some time, and I launched in this time ifconfig -- alas, here is no new network interface appeared.

Also I was seeked for a tutorials, but all that I found is doesn't seem to be useful, mostly because these deprecated: these often mention a configs, or soft, or sites that is not present right now. And partially because these mention many actions which doesn't seem to carry a sense for me.

So, do anybody knows, what is the options I am missing?

Hi-Angel
  • 277
  • 3
  • 9
  • What do you have running on the other end of your serial connection? – Michael Hampton Jun 20 '14 at 14:18
  • @MichaelHampton nothing yet. – Hi-Angel Jun 20 '14 at 14:21
  • PPP stands for "point-to-point protocol". You need 2 points. –  Jun 20 '14 at 14:24
  • Of course! If nothing is there, nothing can respond! – Michael Hampton Jun 20 '14 at 14:25
  • @MichaelHampton but I am not try yet ping a connection. The problem is that the pppd doesn't even try to create a network interface -- what should I ping? – Hi-Angel Jun 20 '14 at 14:27
  • You won't have an interface set up until it successfully sets up a connection. Try actually setting up a connection first. – Michael Hampton Jun 20 '14 at 14:28
  • Your project makes no sense. I can't imagine what you think is supposed to happen with a PPP link that has only one endpoint. You *can* get a computer to talk to itself over PPP by running 2 `pppd` instances on opposite ends of a pseudo-tty; I have no idea if that's anywhere near your goal. What is the problem you're trying to solve, and what made you think PPP should be involved in the solution? –  Jun 20 '14 at 14:30
  • @WumpusQ.Wumbley well, I could have i.e. some device on the other side that is down. It is not the reason for a pppd to gone down, because one time the device may appear and send the message. The idea is that I will need to accept a messages through an Unix-socket via PPP protocol. – Hi-Angel Jun 20 '14 at 14:33
  • Also, UNIX-domain sockets and PPP can't possibly interact with each other, so that part of the question also doesn't make sense –  Jun 20 '14 at 14:33
  • @WumpusQ.Wumbley so I can't somehow hack it? I found right now the `local` option, that is allow to ignore Data Carrier Detect... Probably I just need to turn off all the interaction with pins of pppd, I think pppd have enough an options for it. – Hi-Angel Jun 20 '14 at 14:37
  • @MichaelHampton well, okay... Suppose that the interface is appears only when the device on the other side sends a message. This is strange, but conceptually okay. But then why the pppd turned off after some time? It is surely needs to be up, awaiting the message. – Hi-Angel Jun 20 '14 at 14:49
  • It does have a lot of options, but you need a successful negotiation with the peer before you can do anything else. A large lcp-max-configure will make it wait longer for the connection to start. –  Jun 20 '14 at 14:49
  • @WumpusQ.Wumbley but for example the ethernet don't need to establish a connection to be up. Is there a way to force to have such a behavior the pppd? – Hi-Angel Jun 20 '14 at 14:54
  • PPP isn't ethernet. pppd was designed to be run after the physical link is established. Its primary use was always on dialup lines, where you didn't want an "always present" interface, but a "manually started by the user when he wants to use the Internet" interface. You deviate from that, you have problems. –  Jun 20 '14 at 14:57
  • actually I just remembered a relevant option: `persist` (and maybe `demand`) which some dialup users did use to keep the interface alive at all times –  Jun 20 '14 at 15:01
  • @WumpusQ.Wumbley sorry, overlooked your second comment. Thank you very much! – Hi-Angel Jun 20 '14 at 15:04

1 Answers1

0

PPP in general, and pppd specifically, were mostly used for dialup connections, so all of the defaults assume that the pppd process will be started as part of a manually-initiated sequence. The preceding step in the sequence is supposed to be establishing a serial connection (i.e. the modem indicates completion of its handshake with the remote modem by saying CONNECT)

You want to reverse the order of things, starting pppd first and making it wait for the physical connection to appear. The persist option does that.

The documentation for persist says

The maxfail option still has an effect on persistent connections.

so you might also need maxfail 0 to override that. Other related options I can see from a quick look at the man page are demand, idle, and holdoff, all of which will help you control how the in, terface behaves when the peer is not present.

And another useful one: the connect option, which is used in the dialup case to specify a program that dials the modem, might be useful to you. You could specify a connect script that just watches the serial port status and exits when a connection is present.