I'm using this on my server to route any traffic to certain ip over a specific interface
ip route add 80.100.141.27/32 via 167.99.208.1 dev eth0 src 10.18.0.10
This works great, traffic to 80.100.141.27 will go over 10.18.0.10
Now to organise these rules I'm thinking I could use named tables.
First I create a new table called 'table-name'
- name: create named ip route table
lineinfile:
path: /etc/iproute2/rt_tables
line: '200 table-name'
create: yes
tags: ip_route
Then I can add rules as follows
ip route add table table-name 80.100.141.27/32 via 167.99.208.1 dev eth0 src 10.18.0.10
Rules are now added to this table
ip route show table table-name
However the rules are not active. Traffic does not go over the specified route.