linux - On OpenConnect VPN, Docker containers have DNS but host machine does not
问题描述
When I connect to a VPN using open connect, the docker containers that run afterwards have the ability to use DNS but the host machine itself does not.
If I look at the contents of /etc/resolv.conf in the containers, the file has the DNS servers in them, but the file on the host machine does not.
From Containers:
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 10.x.x.x
nameserver 10.x.x.x
search university.liberty.edu liberty.edu
(I have replaced the actual addresses)
From the host:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search university.liberty.edu liberty.edu
When I use anyconnect instead of openconnect, the containers do not have dns but the host machine does. Everyone on my development team has had identical results. We're on Linux Mint 19.
I added the DNS addresses in the IPv4 tab of the Network Manager in network settings.
Does anyone have any suggestions as to what I need to do to have DNS available to the host machine and the containers at the same time?
Update:
When I connect to VPN using Cisco AnyConnect, the link from /etc/resolv.conf to /run/resolvconf/resolv.conf is maintained. The result of this is that docker containers run afterward DO NOT have access to DNS. When I connect to VPN using Cisco's openconnect, the link from /etc/resolv.conf is broken and replaced, presumably by open connect. The result of this is that the docker containers are happy using DNS, but my host machine cannot.
解决方案
推荐阅读
- html - 怎么做
显示在下方 - python - 在 python 3 中加载多文件夹图像数据集?
- php - 如何修复 PHP 中的 openssl_private_decrypt() 错误?
- python - 如何将 warp_matrix(来自 cv2.findTransformECC)与 cv2.transform 一起使用
- python - Try,Except / If 语句组合 - 缺少结果
- azure - 当我尝试在 Azure 上部署 SLES 12 服务器时,无法在自定义脚本中执行“网络广告加入”
- spring-boot - 自定义用户的 Spring 安全身份验证失败
- python - 熊猫只选择列中唯一字符串在另一列中只有一个特定字符串的行
- laravel-5 - 我为 laravel-datatables 搜索设置列类
- javascript - 在 javascript 中,将持续时间(以分钟为单位)添加到 YYYYMMDDHHMMSS 日期/时间戳类型以获取新的日期/时间戳