Closed protons3th closed 1 year ago
I see you’re using macvlan in your docker instance. Does your homebridge installed in the host server or in another docker instance inside the same server?
From my experience using macvlan, even though you can access the ip from different computer in the same network, it’s unreachable inside the same server. So your problem might be the homebridge server can’t reach that ip.
How ever, if it’s in different server, can you make sure you can the homebridge server can reach it using perhaps curl?
Quick respons @dwaan - amazing! 👍
Maybe I need to solve it by not using macvlan, this is my HomeBridge compose:
`` version: '2' services:
homebridge: image: oznu/homebridge container_name: homebridge restart: unless-stopped network_mode: host ports:
You can try to replace the macvlan with host. I have similar setup like yours. Here’s my adguardhome docker compose:
version: '3.3'
services:
run:
container_name: adguardhome
network_mode: host
restart: unless-stopped
volumes:
- '/storage/adguardhome:/opt/adguardhome/work'
- '/storage/adguardhome:/opt/adguardhome/conf'
ports:
- '53:53/tcp'
- '53:53/udp'
- '67:67/udp'
- '68:68/udp'
- '80:80/tcp'
- '443:443/tcp'
- '443:443/udp'
- '3000:3000/tcp'
- '853:853/tcp'
- '784:784/udp'
- '853:853/udp'
- '8853:8853/udp'
- '5443:5443/tcp'
- '5443:5443/udp'
image: adguard/adguardhome
the volumes is optional, and I think you can just delete the rest of the ports as the instance use host network which means it have full access to the network.
Thanks for the solution, however my port 80 is already in use with my nginx. So that was why I tried to follow a guide, that created a seperate network.
So I managed to find a solution, I had to put it on it's own ip - because port 80 and 443 was in use.
This is my docker-compose:
version: "2.1" services: adguard: container_name: adguard image: adguard/adguardhome networks: adguard_macvlan: ipv4_address: 10.0.111.100 volumes: - /srv/adguard/adguard_work:/opt/adguardhome/work - /srv/adguard/adguard_conf:/opt/adguardhome/conf restart: unless-stopped networks: adguard_macvlan: driver: macvlan driver_opts: parent: eth0 ipam: config: - subnet: 10.0.111.0/24 gateway: 10.0.111.1
The solution involves creating a bridge interface on the Raspberry Pi and linking it to the macvlan network. This bridge acts as a gateway for other containers and the host itself to reach the macvlan network.
Create a macvlan Sub-interface on the Host:
sudo ip link add mac0 link eth0 type macvlan mode bridge sudo ip addr add 10.0.111.101/24 dev mac0 sudo ip link set mac0 up
Create a Route to the macvlan Network: This route will direct traffic for the 10.0.111.100 IP through the mac0 interface.
sudo ip route add 10.0.111.100/32 dev mac0
Enable IP Forwarding:
sudo sysctl -w net.ipv4.ip_forward=1
To make this change permanent, edit /etc/sysctl.conf and add or modify the line: net.ipv4.ip_forward=1
So the above solution is still working, but whenever i rebooted my Pi, I had to do it again. This is how I added it at boot:
First, create a script, e.g., setup_macvlan.sh:
#!/bin/bash ip link add mac0 link eth0 type macvlan mode bridge ip addr add 10.0.111.101/24 dev mac0 ip link set mac0 up ip route add 10.0.111.100/32 dev mac0
Make the script executable:
chmod +x setup_macvlan.sh
Add the script to the crontab to run at boot:
sudo crontab -e
Add the following line at the end of the file:
@reboot /path/to/setup_macvlan.sh
Remember to have an emtpy line after the one above in the crontab.
Yes correct, routing is not permanent in Linux by default, you need to do it every time you linux restarted.
I have no issues accessing and using the same login for AdGuard Home on http://10.0.111.100/
No matter what I try, I can't get HomeBridge to connect to my AdGuard.
Runnine the following setup: homebridge-adguardhome v1.7.2 Running a Portainer width HomeGuard Home Version: v0.107.36
Here are my to settings:
HomeBridge Conf:
Portainer Stacks:
version: "2.1"
services: adguard: container_name: adguard image: adguard/adguardhome ports:
networks: macvlan: name: docker_macvlan driver: macvlan enable_ipv6: false driver_opts: parent: eth0 ipam: config:
subnet: 10.0.111.0/24 # Set to same subnet as your router and other devices ip_range: 10.0.111.100/27 # Available range from 192 to 224. gateway: 10.0.111.1 # This is your router IP
vlan_bridge: name: docker_vlan_bridge driver: bridge enable_ipv6: false ipam: config:
volumes: adguard_work: name: adguard_work adguard_conf: name: adguard_conf