$ sudo apt-get install -y ppp xl2tpd socat
# Create two pseudo terminals. Use them as serial devices.
$ socat -d -d pty,raw,echo=0 pty,raw,echo=0
# Run pppd server
# ref. http://www11442uo.sakura.ne.jp/evirog/ppp-serial/
$ sudo pppd -detach debug noauth local nobsdcomp nodeflate noaccomp nopcomp novj default-asyncmap /dev/pts/2 192.168.15.3: 115200
# Run ppd client in another terminal
$ sudo pppd -detach debug noauth /dev/pts/3 115200 defaultroute noipdefault nobsdcomp nodeflate noaccomp nopcomp novj default-asyncmap 192.168.11.4:
# We can send data by IP once ppp is established.
$ ip address
...
40: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 3
link/ppp
inet 192.168.15.3 peer 192.168.11.4/32 scope global ppp0
valid_lft forever preferred_lft forever
41: ppp1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 3
link/ppp
inet 192.168.11.4 peer 192.168.15.3/32 scope global ppp1
valid_lft forever preferred_lft forever
$ ping -c 3 192.168.15.3
$ ping -c 3 192.168.11.4
$ ping -c 3 192.168.15.3
PING 192.168.15.3 (192.168.15.3) 56(84) bytes of data.
64 bytes from 192.168.15.3: icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from 192.168.15.3: icmp_seq=2 ttl=64 time=0.087 ms
64 bytes from 192.168.15.3: icmp_seq=3 ttl=64 time=0.105 ms
$ ping -c 3 192.168.11.5
PING 192.168.11.4 (192.168.11.4) 56(84) bytes of data.
64 bytes from 192.168.11.4: icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from 192.168.11.4: icmp_seq=2 ttl=64 time=0.162 ms
64 bytes from 192.168.11.4: icmp_seq=3 ttl=64 time=0.047 ms
Last active
September 24, 2019 05:30
-
-
Save tiqwab/e8b96ff9abea0224ccb835ea67756e59 to your computer and use it in GitHub Desktop.
pppd sample working on Ubuntu 18.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using channel 47 | |
| Using interface ppp0 | |
| Connect: ppp0 <--> /dev/pts/3 | |
| sent [LCP ConfReq id=0x1 <magic 0x552f41bf>] | |
| sent [LCP ConfReq id=0x1 <magic 0x552f41bf>] | |
| rcvd [LCP ConfReq id=0x1 <magic 0x82dcfce2>] | |
| sent [LCP ConfAck id=0x1 <magic 0x82dcfce2>] | |
| sent [LCP ConfReq id=0x1 <magic 0x552f41bf>] | |
| rcvd [LCP ConfAck id=0x1 <magic 0x552f41bf>] | |
| sent [LCP EchoReq id=0x0 magic=0x552f41bf] | |
| sent [IPCP ConfReq id=0x1 <addr 192.168.11.4>] | |
| rcvd [LCP EchoReq id=0x0 magic=0x82dcfce2] | |
| sent [LCP EchoRep id=0x0 magic=0x552f41bf] | |
| rcvd [IPCP ConfReq id=0x1 <addr 192.168.15.3>] | |
| sent [IPCP ConfAck id=0x1 <addr 192.168.15.3>] | |
| rcvd [LCP EchoRep id=0x0 magic=0x82dcfce2] | |
| rcvd [IPCP ConfAck id=0x1 <addr 192.168.11.4>] | |
| not replacing default route to eth0 [10.0.2.2] | |
| local IP address 192.168.11.4 | |
| remote IP address 192.168.15.3 | |
| Script /etc/ppp/ip-up started (pid 16153) | |
| Script /etc/ppp/ip-up finished (pid 16153), status = 0x0 | |
| # client terminated by Ctrl-C | |
| Terminating on signal 2 | |
| Connect time 0.2 minutes. | |
| Sent 0 bytes, received 0 bytes. | |
| Script /etc/ppp/ip-down started (pid 16161) | |
| sent [LCP TermReq id=0x2 "User request"] | |
| rcvd [LCP TermAck id=0x2] | |
| Connection terminated. | |
| Script /etc/ppp/ip-down finished (pid 16161), status = 0x0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using channel 48 | |
| Using interface ppp1 | |
| Connect: ppp1 <--> /dev/pts/2 | |
| sent [LCP ConfReq id=0x1 <magic 0x82dcfce2>] | |
| rcvd [LCP ConfAck id=0x1 <magic 0x82dcfce2>] | |
| rcvd [LCP ConfReq id=0x1 <magic 0x552f41bf>] | |
| sent [LCP ConfAck id=0x1 <magic 0x552f41bf>] | |
| sent [LCP EchoReq id=0x0 magic=0x82dcfce2] | |
| sent [IPCP ConfReq id=0x1 <addr 192.168.15.3>] | |
| rcvd [LCP EchoReq id=0x0 magic=0x552f41bf] | |
| sent [LCP EchoRep id=0x0 magic=0x82dcfce2] | |
| rcvd [LCP EchoRep id=0x0 magic=0x552f41bf] | |
| rcvd [IPCP ConfReq id=0x1 <addr 192.168.11.4>] | |
| sent [IPCP ConfAck id=0x1 <addr 192.168.11.4>] | |
| rcvd [IPCP ConfAck id=0x1 <addr 192.168.15.3>] | |
| local IP address 192.168.15.3 | |
| remote IP address 192.168.11.4 | |
| Script /etc/ppp/ip-up started (pid 16155) | |
| Script /etc/ppp/ip-up finished (pid 16155), status = 0x0 | |
| # client terminated | |
| rcvd [LCP TermReq id=0x2 "User request"] | |
| LCP terminated by peer (User request) | |
| Connect time 0.2 minutes. | |
| Sent 0 bytes, received 0 bytes. | |
| Script /etc/ppp/ip-down started (pid 16162) | |
| sent [LCP TermAck id=0x2] | |
| Script /etc/ppp/ip-down finished (pid 16162), status = 0x0 | |
| Connection terminated. | |
| Modem hangup |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding
-xoption to socat is helpful to debug.This shows a data stream.