My objective is to use pppd over socat. I have two Ubuntu boxes with eth0 connected (physically) to each other. I can ping both the IP addresses. I do the below on each Ubuntu box.
- Create a pseudo serial device and link it to my network interface "eth0".
socat PTY,link=/dev/ttyp10 INTERFACE:eth0 - Use pppd on this pseudo serial device.
Device A:
pppd noauth /dev/ttyp10 10.10.10.10:20.20.20.20
Device B:
pppd noauth /dev/ttyp10 20.20.20.20:10.10.10.10
I see that my ppp0 interface gets created for a short time but I cannot ping both the IP addresses (10.10.10.10 or 20.20.20.20). I know my solution is not complete as I need to specify how my pppd packets must be routed from my eth0 interface but not sure how to do it (I used tcpdump on eth0 interface and found some data).
I tried the same experiment by binding socat to a TCP server/client and it worked.
Device A:
1. socat pty,link=/dev/ttyp10,raw,echo=0 TCP4-LISTEN:7001,reuseaddr &
2. pppd noauth /dev/ttyp10 10.10.10.10:20.20.20.20
Device B:
1. socat pty,link=/dev/ttyp10,raw,echo=0,waitslave TCP4:20.1.1.2:7001 &
2. pppd noauth /dev/ttyp10 20.20.20.20:10.10.10.10
Note: 20.1.1.2 is the "eth0" IP address of Device A. With this my ppp0 interface is up and I can ping both IP addresses (10.10.10.10 and 20.20.20.20).
Why I need to use the pseudo serial device when I have a working eth0 interface is a different question and lets not discuss that.