• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

598
Views
Unable to connect to docker on Anyconnect VPN

I am using docker toolbox on windows for docker related development. This works fine when I am on home or office network but doesn't work when I am using anyconnect VPN to connect to office network. Please let me know if there is a network setting which can be changed to make it work.

about 3 years ago · Santiago Trujillo
3 answers
Answer question

0

I've really like OpenConnect (which supports more configuration options than network-manager-openconnect). Even hideous installations that require csd-wrapper usually work well.

AnyConnect breaks docker networks in a weird way and they stay broken even after you exit the VPN (even if you stop vpnagentd afterwards).

The workaround is to stop docker, clear all its networks and bridges and only then start the AnyConnect VPN. You can start docker after the VPN session ends and it will re-create all necessary stuff.

I created a script to workaround this unfortunate behavior that does exactly this:

#!/bin/sh
# usage: 
#   vpn.sh [start]
#   vpn.sh stop    

if [ "$1" = "stop" ]; then
    /opt/cisco/anyconnect/vpn/vpn disconnect
    sudo systemctl stop vpnagentd
    echo "Cisco VPN stopped"
    echo "Starting docker"
    sudo systemctl start docker
else
    echo "Stopping docker"
    sudo systemctl stop docker
    bridges=$(sudo brctl show | cut -f1 | tail -n +2)
    for b in $bridges; do
        sudo nmcli connection delete $b
        sudo ip link set dev $b down
        sudo brctl delbr $b
    done
    echo "Starting Cisco VPN"
    sudo systemctl start vpnagentd
    /opt/cisco/anyconnect/vpn/vpn connect 'VPN-NAME'
fi

Note: A VPN admin can prevent you from using OpenConnect and force you to use Cisco AnyConnect only but you might a better experience if LocalLanAccess is enabled in your VPN profile.

about 3 years ago · Santiago Trujillo Report

0

The following worked for me.

Try using OpenConnect instead of Anyconnect:

sudo apt install openconnect
sudo apt install network-manager-openconnect

and then (for Ubuntu 16 at least) comment out the line dns=dnsmasq, so it becomes like this:

$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq

Then add a connection using NetworkManager to your VPN provider and connect. (NetworkManager -> Edit connections -> Add. Then select Connection type to be VPN -> Cisco Annyconnect)

Reboot and reconnect, and now docker containers should have access to internet.

about 3 years ago · Santiago Trujillo Report

0

Docker adds an entry by default to the routing table, which forwards all traffic with destination 172.17.X.X through the loopback address. In your case, if the IP address assigned to your computer by AnyConnect begins with 172.17 the two subnets overlap and Docker freezes the vpn connection (you can check that by looking at your IP assigned by anyconnect and compare it with the routing table of the docker machine).

If that's the case, you can change the default subnet used by Docker by adding the following to the %programdata%\docker\config\daemon.json

{
  "default-address-pools":
  [
    {"base":"10.10.0.0/16","size":24}
  ]
}

After those configuration changes restart the Docker service and verify that the new subset has been set (you can use netstat -rn).

Article for the steps in Linux here.

about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error