socat: tunnel IP through TTY

后端 未结 2 1965
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 11:52

Is it possible to get an bidirectional IP-tunnel over ttyS0-like serial (modem) devices with the socat utility? I tried to use TUN option but still can\'t g

2条回答
  •  心在旅途
    2020-12-13 12:22

    based on what I have tried, you don't need socat to establish a tunnel. you can just do the following:

    PC1:
     1, sudo slattach -s 19200 -p slip -dL /dev/ttyUSB0
     2, sudo ifconfig sl0 10.0.0.1/24 up
     3, sudo route add default gw 10.0.0.254 sl0
    
    PC2:
     1, sudo slattach -s 19200 -p slip -dL /dev/ttyUSB0
     2, sudo ifconfig sl0 10.0.0.2/24 up
     3, sudo route add default gw 10.0.0.254 sl0
    

    After the setup, I can ping PC2 from PC1, and vice versa.

    There is another pre-condition: your Linux kernel must have slip module loaded.

提交回复
热议问题