LINUX
Anyconnect Ubuntu Vm to Windows Host

download from cisco.com extract file cd anyconnect-linux64-4.10.06090/ cd vpn/ sudo ./vpn_install.sh

Now to give access to our windows host to access our anyconnect vpn from inside our ubuntu VM

Update package lists

sudo apt-get update

Install iptables-persistent if not already installed

sudo apt-get install -y iptables-persistent

Enable IP forwarding

sudo sysctl -w net.ipv4.ip_forward=1

Flush existing rules

sudo iptables -F sudo iptables -t nat -F sudo iptables -X

Set default policies to allow outgoing traffic and block incoming traffic

sudo iptables -P INPUT DROP sudo iptables -P FORWARD DROP sudo iptables -P OUTPUT ACCEPT

Allow traffic on loopback interface

sudo iptables -A INPUT -i lo -j ACCEPT sudo iptables -A OUTPUT -o lo -j ACCEPT

Allow established and related incoming connections

sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

Allow SSH traffic from your PC (192.168.1.11) to the Ubuntu machine (192.168.1.240)

sudo iptables -A INPUT -s 192.168.1.11 -p tcp --dport 22 -j ACCEPT

Allow outgoing connections initiated from VPN interface

sudo iptables -A FORWARD -i cscotun0 -o ens33 -j ACCEPT

Allow traffic from local network to VPN

sudo iptables -A FORWARD -i ens33 -o cscotun0 -j ACCEPT

Enable NAT for outgoing traffic

sudo iptables -t nat -A POSTROUTING -o cscotun0 -j MASQUERADE

Save iptables rules

sudo iptables-save > /etc/iptables/rules.v4

On windows

  • create a route that sends the traffic for the subnets in the VPN to the ubuntu main interface PS C:\Users\Devnet> route add -p 10.10.0.0 mask 255.255.0.0 192.168.1.245 OK!