使用 vpnc 在 RHEL 7 上建立 Cisco VPN 客户端连接
在 Redhat 7 Linux 上创建 Cisco VPN 客户端连接的最简单方法是使用 vpnc 客户端,它是 Cisco VPN 客户端的开源替代方案。让我们从 RHEL7 上的 VPNC 安装开始。 VPNC 软件包位于 EPEL(Enterprise Linux 7 的额外软件包)存储库中,因此首先启用 EPEL 存储库:
# subscription-manager repos --enable=rhel-7-server-optional-rpms
如果您当前没有 Redhat 订阅,请按照本指南了解如何在没有订阅的情况下启用 EPEL。 完成后,安装 vpnc
包:
# yum install vpnc
现在,我们已经安装了 vpnc
客户端,我们准备创建 VPN Cisco 连接:
[root@rhel7 ~]# vpnc
Enter IPSec gateway address: vpn.hostname.example
Enter IPSec ID for vpn.hostname.example: VPNClient
Enter IPSec secret for VPNClient@vpn.hostname.example:
Enter username for vpn.hostname.example: username
Enter password for username@vpn.hostname.example:
Connect Banner:
| You are now connected to the VPN System. Unauthorized usage is not permitted.
|
VPNC started in background (pid: 3707)...
以上将创建一个新的 VPN tun(n) 网络接口:
tun0: flags=4305<up,pointopoint,running,noarp,multicast> mtu 1412
inet 141.17.140.55 netmask 255.255.255.255 destination 131.217.240.35
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
</up,pointopoint,running,noarp,multicast>
或者,您可以通过创建 VPNC 配置文件以更自动的方式进行 Cisco VPN 身份验证:
[root@rhel7 ~]# cat /etc/vpnc/default.conf
IPSec gateway vpn.hostname.example
IPSec ID GROUPNAME
IPSec secret GROUPPASS
Xauth username username
Xauth password my-password
vpnc
现在将查看默认配置文件是否存在,并自动创建 Cisco VPN 连接。请注意,密码可以省略,执行 vpnc
命令后,系统会要求您提供 VPN 密码:
# vpnc
Connect Banner:
| You are now connected to the VPN System. Unauthorized usage is not permitted.
VPNC started in background (pid: 3777)...
如果您希望创建多个 VPN 连接,请随意创建多个 VPN 配置文件。之后,您可以使用 vpnc
命令启动 Cisco VPN 连接并同时提供配置文件名。例如:
[root@rhel7 vpnc]# cp default.conf cisco-vpn.conf
[root@rhel7 vpnc]# vpnc cisco-vpn
要断开与 Cisco VPN 网关的连接,请执行:
[root@rhel7 ~]# vpnc-disconnect
Terminating vpnc daemon (pid: 3777)