I'm setting up two IP addresses on one eth and one IP address on a second NIC using iproute2. There are some really good articles here and here which explain well how to do that.
However, checking the rules with ip rule show, returns in error with:
Database /etc/iproute2/rt_tables is corrupted at ip route add 192.168.15.0 dev eth0 src 192.168.15.190 table mgmtsecond
I've been googling for hours but not much on this error. I've checked the syntax with the official docs. Looks fine.
Any suggestions? Thanks!!
/etc/iproute2/rt_tables
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# Mgmt Alias and Mon Ports
#
1 mgmtsecond
2 monport
# Management Port Second Instance
# Main#2 def is 192.168.15.1
ip route add 192.168.15.0/24 dev eth0 src 192.168.15.190 table mgmtsecond
ip route add default via 192.168.15.1 dev eth0 table mgmtsecond
# Monitor Port. Default 192.168.16.1
ip route add 192.168.16.0/24 dev eth1 src 192.168.16.190 table monport
ip route add default via 192.168.16.1 dev eth1 table monport
ip rule add from 10192.168.15.0/24 table mgmtsecond
ip rule add to 192.168.15.0/24 table mgmtsecond
Best Answer
You should not add the commands
ip route add
andip rule add
to this file/etc/iproute2/rt_tables
. The file format is as follows:example:
The error message is clear about the error location:
Routes and rules should be added manually or to some other script to be invoked when needed. For example, you can add them to
/etc/rc.local
script which is invoked at end of startup process if want so.