Hello! The company has a hardware router that works with 2 Internet service providers. From it requests are sent to the linux-machine. Is it possible to make it so that if the request on port 443 comes through the first ISP, on the linux machine it would redirect to one port, and if it comes to the same port 443 through the second ISP, it would redirect to another port on linux- car? The hardware router does not allow this, and in linux destination IP the same one, it seems, is obtained for packets after the hardware router, so it is not clear which field to use to do the redirect rule. The problem is that after the hardware router on the side of the linux router, apparently, it is impossible to understand through which provider the packet went. Because the router replaces the destination ip (external ip of the router) with a local ip linux machine.
That is, in the logs after the command:
iptables -t nat -A PREROUTING -p tcp --dport 443 -j LOG --log-prefix "iptables" We see in the dst field not some external (of two) address of the router, but the local address 192.168.... linux-machine to which the packet arrived. So, there is not 1 router on the way of a packet from the Internet, but two. The first is hardware (tplink), with it the packets go to the second, which runs on linux. This second uses only one network card (eth0) and one subnet. And you need to configure this second one based on the rule, which is based on the definition of the channel where the request came from.
It is clear that the first router can be removed and everything can be done on linux, but the task is exactly as described.