mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Add ability to set static routes
add routes using the --route flag. the no_default_route option in --opt prevents a default route from getting added automatically. Signed-off-by: Jan Hendrik Farr <github@jfarr.cc>
This commit is contained in:

committed by
Paul Holzinger

parent
68183b07d6
commit
8bf168cc13
@ -95,10 +95,12 @@ Set metadata for a network (e.g., --label mykey=value).
|
||||
|
||||
Set driver specific options.
|
||||
|
||||
All drivers accept the `mtu` and `metric` options.
|
||||
All drivers accept the `mtu`, `metric`, `no_default_route` and options.
|
||||
|
||||
- `mtu`: Sets the Maximum Transmission Unit (MTU) and takes an integer value.
|
||||
- `metric` Sets the Route Metric for the default route created in every container joined to this network. Accepts a positive integer value. Can only be used with the Netavark network backend.
|
||||
- `no_default_route`: If set to 1, Podman will not automatically add a default route to subnets. Routes can still be added
|
||||
manually by creating a custom route using `--route`.
|
||||
|
||||
Additionally the `bridge` driver supports the following options:
|
||||
|
||||
@ -114,6 +116,10 @@ The `macvlan` and `ipvlan` driver support the following options:
|
||||
- Supported values for `macvlan` are `bridge`, `private`, `vepa`, `passthru`. Defaults to `bridge`.
|
||||
- Supported values for `ipvlan` are `l2`, `l3`, `l3s`. Defaults to `l2`.
|
||||
|
||||
#### **--route**=*route*
|
||||
|
||||
A static route in the format <destination in CIDR notation>,<gateway>,<route metric (optional)>. This route will be added to every container in this network. Only available with the netavark backend. It can be specified multiple times if more than one static route is desired.
|
||||
|
||||
#### **--subnet**=*subnet*
|
||||
|
||||
The subnet in CIDR notation. Can be specified multiple times to allocate more than one subnet for this network.
|
||||
@ -158,6 +164,17 @@ $ podman network create --subnet 192.168.55.0/24 --gateway 192.168.55.3 --subnet
|
||||
podman4
|
||||
```
|
||||
|
||||
Create a network with a static subnet and a static route.
|
||||
```
|
||||
$ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 newnet
|
||||
```
|
||||
|
||||
Create a network with a static subnet and a static route without a default
|
||||
route.
|
||||
```
|
||||
$ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 --opt no_default_route=1 newnet
|
||||
```
|
||||
|
||||
Create a Macvlan based network using the host interface eth0. Macvlan networks can only be used as root.
|
||||
```
|
||||
$ sudo podman network create -d macvlan -o parent=eth0 --subnet 192.5.0.0/16 newnet
|
||||
|
@ -28,6 +28,7 @@ Pretty-print networks to JSON or using a Go template.
|
||||
| .NetworkDNSServers | Array of DNS servers used in this network |
|
||||
| .NetworkInterface | Name of the network interface on the host |
|
||||
| .Options | Network options |
|
||||
| .Routes | List of static routes for this network |
|
||||
| .Subnets | List of subnets on this network |
|
||||
|
||||
## EXAMPLE
|
||||
|
@ -56,6 +56,7 @@ Valid placeholders for the Go template are listed below:
|
||||
| .NetworkDNSServers | Array of DNS servers used in this network |
|
||||
| .NetworkInterface | Name of the network interface on the host |
|
||||
| .Options | Network options |
|
||||
| .Routes | List of static routes for this network |
|
||||
| .Subnets | List of subnets on this network |
|
||||
|
||||
#### **--no-trunc**
|
||||
|
Reference in New Issue
Block a user