Haha, I work, but there must be some kind of magic :)
So, configure the 1st partner with:
PC1: 1) slattach -L -s 57600 -p slip /dev/ttyUSB0 & 2) ifconfig sl0 up 3) socat TUN:192.168.1.1/24,up INTERFACE:sl0 &
... and something similar on the second level:
PC2: 1) slattach -L -s 57600 -p slip /dev/ttyUSB0 & 2) ifconfig sl0 up 3) socat TUN:192.168.1.2/24,up INTERFACE:sl0 &
And now you can successfully ping one computer from another:
PC1: 1) ping -c 5 192.168.1.2 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. 64 bytes from 192.168.1.2: icmp_req=1 ttl=64 time=348 ms 64 bytes from 192.168.1.2: icmp_req=2 ttl=64 time=551 ms 64 bytes from 192.168.1.2: icmp_req=3 ttl=64 time=557 ms 64 bytes from 192.168.1.2: icmp_req=4 ttl=64 time=549 ms 64 bytes from 192.168.1.2: icmp_req=5 ttl=64 time=348 ms --- 192.168.1.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4003ms rtt min/avg/max/mdev = 348.116/471.143/557.128/100.177 ms
This is a bit complicated due to the use of slattach , but in fact, any other solution should use something like slip to organize cropping on a serial line. For example, PPP uses HDLC-like frames.
source share