ルートの優先順位
詳細は以下に記載されている。
How does kernel make decisions for adding routes to reach a destination if the interfaces are in same network in RHEL?
https://access.redhat.com/solutions/1236243
要約すると、複数の候補がある場合、以下の順番でルートの決定すると理解してよいと思う。
1.Longest prefix match (netmask が長いものが選択される)
2.Metric が小さいものが選択される
3.route コマンドでより上に表示されるものが選択されるっぽい。
※「the kernel will simply choose the first one and place it in the route table」の部分が該当すると思うがイマイチ判断がつかなかった。
RHEL7 で検証すると、後で追加されたルートほど、route コマンドで上の行に表示され、そちらが利用される動作となった。
なお、Metric の変更は以下を参照。
How to set a route metric for a specific route in Red Hat Enterprise Linux 7?
https://access.redhat.com/solutions/3022271