让docker bridge连接vlan接口
先决条件:
sudo ip link add link eth0 name eth0.100 type vlan id 101
问题:
I want to start openvpn with docker in container, this step is easy: sudo docker run -v $OVPN_DATA:/etc/openvpn -p 1194:1194/udp --privileged -e DEBUG=1 kylemanna/openvpn Then I need to let container can continue route package to eth0.100, after openvpn recieved remote client data. There is my idea about it, but not working all.
1:首先创build桥梁:
docker network create bridge vpn_bridge Then start container with vpn_bridge sudo docker run --net=vpn_bridge -v $OVPN_DATA:/etc/openvpn -p 1194:1194/udp --privileged -e DEBUG=1 kylemanna/openvpn Finally, I find can't join the vlan interface to the vpn_bridge
2:
Use macvlan: sudo docker network create -d macvlan \ --subnet=192.168.100.0/24 \ --gateway=192.168.100.1 \ -o parent=eth0.1000 pub_net Then start container with pub_net: sudo docker run --net=vpn_bridge -v $OVPN_DATA:/etc/openvpn -p 1194:1194/udp --privileged -e DEBUG=1 kylemanna/openvpn Although container join vlan, but I found can't connect the container's openvpn server even in local host.
有没有人能给我更好的方法(ps:我已经用传统的方式解决了使用linux的默认桥)