last day (16 days later) » 

7:47 PM
0
Q: Allow Docker Container with MacVLAN network to access Wireguard connected remote

lexXxelI do have two servers: Server A: a local NAS running RHEL 8.5 (5.17.1 kernel - so it has native wireguard support); local IP 192.168.1.1 Server B: a VPS with debian 11.3 (5.10.0 kernel - also has wireguard support) Now my local network has a FritzBox with IP: 192.168.0.1. It's DHCP is configure...

 
The prefix lengths in your configuration is quite messed up. It seems that you want all three types of hosts in one single broadcast domain, yet you aren't using the prefix length /22 consistently. (While normally there's no point in doing so, technically you could use multiple IP subnets, e.g. three /24, in a single BD, but that is not the same thing as mixing conflicting /22 ~ /24 like you are doing now.)
Besides, what's the point in using (bridge mode) MACVLANs that are attached to a bridge?
 
If the macvlan is not part of the bridge, another device on the local network, like 192.168.0.10 was not able to see devices on the 192.168.2.x subnet. The reason for using /23 on the bridge is that otherwise Server A would send packages twice to the .2.x subnet.
For clarification, I run containers on **Server A"" that provide their own Webserver/ -service like pihole, Munn, minio. That's why I want to be able to reach them from everywhere and run multiple containers that might bind to the same port.
@TomYan - see collabnix.com/…
 
There's no problem in putting all the hosts / containers in a single BD. It's merely that I don't see much point in using MACVLANs when you are attaching them to a bridge. (Why not just make the containers use the bridge with taps?) I have no idea what you mean by "sent twice", but indeed you probably shouldn't have IP configured on both the bridge and the host-side MACVLAN. Rather you should only configure one on either of them if you insist on such set-up, and again all the hosts in the BD should have /22 as prefix/mask.
 
Thanks Tom for your attempt to help me. I removed the bridge. So now I only have the MacVLAN device, my local ethernet adapter as well as the wireguard link. I don't know how to create a bridge device that connects the containers to the local network. As far as I know, the bridge devices I can create with docker network create xxxx are not bridges that connect would do that, right?
also, the docker shim is now created like this:

```
ip link delete docker-shim
ip link add docker-shim link enp3s0 type macvlan mode bridge
ip addr add 192.168.2.1/32 dev docker-shim
ip link set docker-shim up
ip route add 192.168.2.0/24 dev docker-shim
```
with :
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:96:91:20:65:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/22 brd 192.168.3.255 scope global noprefixroute enp3s0
valid_lft forever preferred_lft forever
inet6 fe80::518b:6cdf:d082:f7fe/64 scope link noprefixroute
valid_lft forever preferred_lft forever
and :

$ ip route
default via 192.168.0.1 dev enp3s0 proto static metric 6
10.0.0.0/24 dev wg0 scope link
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.0.0/22 dev enp3s0 proto kernel scope link src 192.168.1.1 metric 6
192.168.2.0/24 dev docker-shim scope link
 
8:08 PM
still my containers can't reach Server B which is behind the wireguard tunnel
 
8:22 PM
OK I got everything to work ...
thank you for beeing my rubber duck tonight
 

  last day (16 days later) »