17
解决docker和kvm网络冲突的问题
source link: https://blog.leixin.wang/611c78a3.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
解决docker和kvm网络冲突的问题
在一台kvm宿主机上安装了docker以后发现kvm的虚拟机无法获取到ip,配置静态ip网络也无法正常工作,但是宿主机的网络却很正,排查到libvirtd
有如下报错
Apr 18 13:12:05 workspace libvirtd[721]: Failed to open file '/sys/class/net/vethaf21808/operstate': No such file or directory
Apr 18 13:12:05 workspace libvirtd[721]: unable to read: /sys/class/net/vethaf21808/operstate: No such file or directory
Apr 18 13:37:01 workspace libvirtd[721]: internal error: End of file from qemu monitor
Apr 18 13:37:25 workspace libvirtd[721]: internal error: End of file from qemu monitor
排查了一通没有更详细的消息,猜测是docker网桥导致的问题。于是查询到资料将docker网桥绑定到br0
上面问题解决。操作如下
# vim /etc/docker/daemon.json
{
"bridge": "br0",
"default-gateway": "172.16.80.1" #此处ip地址为宿主机的真实网关
}
PS:
故障原因是docker server
在启动的时候会创建docker网桥docker0
,用于提供docker内部的网络通信以及容器和docker外界的通信。默认docker0
会绑定物理网卡如enp0xxx
、eth0
。而br0
也绑定了物理网卡,docker0
将物理网卡抢占,导致kvm使用br0
无法正常获取网络。
- 本文作者: MKing
- 本文链接: http://www.leixin.wang/611c78a3.html
- 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK