Unable to access docker containers from host over macvlan network

前端 未结 2 1994
萌比男神i
萌比男神i 2021-02-15 15:53

In my Linux network I am unable to reach my docker containers from the host they are running on, over a dedicated macvlan network. All other connections from to this macvlan net

2条回答
  •  情歌与酒
    2021-02-15 16:40

    You can do this by doing the following:

    ip link add foobar link enp7s0 type macvlan mode bridge
    ip addr add 192.168.9.252/32 dev foobar
    ip link set foobar up
    ip route add 192.168.9.228/32 dev foobar
    

    Where:

    enp7s0 - Name of your physical adapter

    192.168.9.252/32 - Genuine new IP on your network

    192.168.9.228/32 - IP of the container using macvlan

    Please be aware that this will not survive reboots, so you will need to script it to run each reboot or use another method to make it persisten

提交回复
热议问题