mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
fix: allow use of built-in routing tables
Cause: The user is trying to specify the routing table to use by the name of a built-in routing table defined in /usr/share/iproute2/rt_tables such as `main`. Consequence: The network role gives an error: "cannot find route table main in `/etc/iproute2/rt_tables` or `/etc/iproute2/rt_tables.d/`" The workaround is that the user must specify the table by number instead of name e.g `table: 254` instead of `table: main` Fix: Look for table mappings in /usr/share/iproute2/rt_tables as well as the other paths. Result: The user can use built-in route table names. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
parent
79fb5cda74
commit
65b5d1ad85
2 changed files with 31 additions and 0 deletions
|
|
@ -49,6 +49,11 @@
|
|||
metric: 50
|
||||
table: 30200
|
||||
src: 198.51.100.3
|
||||
- network: 198.51.101.128
|
||||
prefix: 26
|
||||
gateway: 198.51.101.1
|
||||
metric: 2
|
||||
table: main
|
||||
|
||||
- name: Get the routes from the route table 30200
|
||||
command: ip route show table 30200
|
||||
|
|
@ -62,6 +67,12 @@
|
|||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Get the routes from the route table main
|
||||
command: ip route show table main
|
||||
register: route_table_main
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Assert that the route table 30200 contains the specified route
|
||||
assert:
|
||||
that:
|
||||
|
|
@ -81,6 +92,14 @@
|
|||
msg: "the route table 30400 does not exist or does not contain the
|
||||
specified route"
|
||||
|
||||
- name: Assert that the route table main contains the specified route
|
||||
assert:
|
||||
that:
|
||||
- route_table_main.stdout is search("198.51.101.128/26 via
|
||||
198.51.101.1 dev ethtest0 proto static metric 2")
|
||||
msg: "the route table main does not exist or does not contain the
|
||||
specified route"
|
||||
|
||||
- name: Create a dedicated test file in `/etc/iproute2/rt_tables.d/` and
|
||||
add a new routing table
|
||||
lineinfile:
|
||||
|
|
@ -121,6 +140,11 @@
|
|||
metric: 50
|
||||
table: custom
|
||||
src: 198.51.100.3
|
||||
- network: 198.51.101.128
|
||||
prefix: 26
|
||||
gateway: 198.51.101.1
|
||||
metric: 2
|
||||
table: custom
|
||||
|
||||
- name: Get the routes from the named route table 'custom'
|
||||
command: ip route show table custom
|
||||
|
|
@ -139,6 +163,8 @@
|
|||
- route_table_custom.stdout is search("192.0.2.64/26 via
|
||||
198.51.100.8 dev ethtest0 proto static src 198.51.100.3
|
||||
metric 50")
|
||||
- route_table_custom.stdout is search("198.51.101.128/26 via
|
||||
198.51.101.1 dev ethtest0 proto static metric 2")
|
||||
msg: "the named route table 'custom' does not exist or does not contain
|
||||
the specified route"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue