Skip to content

Commit

Permalink
docs(README): add network interface binding documentation (#1008)
Browse files Browse the repository at this point in the history
Signed-off-by: Mohsen Rezaei <[email protected]>
Co-authored-by: favonia <[email protected]>
  • Loading branch information
mohsenrezaeithe and favonia authored Dec 22, 2024
1 parent 58dd607 commit 051d8e2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Favonia @favonia contributed the majority of the code and its documentation.
- Brandon @skarekrow provided a sample OpenBSD `rc.d` script.
- @JvdMaat helped improve [`README`](./README.markdown).
- @mohsenrezaeithe contributed to improvements and documentation.

# Past Contributors

Expand Down
36 changes: 36 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ services:
# Your domains (separated by commas)
- PROXIED=true
# Tell Cloudflare to cache webpages and hide your IP (optional)
#networks:
# LAN0:
# external: true
# name: LAN0
# Introduce custom Docker networks to the 'services' in this file. A common use case
# for this is binding one of the 'services' to a specific network interface available at
# Docker's host. This section is required for the 'networks' section of each 'services'.
```

<details>
Expand Down Expand Up @@ -179,6 +186,35 @@ The easiest way to enable IPv6 is to use `network_mode: host` so that the update

</details>

<details>
<summary><em>Click to expand:</em> 🛜 Bind to a specific network interface for updates</summary>

📜 This method uses a MacVLAN sub-device to bind to a specific network interface and may bypass your custom `iptables` and `nftables` configurations.

To be able to use a specific network interface when detecting the IP in the DDNS updates, the following Docker network must be created before running a Docker container with a custom network:

```bash
docker network create
-d macvlan
-o parent=eth0 # host network interface name to bind to
--subnet=192.168.1.0/24 # IP space for running containers within this network
--gateway=192.168.1.1 # IP address of the gateway/router
--ip-range=192.168.1.128/25 # communication IP range for containers in this network
LAN0 # name that will be used in the docker-compose.yml
```

Once the new Docker network is created, add the following to the Docker Compose that will start the `cloudflare-ddns` service. This enforces all requests from this service to go through the mentioned network, e.g. 'LAN0'.

```yaml
networks:
LAN0:
# ipv4_address: 192.168.1.131 # A static IP within subnet (line can be removed for a random IP)
```

If a static IP is preferred, an `ipv4_address` section like the example can be added. NOTE: this IP must be within the `--subnet` of the Docker network.

</details>

<details>
<summary><em>Click to expand:</em> 🛡️ Change <code>user: "1000:1000"</code> to the user and group IDs you want to use</summary>

Expand Down

0 comments on commit 051d8e2

Please sign in to comment.