ラズパイをPPPサーバに見立ててアナログモデムのドリキャスでインターネットができる記事を見たので試してみた。
尚、ドリキャス以外にモデムしかない古いPCもPPPでネット接続可能である。
pomegd.hatenablog.com
ラズパイで実行する場合、USBモデムを用意したりと手間がかかる。これは、USBモデムからダイヤルトーンを流すために、ボイスモードが使えるモデムが必要なためであるが、古いFAXモデムではボイスモードは搭載されていない。
github.com
古いFAXモデムでも利用できる方法を探していたら、ダイヤルトーンを無効化できるソースがforkされていたので、そちらを利用することにした。また、dreampiのイメージではpythonのバージョンが古いため、別途Ubuntuのマシンを使うことにした。
github.com
他にモデム同士の接続に途中に給電させるためのアダプターやケーブルを作成する必要があるが、今回はひかり電話ルータの機能としてある内線通話を利用して、給電を不要とした。
「接続」 PC --- USBシリアル --- FAXモデム --- ひかり電話ルータ --- ドリキャス
dreampiやnotdreamnorpiでは、下記部分で着信を見ている。
while True: now = datetime.now() try: if mode == 'LISTENING': modem.update() char = modem._serial.read(1).strip() if not char: continue mode = 'ANSWERING' # add code if ord(char) == 16:
ドリームパスポートから内線通話をかけたときに着信側では「RING」とシリアル出力されることから、着信の検出に問題は無いもののPPP接続動作に移らないため、途中にmode = 'ANSWERING'を追記した。
着信を検出後にモード変更するので、FAXモデムでATAコマンドが実行され、PPP接続できるようになった。
$ sudo python3 dreampi.py -d notdreamnorpi https://github.com/samicrusader/notdreamnorpi Fork of Kazade's original DreamPi: https://github.com/Kazade/dreampi -- INFO:notdreamnorpi:Detecting connection and modem... INFO:notdreamnorpi:Opening serial interface to /dev/ttyUSB0 INFO:notdreamnorpi:Serial interface terminated INFO:notdreamnorpi:Modem found! DEBUG:notdreamnorpi:Finding active network interface... INFO:notdreamnorpi:Network interface found: ens9 INFO:notdreamnorpi:Network interface found: wlp3s0 DEBUG:notdreamnorpi:Finding an unused IP address... DEBUG:notdreamnorpi:Returning IP address: 192.168.123.99 DEBUG:notdreamnorpi:Returning IP address: 192.168.123.98 INFO:notdreamnorpi:Using host IP address: 192.168.123.99 INFO:notdreamnorpi:Using client IP address: 192.168.123.98 INFO:notdreamnorpi:Opening serial interface to /dev/ttyUSB0 RINGING DEBUG:notdreamnorpi:Sending ATZ0 to the modem DEBUG:notdreamnorpi:OK DEBUG:notdreamnorpi:Sending ATE0 to the modem DEBUG:notdreamnorpi:OK DEBUG:notdreamnorpi:Sending ATA to the modem DEBUG:notdreamnorpi:CONNECT 28800/LAPM-V INFO:notdreamnorpi:Call was answered. INFO:notdreamnorpi:Serial interface terminated Using interface ppp0 Connect: ppp0 <--> /dev/ttyUSB0 found interface wlp3s0 for proxy arp local IP address 192.168.123.99 remote IP address 192.168.123.98 Modem hangup Connect time 23.5 minutes. Sent 61661 bytes, received 9940 bytes. Connection terminated.