[docker] 关于docker的网络看这一篇就够了

ps -ef | grep 'bash'
mkdir -p /var/run/netns
cd /var/run/netns/
ln -s /proc/15027/ns/net c0

ip netns ls
ip netns exec c0 ip a

ip link add veth1.1 type veth peer name veth1.2
ip link set dev veth1.2 netns c0
ip netns exec c0 ip a

ip link add mybr0 type bridge
ip link set dev mybr0 192.168.10.1/24 up

ip link set dev veth1.1 master mybr0
ip link set dev veth1.1 up

ip netns exec c0 ip link set dev veth1.2 192.168.10.201/24 up

ping 192.168.10.201
ip netns exec c0 ping 192.168.10.1

posted @ 2021-04-10 16:06  TimLinux  阅读(58)  评论(0编辑  收藏  举报