Port forwarding not working for certain LAN IP

I hope someone can shed some light on this. My knowledge of networking is basic at best.

I have a CentOS server on two networks:

  • NIC1 is on a public IP with gateway set sitting on Switch 1. (ADSL Internet)
  • NIC2 is set to with no gateway set sitting on Switch 2. (Cable Internet)
  • Switch 2’s gateway/router is (ASUS router)

Within the LAN, other LAN pc’s are able to access on open ports. When a port forward rule is set from gateway/router –>, this isn’t working. Port forwarding on gateway/router –> to works (Windows machine with gateway set to

Is it possible to reach from the public internet through the ASUS router


IP policy routing.

I found two write-ups of the same that I used to update my CentOS server to enable the 2nd NIC to receive and send packets. Also was successful in updating another similar server with a dual NICs/gateways.

http://jensd.be/468/linux/two-network-cards-rp_filter <– I went with setting up IP policies under the ‘best solution’ section and did not change the rp_filter value. This write-up also has nice diagrams.

http://www.microhowto.info/howto/ensure_symmetric_routing_on_a_server_with_multiple_default_gateways.html <–additional example of the above which made it clearer for me.

If you want the changes permanent, then follow the instructions on the first link above.

My example:

  • ip route add dev eth0 table 1 (example Public IP #1)
  • ip route add default via table 1 (example Public IP #1’s gateway)
  • ip route add dev eth1 table 2 (second NIC on different network)
  • ip route add default via table 2 (ASUS router gateway)
  • ip rule add from table 1 priority 100
  • ip rule add from table 2 priority 110
  • ip route flush cache

The /24 for you may change depending on subnet mask of your IP’s.

Source : Link , Question Author : stile , Answer Author : stile

Leave a Comment