赞
踩
提示:请注意 信息的时效性、环境的相似度。侵删!
AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。
提示:以下是本篇文章正文内容,下面案例可供参考
AnyLink 基于 ietf-openconnect 协议开发,并且借鉴了 ocserv 的开发思路,使其可以同时兼容 AnyConnect 客户端.这一点和 Openconnect VPN 是使用相同的协议和客户端.
安装教程源自官网
环境:
软件
[root@localhost anylink-deploy]# ls
anylink bridge-init.sh conf LICENSE log systemd
# 生成后台密码, 123456 自行修改
[root@localhost anylink-deploy]#./anylink tool -p 123456
"$2a$10$UQ7C.EoPifDeJh6d8.31TeSPQU7hM/NOM2nixmBucJpAuXDQNqNke"
# 生成jwt密钥
[root@localhost anylink-deploy]#./anylink tool -s
"abcdef.0123456789.abcdef"
# 查看网卡 [root@localhost anylink-deploy]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:50:56:8e:61:92 brd ff:ff:ff:ff:ff:ff inet 10.0.0.11/24 brd 10.0.0.255 scope global noprefixroute ens160 valid_lft forever preferred_lft forever inet6 fe80::b628:c58b:6675:9d21/64 scope link noprefixroute valid_lft forever preferred_lft forever [root@localhost anylink-deploy]# vim conf/server.toml #示例配置信息 #其他配置文件,可以使用绝对路径 #或者相对于 anylink 二进制文件的路径 #数据文件 db_type = "sqlite3" db_source = "./conf/anylink.db" #证书文件 使用跟nginx一样的证书即可 cert_file = "./conf/vpn_cert.crt" cert_key = "./conf/vpn_cert.key" files_path = "./conf/files" profile = "./conf/profile.xml" #日志目录,为空写入标准输出 #log_path = "./log" log_path = "" log_level = "debug" pprof = false #系统名称 issuer = "XX公司VPN" #后台管理用户 admin_user = "admin" #pass 123456 admin_pass = "$2a$10$UQ7C.EoPifDeJh6d8.31TeSPQU7hM/NOM2nixmBucJpAuXDQNqNke" jwt_secret = "abcdef.0123456789.abcdef" #服务监听地址 server_addr = ":443" #开启 DTLS, 默认关闭 server_dtls = false server_dtls_addr = ":4433" #后台服务监听地址 admin_addr = ":8800" #开启tcp proxy protocol协议 proxy_protocol = false link_mode = "tun" #客户端分配的ip地址池 ipv4_master = "eth0" ipv4_cidr = "192.168.10.0/24" ipv4_gateway = "192.168.10.1" ipv4_start = "192.168.10.100" ipv4_end = "192.168.10.200" #最大客户端数量 max_client = 100 #单个用户同时在线数量 max_user_client = 3 #IP租期(秒) ip_lease = 1209600 #默认选择的组 default_group = "one" #客户端失效检测时间(秒) dpd > keepalive cstp_keepalive = 20 cstp_dpd = 30 mobile_keepalive = 40 mobile_dpd = 50 #设置最大传输单元 mtu = 1460 #session过期时间,用于断线重连,0永不过期 session_timeout = 3600 auth_timeout = 0 audit_interval = -1
# [root@localhost anylink-deploy]# vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
# 执行如下命令
[root@localhost anylink-deploy]# sysctl -w net.ipv4.ip_forward=1
# 查看设置是否生效
[root@localhost anylink-deploy]# cat /proc/sys/net/ipv4/ip_forward
[root@localhost anylink-deploy]# systemctl stop firewalld.service [root@localhost anylink-deploy]# systemctl disable firewalld.service # 查看网卡 [root@localhost anylink-deploy]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:50:56:8e:61:92 brd ff:ff:ff:ff:ff:ff inet 10.0.0.11/24 brd 10.0.0.255 scope global noprefixroute ens160 valid_lft forever preferred_lft forever inet6 fe80::b628:c58b:6675:9d21/64 scope link noprefixroute valid_lft forever preferred_lft forever # 请根据服务器内网ens160 网卡 替换 eth0 [root@localhost anylink-deploy]# iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE # 如果执行第一个命令不生效,可以继续执行下面的命令 # iptables -A FORWARD -i eth0 -s 192.168.10.0/24 -j ACCEPT # 查看设置是否生效 iptables -nL -t nat
参考:macvtap
参考:tap
# 目录结构 [root@localhost anylink-deploy]# ls anylink bridge-init.sh conf LICENSE log systemd # anylink 程序目录 /usr/local/anylink-deploy [root@localhost anylink-deploy]# pwd /usr/local/anylink-deploy # 将 systemd/anylink.service 脚本放入: # centos: [root@localhost anylink-deploy]# cp systemd/anylink.service /usr/lib/systemd/system/ # ubuntu: [root@localhost anylink-deploy]# cp systemd/anylink.service /lib/systemd/system/
启动: systemctl start anylink
停止: systemctl stop anylink
开机自启: systemctl enable anylink
[root@local anylink-deploy]# iptables -nL -t nat Chain PREROUTING (policy ACCEPT) target prot opt source destination DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0 MASQUERADE all -- 10.0.0.0.0/24 0.0.0.0/0 Chain DOCKER (2 references) target prot opt source destination RETURN all -- 0.0.0.0/0 0.0.0.0/0 # 可能是 docker 的 iptables 设置冲突 # flush 清除所有的已定规则 [root@local anylink-deploy]# iptables -F # delete 删除所有用户“自定义”的链(tables) [root@local anylink-deploy]# iptables -X
用户组中的 本地网络 指的是:
运行 Anyconnect 客户端的PC 所在的的网络,既本地路由网段。
点开后,PC本地路由网段的数据就不会走隧道链路转发数据了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。