PPP server using a port for connection - PPP
This is a discussion on PPP server using a port for connection - PPP ; Hi guys,
I have a problem a I don't know how to solve it. Maybe you can help me.
I have using ppp in a SunOne SO machine.
We are using a machine (server1) as ppp client and server that ...
-
PPP server using a port for connection
Hi guys,
I have a problem a I don't know how to solve it. Maybe you can help me.
I have using ppp in a SunOne SO machine.
We are using a machine (server1) as ppp client and server that uses an
external RAS machine in order to get modems. So, to get a modem,
server1 has to open a socket connection to the RAS machine. For this I
am using the socket ppp option.
This works, so after opening the socket connection, ppp is launched
correctly.
The problem is when I want to use server1 as a PPP server. When someone
call the specific RAS telephone number, RAS opens a socket connection
to server1 in port 9000. So I need to configure server1 to detect that
incoming call and start pppd.
I think I cannot user getty or mgetty in order to detect the incoming
calls, because that software is related to modem devices. Maybe they
can be configured to listen a port instead of listening a modem device.
In addition to that, I have been reading about the Service Access
Facility (listen process), but maybe this is a nonsense.
Any help?
Thanks!
-
Re: PPP server using a port for connection
mariano.garcia@gmail.com writes:
> The problem is when I want to use server1 as a PPP server. When someone
> call the specific RAS telephone number, RAS opens a socket connection
> to server1 in port 9000. So I need to configure server1 to detect that
> incoming call and start pppd.
Not just that, but you need to have a tty.
I think that if you set up pppd in /etc/inetd.conf as a TCP service on
port 9000, and gave it the "notty" option (forcing pppd to allocate a
pseudo-terminal), this would probably work.
> I think I cannot user getty or mgetty in order to detect the incoming
> calls, because that software is related to modem devices. Maybe they
> can be configured to listen a port instead of listening a modem device.
> In addition to that, I have been reading about the Service Access
> Facility (listen process), but maybe this is a nonsense.
Most modern RASes will automatically handle modems and run PPP for
you, behaving as a router.
Why not just configure the RAS to do the work, rather than tunneling
PPP over TCP?
--
James Carlson, KISS Network
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
-
Re: PPP server using a port for connection
Sorry for the delay.
I cannot use the RAS in order to run PPP. In the server side we have to
use a special 'communications stack' in order to handle all the
conections, so it is a prerequisite in my system to run PPP in the
server side, not in RAS.
I have trying to use inetd to listen a port in order to detect an
incoming call. But I don't understand very well how ppp will work
later. I mean, when RAS opens a socket to the server side (because a
client wants to connect), inetd detects the incoming call and runs the
script configured in inetd.conf. So... how does pppd know where is the
port it must connect?
These are all the steps:
1. A client wants to call, so it runs pppd using a socket option to
RAS:
pppd socket ras_ip
ort -detach lock crtscts mtu 296 mru 296
connect 'chat -v -f chat-options' user my_user 192.168.0.6:192.168.0.7
2. RAS detects someone wants a modem, so it look for one.
3. When RAS finds an available modem, he opens a socket connection to
the server to port, for example, 9090.
4. In the server side, inetd detects an incoming connection to port
9090, so it runs its script:
pppd stream tcp nowait root /usr/bin/pppd notty
-detach silent crtscts logfile /tmp/ppp.log
5. PPP is executed... but where is it linking? I mean, how can I
execute pppd in order to link with the client side? PPP must use the
port 9090 to communicate with the client side... so only one connection
can be available at the same time?
I hope you to understand all the stuff
, maybe my instructions are
not very clear.
Regards,
Mariano.
-
Re: PPP server using a port for connection
"KiKo" writes:
> I have trying to use inetd to listen a port in order to detect an
> incoming call. But I don't understand very well how ppp will work
> later. I mean, when RAS opens a socket to the server side (because a
> client wants to connect), inetd detects the incoming call and runs the
> script configured in inetd.conf. So... how does pppd know where is the
> port it must connect?
It doesn't and can't.
Inetd works by (among other things) opening TCP "listen" ports, and
then doing accept() for incoming connections. When it execs something
listed in inetd.conf, stdin/stdout/stderr are connected to that
accepted socket.
In other words, you're already connected and you don't need to "know"
where to connect.
The only thing you need is a place to run pppd. Pppd assumes by
default that it's running over a tty, not a socket. To make it start
up a pty for that purpose (along with a shunt to connect to the
existing socket from inetd), use the "notty" option that I mentioned
in my last posting.
> 3. When RAS finds an available modem, he opens a socket connection to
> the server to port, for example, 9090.
Good up to here.
> 4. In the server side, inetd detects an incoming connection to port
> 9090, so it runs its script:
> pppd stream tcp nowait root /usr/bin/pppd notty
> -detach silent crtscts logfile /tmp/ppp.log
You don't want crtscts -- there's no modem here to control.
I'm not sure why you have "silent" configured here. It's almost
certainly incorrect.
> 5. PPP is executed... but where is it linking? I mean, how can I
> execute pppd in order to link with the client side? PPP must use the
> port 9090 to communicate with the client side... so only one connection
> can be available at the same time?
I don't understand that question.
Once the RAS makes a TCP connection to the server, you've got a
connection. Why do you feel that PPP "must use the port 9090?"
--
James Carlson, KISS Network
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
-
Re: PPP server using a port for connection
>> 4. In the server side, inetd detects an incoming connection to port
>> 9090, so it runs its script:
>> pppd stream tcp nowait root /usr/bin/pppd notty
>> -detach silent crtscts logfile /tmp/ppp.log
>You don't want crtscts -- there's no modem here to control.
>
>I'm not sure why you have "silent" configured here. It's almost
>certainly incorrect.
Yep. They were the default options I found in a HOWTO configure a
dial-up server. I need to check all the options.
About the port 9090, it was a misunderstanding. I forgot that a server
runs a child in other port (not in the listing port). Forget the
question 
Now i have other problem. Now I can call from a machine to other, using
a RAS as the same way I explained before. But I think I am using some
wrong options. When I try to connect to the server side, I get and LCP
error:
LCP: timeout sending Config-Requests
In a first step, I am trying to connect using 'noauth' option both
server ans client side (later I will try to connect usgin pap auth).
This is the error log I get in client side:
# pppd socket cisco2:5014 -detach connect 'chat -v -f
/IBERCOM/usr/mgg327/ppp/chat-options' noauth
Serial connection established.
Using interface sppp0
Connect: sppp0 <--> /dev/pts/28
LCP: timeout sending Config-Requests
Connection terminated.
select
And in server side:
Using interface sppp0
Connect: sppp0 <--> /dev/pts/2
LCP: timeout sending Config-Requests
Connection terminated.
So, PPP fails in stablishment phase. What can be the reason?
Thanks a lot!
-
Re: PPP server using a port for connection
Hi again,
This is the log messages using the 'debug' option:
#Client side:
# pppd debug socket cisco2:5014 -detach connect 'chat -v -f
/IBERCOM/usr/mgg327/ppp/chat-options' noauth
Using /dev/pts/26; master fd 6, slave fd 7
pty speed set to 9600 bps
starting charshunt for socket option
connect option: 'chat -v -f /IBERCOM/usr/mgg327/ppp/chat-options'
started (pid 16896)
Serial connection established.
Using interface sppp0
Connect: sppp0 <--> /dev/pts/26
/etc/ppp/chap-secrets is apparently empty
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
sent [LCP ConfReq id=0x40
]
LCP: timeout sending Config-Requests
Connection terminated.
Waiting for 1 child processes...
pid 16895: pppd (charshunt)
select
Child process pppd (charshunt) finished (pid 16895), status = 1
# Server Side
Using interface sppp0
Connect: sppp0 <--> /dev/pts/2
LCP: timeout sending Config-Requests
Connection terminated.
It seems that client are sending LCP packets and no response is
provided from server side. :\
-
Re: PPP server using a port for connection
"KiKo" writes:
> Now i have other problem. Now I can call from a machine to other, using
> a RAS as the same way I explained before. But I think I am using some
> wrong options. When I try to connect to the server side, I get and LCP
> error:
>
> LCP: timeout sending Config-Requests
Stop there. This isn't a PPP configuration problem. That message
generally means that pppd has not heard _anything_ from the peer. In
your case, the debug logs you posted confirm it: there's no connection
between these peers.
That's a low-level communications problem. That needs to be fixed
first. PPP can't negotiate at all if bits aren't moving between the
peers.
> So, PPP fails in stablishment phase. What can be the reason?
Any of several things. Here are a couple:
- If that Cisco device is expecting standard TELNET protocol rather
than raw TCP, then the data will be corrupted over the connection.
Try using "escape ff asyncmap 00002400" on both ends to see if
that helps.
(If that "cisco2" is actually an Annex terminal server -- a
5000-range port number makes me think it is -- then this is the
problem. Use a 7000-range port instead.)
- If the serial link between the two machines is misconfigured or
broken, you'd get similar symptoms.
The bottom line is that PPP _requires_ an 8-bit end-to-end connection
between the peers. This message means you don't have that.
--
James Carlson, KISS Network
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
-
Re: PPP server using a port for connection
Great! It works.
I solve the problem adding the asyncmap and escape options.
Thank you very much, James 
-
Re: PPP server using a port for connection
Hi again,
Now I am in the final step of my work... and I don't know what is the
best way to do it. For arquitecture requirements in the system, a
program has to initialize the line. I mean, an external program (no
pppd) has to connect to RAS in order to get a modem (because the
arquitecture of the system needs to know stadistics about modems). I
was using pppd to launch the socket to the RAS in my last tests.
So... I cannot use the 'socket' option in pppd in order to get a modem
and my problem is to know the best way to 'link' pppd with the socket
that has been created for that external program.
I have thought some solutions:
1. The program that initializes the line (I mean, the program that
opens a socket to RAS in order to get a modem) binds a port. PPPd could
connect to that port in order to bring up the ppp link.
2. The same as the last point, but using a FIFO or a UNIX socket. I am
not sure about this approach. Can pppd link to a special file as a FIFO
or unic socket?
Maybe I am thinking very complex solutions... but i don't know how to
do that!
-
Re: PPP server using a port for connection
"KiKo" writes:
> Now I am in the final step of my work... and I don't know what is the
> best way to do it. For arquitecture requirements in the system, a
> program has to initialize the line. I mean, an external program (no
> pppd) has to connect to RAS in order to get a modem (because the
> arquitecture of the system needs to know stadistics about modems). I
> was using pppd to launch the socket to the RAS in my last tests.
>
> So... I cannot use the 'socket' option in pppd in order to get a modem
> and my problem is to know the best way to 'link' pppd with the socket
> that has been created for that external program.
Why can't you use either the 'init' or 'connect' scripts in pppd?
If you can't, then I think the right thing to do would be to write an
external script (in some suitable scripting language, such as Perl)
that opens the connection, does the modem chatting, and then execs
pppd with stdin connected to the socket and the "notty" option
(removing the "socket" option).
But be very careful here. All indications so far are that you're
(mis)using the TELNET protocol ports on this RAS device. If you're
not actually speaking TELNET protocol (including the option
negotiation and IAC-escaping and NVT-handling), then you're likely
setting yourself up for failure.
It'd be wise to find out if that RAS device has a raw TCP option you
can use.
> I have thought some solutions:
>
> 1. The program that initializes the line (I mean, the program that
> opens a socket to RAS in order to get a modem) binds a port. PPPd could
> connect to that port in order to bring up the ppp link.
That's another way. It'd be kludgier still, but the current system
you're describing is a bit ugly anyway.
> 2. The same as the last point, but using a FIFO or a UNIX socket. I am
> not sure about this approach. Can pppd link to a special file as a FIFO
> or unic socket?
Yes, but it'll need the same trick as above -- "notty" to force pppd
to use a pty pair. Async PPP must run over a tty, and nothing else.
> Maybe I am thinking very complex solutions... but i don't know how to
> do that!
Indeed, I think you are. Just running PPP on the RAS device and
getting a RAS vendor that provides the monitoring and control
information you need would be a much easier to support solution. It
seems like you're trying to beat the wrong solution into submission.
--
James Carlson, KISS Network
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677