layout: post
title: Linux连接juniper vpn
date: 2018-11-16
tags: [“Linux Ubuntu &->Mint 18.3”]


连接cisco的juniper vpn可参见archwiki 有N种方法,(排除openconnect,这种方式不太好用)以下为其中的一种方式

一、vpn所需文件

  1. junipernc
  2. ncLinuxApp.jar
  1. junipernc是一个脚本文件,可以在本页的附件下载也可以在网站上下载 (http://mad-scientist.net/junipernc)
  2. ncLinuxApp.jar包在vpn服务器上获取,注意需要用IE浏览器先连接该网站并登录,再粘贴该地址获取该jar包)

二、安装依赖包

基于ubuntu的发行版
  1. sudo apt-get install libc6:i386 zlib1g:i386 libgtk2-perl libwww-perl
基于rhel的发行版
  1. yum install -y perl-Gtk2 perl-libwww-perl
  2. yum install glibc.i686 zlib.i686 #安装失败 使用 yum install(update) --setopt=protected_multilib=false glibc.i686 zlib.i686
junipernc是一个脚本文件,执行需要root权限来创建隧道

三、创建隧道

将两个文件放置对应的目录
  1. cp junipernc /usr/sbin/
  2. chmod 755 /usr/sbin/junipernc
  3. mkdir -p ~/.juniper_networks/network_connect/
  4. cp ncLinuxApp.jar ~/.juniper_networks/
解开jar包
  1. cd ~/.juniper_networks
  2. jar -xvf ncLinuxApp.jar
获取vpn网站的真是ip
  1. dig vpn.xxxxx.com
  2. xxx.xxx.xxx.xxx #vpn的ip地址,运行junipernc脚本时没有走dns,所以域名地址无效,没有详查原因
连接vpn
  1. joker@joker-work ~ $ junipernc --nojava --nogui
  2. Enter the Network Connect URL or server:? #vpn地址
  3. Enter the VPN account username (joker)? #vpn账号
  4. Enter the VPN service realm? vpn组名 #线上vpn分组,这个是捷航
  5. Network Connect VPN (1.31)
  6. Enter your PIN + SecurID Code ? #你vpn的密码
首次建立连接成功之后会在家目录下生成一个模板文件和一个证书文件
  1. ~/.vpn.default.cfg
  2. ~/.vpn.default.crt

注意事项

  1. 使用juniper --nogui无法在后台运行,需要保持终端始终打开才行,如果想要关闭终端可以考虑使用screen
  2. 必须创建~/.juniper_networks/network_connect/目录,否则无法建立连接
  3. juniper network 不支持ipv6 需要调整内核参数如下
    1. vim /etc/sysctl.d/jnc.conf
    2. # jnc不支持ipv6
    3. net.ipv6.conf.default.router_solicitations = 0
    4. net.ipv6.conf.all.disable_ipv6 = 1
文档更新时间: 2022-06-10 10:57   作者:张尚