Skip to content

Commit 46f4bb3

Browse files
authored
Document custom network CIDR configuration
Added information on customizing network CIDR in Compose projects.
1 parent fe74150 commit 46f4bb3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/concepts/networking.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,24 @@ http://<service-name>:<port>
126126
```
127127
</TabItem>
128128
</Tabs>
129+
130+
### Custom Network CIDR
131+
132+
By default, Defang creates a separate private/internal network in the 10.0.0.0/16 subnet for each Compose project.
133+
To customize this CIDR, you can set the `subnet` of the `default` network in the Compose file:
134+
135+
```yaml
136+
networks:
137+
default:
138+
ipam:
139+
config:
140+
- subnet: 10.12.0.0/16
141+
```
142+
143+
For example, if you plan to set up peering between two separate Compose projects, the two private networks cannot have
144+
overlapping IP address ranges. You can use this feature to give a distinct range to each Compose project and use the
145+
VPC peering features of the cloud provider to set up connectivity.
146+
147+
Alternatively, to allow communication between services from different Compose projects, you can use the Compose [include](https://github.com/compose-spec/compose-spec/blob/main/14-include.md)
148+
feature to *merge* multiple Compose files into a single project. This way, the services in the different files end up in
149+
the same network and can use private/internal networking.

0 commit comments

Comments
 (0)