-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathppptun.py
30 lines (24 loc) · 818 Bytes
/
ppptun.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# micropython ESP32
# PPP tunnel
# stty -F /dev/ttySL0 raw
# pppd /dev/ttySL0 115200 10.0.5.2:10.0.5.1 noauth local debug dump nodefaultroute nocrtscts nodetach
# AUTHOR=EMARD
# LICENSE=BSD
from machine import UART
from network import PPP
class ppptun:
def __init__(self):
print("PPP tunnel")
self.uart = UART(2) # 16:RX 17:TX
# on Linux:
# output wire wifi_gpio16, // RX input on ESP32
# input wire wifi_gpio17, // TX output on ESP32
self.uart.init(baudrate=230400, bits=8, parity=None, stop=1)
self.ppp = PPP(self.uart)
#self.ppp.ifconfig(('192.168.48.4', '255.255.255.0', '192.168.48.254', '8.8.8.8')) # not needed
self.ppp.active(True)
self.ppp.connect()
print("usage:")
print("p=ppptun.ppptun()")
print("... PPP traffic at RX=GPIO16, TX=GPIO17")
print("del p")