Unable to Access Docker Host from MacVLAN

Hello,

I am sorry if this has been posted before and answered. I was unable to locate my exact scenario with a working solution provided.

I currently have a Synology NAS with docker installed. I created a macVLAN with the following configurations.

Network 192.168.1.0/24
DHCP Range 192.168.1.10-192.168.1.239
Docker Host / Synology 192.168.1.215

macVLAN
Subnet 192.168.1.0/24
IP Range 192.168.1.240/28
Gateway 192.168.1.1

I have 3 containers on this macvlan and all are able to communicate with each other. They are also able to access my gateway and access the internet. However when I try and ping 192.168.1.215 I am getting a route issue. I noticed in my ARP table 215 did not have a mac address it was listed as unknown.

What is the cleanest solution to have my containers access my host?

I am trying to create a reverse proxy to some applications on the Synology NAS that are not docker containers.

Thank You.

I cannot remember exactly the commands I did in the past to get macvlan online. However I assume I already did something similar to

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

So that means i just have to add the route on the host to the container.
ip route add 192.168.9.228/32 dev foobar

When you say this is not permanent, do you mean the route is not or the whole macvlan setup is not?

Sorry here is the command I already performed.

sudo docker network create --driver=macvlan --gateway=192.168.1.1 --subnet=192.168.1.0/24 —-ip-range=192.168.1.240/28 --o parent=ovs_eth0 Local_Network

So are you saying i have to do this as an addition

ip link add foobar link ovs_eth0 type macvlan mode bridge
ip addr add 192.168.1.215/32 dev foobar
ip link set foobar up
ip route add 192.168.1.241/32 dev foobar

or even better

ip route add 192.168.1.240/28 dev foobar?

So the docker create network is permanent but the links and routes are not?

Hello, have you found a solution?

Macvlan network and host to container connectity - #5 by smartypants?

Basicly it creates a new macvlan client interface on the host side and adds routing for the macvlan subnet using the hosts’s macvlan client inteface. This will allow host to container communication. Though, for container to host communication you will have to use the new macvlan client interfaces ip (the one from the ip addr add line!).

Since this configuration will not survive a reboot, you will need to put those command in a startup task.