This example is meant to show how stable and versatile the VSPDL currently is. It is not to be taken literally, for real-world use, but more as a demonstration. Test it, understand VSDL's capabilities, and go do something creative with VSPDL.
We will be setting up a VPN of sorts, using SLIP. This is particularly useful for testing VSPDL in kernel interdriver communication.
Let's say we have two PCs. PC #1 is at IP address 11.11.11.11, while PC #2 is at 22.22.22.22.
First, install and test VSPDL on both machines.
Now, let's configure PC #1's VSPDL as the TCP client. The following snippet comes from the <dev> section of the VSPDL configuration file (/usr/local/vspd/etc/vspd.conf) for PC #1:
<vsp num="0">
<bind host="" port="3500"/>
<connection rmode="client" proto="tcp" conmode="immediately" timeout="5" onthefly="disabled"/>
<destination ip="22.22.22.22" port="3501" cport="65535"/>
<packets maxlen="255" maxdelay="0" starton="any"/>
<log type="file" level="EMR" path="var/dev.0.log"/>
<log type="file" level="ALR" path="var/dev.0.log"/>
<log type="file" level="CRT" path="var/dev.0.log"/>
<log type="file" level="ERR" path="var/dev.0.log"/>
<log type="file" level="WRN" path="var/dev.0.log"/>
<log type="file" level="NTC" path="var/dev.0.log"/>
<log type="file" level="INF" path="var/dev.0.log"/>
</vsp>
Let's make PC #2's VSPDL into the TCP server. Here's what the same snippet should look like on PC #2:
<vsp num="0">
<bind host="" port="3501"/>
<connection rmode="server" proto="tcp" conmode="immediately" timeout="5" onthefly="disabled"/>
<destination ip="11.11.11.11" port="3500" cport="65535"/>
<packets maxlen="255" maxdelay="0" starton="any"/>
<log type="file" level="EMR" path="var/dev.0.log"/>
<log type="file" level="ALR" path="var/dev.0.log"/>
<log type="file" level="CRT" path="var/dev.0.log"/>
<log type="file" level="ERR" path="var/dev.0.log"/>
<log type="file" level="WRN" path="var/dev.0.log"/>
<log type="file" level="NTC" path="var/dev.0.log"/>
<log type="file" level="INF" path="var/dev.0.log"/>
</vsp>
Note: You can use server/client connection mode too, but TCP as transport is preffered
Restart the VSPDaemons on both PCs:
# service vspd restart
Open a SLIP connection on PC #1:
# /sbin/slattach -p slip -s 115200 /dev/vsps0 &
# /sbin/ifconfig sl0 10.0.0.1 pointopoint 10.0.0.2
Now a SLIP connection on PC#2:
</file>
# /sbin/slattach -p slip -s 115200 /dev/vsps0 &
# /sbin/ifconfig sl0 10.0.0.2 pointopoint 10.0.0.1
</file>
10.0.0.x is our new internal SLIP VPN IP range.
Let's check that our new interfaces are there on PC #1:
# ifconfig sl0
sl0 Link encap:Serial IP HWaddr ....
inet addr:10.0.0.1 P-t-p: 10.0.0.2 ...
And on PC #2:
# ifconfig sl0
sl0 Link encap:Serial IP HWaddr ....
inet addr:10.0.0.2 P-t-p: 10.0.0.1 ...
Now let's ping. First from PC #1:
# ping -I sl0 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.045 ms
And then from PC #2:
# ping -I sl0 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.045 ms
as you see, I'm pinging using ”-I sl0” PING option. you can add such a rule into your routing rules to use it by default for your virtual serial VPN network on both machines:
# route add -net 10.0.0.0 -mask 255.255.255.0 sl0
Tip: If something goes wrong, look at /usr/local/vspd/var/dev.0.log to see if the VSPDLs are connected to each other or not.