Linux下的主要VPN技术--3
3.使用CIPE网络接口VPN服务器
在客户机进行连接测试,首先使用命令察看网络接口:
# ifconfig -
cipcb0 Link encap:IPIP Tunnel HWaddr
inet addr:10.0.0.2 P-t-P:10.0.0.1 Mask:255.255.255.255
POINTOPOINT NOTRAILERS RUNNING NOARP MTU:1442 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
此时客户机的cipcb0没有激活,使用命令激活cipcb0,然后察看路由表:
#ifup cipcb0
#route
Kernel IP routing table
Destin
ati
on
Gateway
Genmask Flags Metric
Ref Use Iface
10.0.0.1
*
255.255.255.255 UH 0
0 0 cipcb0
192.168.1.0
*
255.255.255.0 U
0
0 0 eth0
127.0.0.0
*
255.0.0.0 U
0
0 0 lo
default
192.168.1.1
0.0.0.0
UG 0
0 0 eth0
可以看到VPN端口已经打开,路由表中包括CIPE服务器的远程虚拟地址。下面使用ping命令连接CIPE服务器的虚拟地址(10.0.0.1)进行测试。
#ping -c 4 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.681 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.341 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.080 ms
64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.094 ms
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3013ms
rtt min/avg/max/mdev = 0.080/0.299/0.681/0.243 ms
VPN连接完成。下面断开VPN连接,使用命令:“ifdown cipcb0”然后察看路由表:
#ifdown cipcb0
#route
Kernel IP routing table
Destination
Gateway
Genmask Flags Metric
Ref Use Iface
192.168.0.0
*
255.255.255.0 U
0
0 0 eth0
127.0.0.0
*
255.0.0.0 U
0
0 0 lo
录由表的10.0.0.1已经清除。
(责任编辑:阿里猫)- 最新评论
