docker在一块网卡上创建多个macvlan子网
docker在一块网卡上创建多个macvlan子网,不可以进行多次创建,需要在一次创建中把多个子网同时创建好。说明及创建命令如下:
一个
subnet对应一个gateway,gateway必须在subnet的范围内,直接改为你所使用的真实的gateway即可。这样可以不同的subnet设置不同的gateway,控制不同的容器走不同的线路(比如有的需要代理,有的不能代理)。--subnet=fe80::/64 --ipv6可以打开ipv6,无需设置公网ipv6的subnet,只要这样设置在这个macvlan网络上的容器就能自动获取到公网ipv6。--opt parent=eth0指定本macvlan网络绑定到父级网卡eth0上。--opt com.docker.network.bridge.name=mymacvlan指定macvlan网络名称为mymacvlan。最后的
mymacvlan是docker中的网络名称。
1 | |
转自https://devome.github.io/ 备忘使用
docker在一块网卡上创建多个macvlan子网
https://hexo.psorai.eu.org/2023/10/24/docker在一块网卡上创建多个macvlan子网/