I've got a Linux webserver with 192.168.0.2/24 assigned to eth0 and 172.16.0.2/24 assigned to eth1. I must not change this. Here's the routing so far:
172.16.0.0/24 dev eth1 proto kernel scope link src 172.16.0.2 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 172.16.0.0/16 via 172.16.0.1 dev eth1 default via 192.168.0.1 dev eth0 The default route leads to the Internet which the machine needs access to for downloading stuff. Now there are also packets (requests) coming in from the Internet via 172.16.0.254. How do I have to set up routing tables and rules in order to answer those requests? iptables is not possible here.
Update: Seems like this works, but it doesn't look elegant to me:
ip r a 172.16.0.0/24 dev eth1 table 10 ip r a 172.16.0.0/16 via 10.16.0.1 t 10 ip r a default via 172.16.0.254 t 10 ip rule add from 172.16.0.2 t 10
ip rule add oif eth1 t 10).