Skip to content

Install ocserv on FreeBSD

pkg安装ocserv

pkg install ocserv

启动时加载内核NAT

/boot/loader.conf 中添加

ipfw_load="YES"
ipdivert_load="YES"
net.inet.ip.fw.default_to_accept="1"

启用防火墙和NAT支持

/etc/rc.conf 中添加

gateway_enable="YES"
natd_enable="YES"
natd_interface="hn0"
firewall_enable="YES"
firewall_type="OPEN"

其中 hn0 是网卡名称

启动ocserv

/usr/local/sbin/ocserv -c /usr/local/etc/ocserv/ocserv.conf -f -d 4

service ocserv start启动可能会报错

exec ocserv-worker failed No such file or directory on freebsd

直接通过上面命令行参数直接启动即可

参考资料

  • https://gitlab.com/openconnect/ocserv/-/issues/405

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try my iOS App