Setting up a PPP server to share an internet connection via serial port from Ubuntu to Windows
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Setting up a PPP server to share an internet connection via serial port from Ubuntu to Windows
Hello,
I want to share my internet connection in Ubuntu computer to a Windows PC via a serial port using only a null-modem cable (no modems). In my Ubuntu computer I'm using mgetty to set up a PPP server and I have enabled an option direct y in mgetty.conf file for mgetty to answer calls from serial port, but when I try to set up a dial-up connection from Windows mgetty is not responding at all. I can send and receive data between both computers using serial terminal such as Cutecom, but can't get response from mgetty. It's already been more than a week since I've been trying to set a PPP server , but with no success. Can anyone tell me what can be wrong with my config files or is there anything else that I am missing? Here are my config files:
mgetty.config
Code:
issue-file /etc/issue.mgetty
debug 5
port ttyUSB0
init-chat "" ATZ OK ATQ0E1 OK ATS0=0
direct y
data-only y
toggle-dtr n
local
lock
nocrtscts
192.168.1.254:192.168.1.10
netmask 255.255.255.0
noauth
debug
/etc/ppp/pap-secrets
Code:
# Every regular user can use PPP and has to use passwords from /etc/passwd
* * "" *
# Secrets for authentication using PAP
# client server secret IP addresses
* * "" *
/etc/ppp/chap-secrets
Code:
# Secrets for authentication using CHAP
# client server secret IP addresses
* * * *
Since the innittab file is gone, I setup mgetty as a service with systemd.
create a service in /lib/systemd/system/mgetty.service
I'm not familiar with using mgetty at all, but I note that it is designed to communicate with modem devices...
Quote:
mgetty is a modem-aware getty. It supports modems with the Hayes AT command set and is especially designed for supporting modems that are used to send faxes and to dial out as well as dial in. These features are not required for a serial console.
If you have a direct serial line between two unix machines, or a unix machine and something else, and want to run a getty program on the unix side that should not interfere with outgoing traffic (e.g.: two unix machines, both sides running gettys, both sides able to initiate an uucp connection), you can also use mgetty. Start it with the `-r' flag (as with uugetty), and it will not try to initialize the modem or wait for RINGs. It will just sit silently on the port and wait...
Thank you for your quick response ferrari.
systemctl status mgetty gives:
Code:
● mgetty.service - Direct serial cable
Loaded: loaded (/lib/systemd/system/mgetty.service; enabled; vendor preset: e
Active: active (running) since Kt 2017-08-31 09:52:27 EEST; 59min ago
Docs: man:mgetty(8)
Main PID: 743 (mgetty)
CGroup: /system.slice/mgetty.service
└─743 /sbin/mgetty -x0 -s 115200 /dev/ttyUSB0
Rgp 31 09:52:27 mantas-Dimension-C521 systemd[1]: Started Direct serial cable.
lines 1-9/9 (END)
and journalctl -fu mgetty gives:
Code:
-- Logs begin at Kt 2017-08-31 09:52:10 EEST. --
Rgp 31 09:52:27 mantas-Dimension-C521 systemd[1]: Started Direct serial cable.
when I try to make a connection no response is captured here.
You must be right that mgetty is expecting for another type of AT commands that only a modem can generate, but isn't there a way for windows to pretend being a modem (to send Hayes AT commands)? I can't find a way I could somehow insert `-r' flag when dialing-up from windows, but I tried different modem models in Dial-up connection properties as well as "Communications cable between two computers" option, but nothing seems to help.
You must be right that mgetty is expecting for another type of AT commands that only a modem can generate, but isn't there a way for windows to pretend being a modem (to send Hayes AT commands)? I can't find a way I could somehow insert `-r' flag when dialing-up from windows, but I tried different modem models in Dial-up connection properties as well as "Communications cable between two computers" option, but nothing seems to help.
I'll be a little more explicit. Why don't you modify the service unit, so that mgetty is started with the -r option?
When I run systemctl status mgetty now I see that it uses -r option when starting mgetty
Code:
● mgetty.service - Direct serial cable
Loaded: loaded (/lib/systemd/system/mgetty.service; enabled; vendor preset: e
Active: active (running) since Kt 2017-08-31 13:24:46 EEST; 15min ago
Docs: man:mgetty(8)
Main PID: 773 (mgetty)
CGroup: /system.slice/mgetty.service
└─773 /sbin/mgetty -r -x0 -s 115200 /dev/ttyUSB0
Rgp 31 13:24:46 mantas-Dimension-C521 systemd[1]: Started Direct serial cable.
lines 1-9/9 (END)
But still nothing happens when I try to make a connection
Code:
mantas@mantas-Dimension-C521:~$ journalctl -fu mgetty
-- Logs begin at Kt 2017-08-31 13:24:28 EEST. --
Rgp 31 13:24:46 mantas-Dimension-C521 systemd[1]: Started Direct serial cable.
With my (very) limited knowledge on the inner workings of this, I think I've gleamed that mgetty is listening on the line for modem-type behaviour. This means it is listening for the 'RING' message, then it will respond with ATA (answering an incoming call), then it expects to hear 'CONNECT'. Following that, it starts the process defined in login.config ie PPP (as per the config you posted). So the client program needs to initiate like that. The question is: Can Cutecom behave like that?
Cancel that. The above related to standard mgetty behaviour, and the -r option should inhibit that, but I'm not clear on what is required to intiate the connection and start the pppd process. That got me thinking about whether the mgetty layer is really required here?
Here's a link to a page describing how to connect a Linux and Windows machine via a serial cable which has pppd listening to a serial port, and a 'direct cable connection' on the Windows machine...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.