Клиент openvpn «client1»
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.100.1.76 0.0.0.0 UG 0 0 0 eth0
10.100.1.0 * 255.255.255.0 U 0 0 0 eth0
172.16.2.0 172.16.2.25 255.255.255.0 UG 0 0 0 tun0
172.16.2.25 * 255.255.255.255 UH 0 0 0 tun0
192.168.206.0 172.16.2.25 255.255.255.0 UG 0 0 0 tun0
# ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:172.16.2.26 P-t-P:172.16.2.25 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:596089 errors:0 dropped:0 overruns:0 frame:0
TX packets:580642 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:35830402 (34.1 MiB) TX bytes:35781491 (34.1 MiB)
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0c:29:38:72:19
inet addr:10.100.1.155 Bcast:10.100.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe38:7219/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1572564 errors:0 dropped:0 overruns:0 frame:0
TX packets:1284036 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:271819430 (259.2 MiB) TX bytes:181130183 (172.7 MiB)
Сервер openvpn
# ip route show 172.16.2.0/24
172.16.2.0/24 via 172.16.2.2 dev tun0
# route |grep tun0
172.16.2.0 172.16.2.2 255.255.255.0 UG 0 0 0 tun0
172.16.2.2 * 255.255.255.255 UH 0 0 0 tun0
# ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:172.16.2.1 P-t-P:172.16.2.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:672952 errors:0 dropped:0 overruns:0 frame:0
TX packets:703461 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:48170858 (45.9 MiB) TX bytes:147165297 (140.3 MiB)
# netcat localhost 6001
>INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info
status
OpenVPN CLIENT LIST
Updated,Sat Apr 19 18:46:34 2014
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
client1,93.158.134.3:1194,58418874,60094455,Thu Apr 17 15:04:54 2014
client2,173.194.32.183:1604,492638,773679,Sat Apr 19 17:04:16 2014
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
172.16.2.10,client2,173.194.32.183:1604,Sat Apr 19 18:46:34 2014
172.16.2.26,client1,93.158.134.3:1194,Sat Apr 19 18:46:34 2014
GLOBAL STATS
Max bcast/mcast queue length,1
END
# ping 172.16.2.26
PING 172.16.2.26 (172.16.2.26) 56(84) bytes of data.
64 bytes from 172.16.2.26: icmp_req=1 ttl=64 time=10.6 ms
64 bytes from 172.16.2.26: icmp_req=2 ttl=64 time=10.6 ms
...
Задача
# ping 10.100.1.155
PING 10.100.1.155 (10.100.1.155) 56(84) bytes of data.
^C