Skip to content

Instantly share code, notes, and snippets.

@du-song
Last active March 5, 2021 05:33
Show Gist options
  • Save du-song/0d6c3a542c93bee5766286e950d0bd13 to your computer and use it in GitHub Desktop.
Save du-song/0d6c3a542c93bee5766286e950d0bd13 to your computer and use it in GitHub Desktop.
Connect Cisco AnyConnect server with OTP in OpenWrt
# use vanilla vpnc instead of the wrapped one in OpenWrt, which handles route table properly
wget http://git.infradead.org/users/dwmw2/vpnc-scripts.git/blob_plain/HEAD:/vpnc-script
/usr/sbin/openconnect $SERVER -b --script ./vpnc-script -u $USER
# update iptables manually instead of UCI
iptables -I zone_wan_dest_ACCEPT 5 -o tun0 -j ACCEPT
iptables -I FORWARD 5 -i tun0 -j zone_wan_forward
iptables -t nat -I POSTROUTING 5 -o tun0 -j zone_wan_postrouting
# (optional) add ping in crontab to avoid idle timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment