RHEL 7でvpncを使用してCisco VPNクライアント接続を確立する
Redhat 7 LinuxでCisco VPNクライアント接続を作成する最も簡単な方法は、Cisco VPNクライアントのオープンソース代替であるvpncクライアントを使用することです。まず、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トンネルインターフェースを作成します:
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)