I have a quick question regarding the behaviour of priority when using policy based routing. I'm running Ubuntu 18.04 (kernel is 4.15.0-1021-aws).
I'm using this machine as a gateway to forward packets from one interface to another. Let's say eth0 -> eth1.
For packets generated by the machine itself, I don't want them to be routed through eth1 ever. However, packets originating from different machines (in the same subnet as eth0,
192.168.0.0/24) need to be routed through eth1.
The ip address of eth0 is
192.168.0.1. The routing table for forwarding packets is called
forwarded. So I have added the following rules:
0: from all lookup local 1: from 192.168.0.1/32 lookup default 10: from 192.168.0.1/24 lookup forwarded 32766: from all lookup main 32767: from all lookup default
However, when I try and ping from this machine, it uses the
forwarded routing table. Is there a way of doing this or have I made some error here?