Basic usage
Add to an existing application using juju-info relation.
Example:
juju deploy advanced-routing
juju add-relation ubuntu advanced-routing
The user can configure the following parameters:
-
enable-advanced-routing
: Enable routing. This requires for the charm to have routing information configured in JSON format:juju config advanced-routing --file path/to/your/config
-
advanced-routing-config
parameter contains 3 types of entities: ‘table’, ‘route’, ‘rule’. The ‘type’ parameter is always required.
table: routing table to put the rules in (used in rules)
route: defines a static route with the following params:
- default_route: should this be a default route or not (boolean: true|false) (optional, requires gateway and table)
- net: IPv4 CIDR for a destination network (string) (mutually exclusive with default_route, and requires gateway or device)
- gateway: IPv4 gateway address (string) (either device or gateway is required)
- table: routing table name (string) (optional, except if default_route is used)
- metric: metric for the route (int) (optional)
- device: device (interface) (string) (either device or gateway is required)
rule:
- from-net: IPv4 CIDR source network or “all” (string) (required)
- to-net: IPv4 CIDR destination network or “all” (string) (optional)
- table: routing table name (string) (optional, default is main)
- priority: priority (int) (optional)
An example yaml config file below:
settings:
advanced-routing-config:
value: |-
[ {
"type": "table",
"table": "SF1"
}, {
"type": "route",
"default_route": true,
"gateway": "10.191.86.2",
"table": "SF1",
"metric": 101,
"device": "eth0"
}, {
"type": "route",
"net": "6.6.6.0/24",
"gateway": "10.191.86.2"
}, {
"type": "rule",
"from-net": "192.170.2.0/24",
"to-net": "192.170.2.0/24",
"table": "SF1",
"priority": 101
} ]
enable-advanced-routing:
value: true
The example_config.yaml
file is also provided with the codebase.
Note: the from-net
parameter refers not to the tcp conversation, but to
the individual packet path. I.e., if a reply from our host to a remote host is
from the interface with address 192.170.2.4, regardless of destination, that
would trigger the rule when we state "from-net": "192.170.2.0/24"
.