2023-09-24 00:48:12 +00:00
|
|
|
Configure interfaces and pbr for RedHat and Debian based distros
|
|
|
|
|
|
|
|
Supported OS with Network Manager:
|
|
|
|
- Rocky Linux 8/9
|
|
|
|
- AlmaLinux 8/9
|
|
|
|
- CentOS 7
|
|
|
|
- Debian 11/12
|
|
|
|
- Ubuntu 20.04/22.04
|
|
|
|
|
|
|
|
Limited support for network-scripts available for CentOS 7.
|
2021-10-26 21:34:13 +00:00
|
|
|
Supported iterface types for network-scripts:
|
|
|
|
- ethernet (default)
|
|
|
|
- loopback
|
|
|
|
|
2023-09-26 22:24:37 +00:00
|
|
|
Examples:
|
2023-09-26 22:22:11 +00:00
|
|
|
<details>
|
|
|
|
<summary>IPs and PBR with Network Manager</summary>
|
2021-10-26 21:34:13 +00:00
|
|
|
|
2023-09-26 22:23:07 +00:00
|
|
|
network:
|
|
|
|
network_manager:
|
|
|
|
iface:
|
|
|
|
- conn_name: ens256
|
|
|
|
ip4:
|
|
|
|
- "100.127.2.2/29"
|
|
|
|
routes4:
|
|
|
|
- 0.0.0.0/0 100.127.2.6 table=200
|
|
|
|
- 100.127.2.0/29 100.127.2.2 table=200
|
|
|
|
- conn_name: dummy0
|
|
|
|
type: dummy
|
|
|
|
ip4:
|
|
|
|
- "18.12.3.1/32"
|
|
|
|
routing_rules4:
|
|
|
|
- priority 5 from 18.12.3.1 table 200
|
2023-09-26 22:22:11 +00:00
|
|
|
|
|
|
|
</details>
|
2023-09-24 00:48:12 +00:00
|
|
|
|
2023-09-26 22:24:37 +00:00
|
|
|
<details>
|
|
|
|
<summary>Simple policy base routing with Network Manager</summary>
|
2023-09-24 00:48:12 +00:00
|
|
|
|
|
|
|
network:
|
|
|
|
network_manager:
|
|
|
|
iface:
|
|
|
|
- conn_name: 'System eth1'
|
|
|
|
routes4:
|
|
|
|
- 0.0.0.0/0 192.168.78.1 table=400
|
|
|
|
routing_rules4:
|
|
|
|
- priority 10 from {{ ansible_eth1.ipv4.address }} table 400
|
|
|
|
- priority 10 from 192.168.78.251 table 400
|
|
|
|
|
2023-09-26 22:24:37 +00:00
|
|
|
</details>
|
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary>IPs and PBR with network-scripts</summary>
|
2021-10-26 21:34:13 +00:00
|
|
|
|
|
|
|
network:
|
|
|
|
network_scripts:
|
|
|
|
iface:
|
|
|
|
- name: ens256
|
|
|
|
ip:
|
|
|
|
- ipaddr: "100.127.2.2"
|
2021-10-27 09:27:08 +00:00
|
|
|
prefix: "29"
|
2021-10-26 21:34:13 +00:00
|
|
|
- name: lo
|
|
|
|
type: loopback
|
|
|
|
ip:
|
|
|
|
- ipaddr: "18.12.3.1"
|
2021-10-27 09:27:08 +00:00
|
|
|
prefix: "32"
|
2021-10-26 21:34:13 +00:00
|
|
|
route:
|
|
|
|
- default table 200 via 100.127.2.6
|
|
|
|
- 100.127.2.0/29 table 200 via 100.127.2.2
|
|
|
|
rule:
|
|
|
|
- from 18.12.3.1 table 200
|
|
|
|
pbr:
|
|
|
|
table:
|
|
|
|
- number: 200
|
|
|
|
name: "prod"
|
2023-09-26 22:24:37 +00:00
|
|
|
|
|
|
|
</details>
|