This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there a way to order NAT rules?

I was wondering if there is a way to order NAT rules.
What I did was to setup a generic rule for my internal network (Masquerading), but then I also want to be able to set up some specific rules for some of the host in my internal network (SNAT). Unfortunately it seems that even though there is a host specific rule, it's picking up the external IP address from the Masquerade rule.
Is there some way to 'order' the rules for that the specific one will be picked up before the generic one?


This thread was automatically locked due to age.
Parents
  • The SNAT is for incoming traffic, right?

    Barry
  • No, the source NAT is for outbound traffic from hosts on my internal network. I wanted to create rules for 2-4 hosts so that they all  be NATted to a different external IP address.
  • OK... this should work:

    logically divide your internal network.
    (e.g. put all the SNAT computers on IPS > 192.168.1.128 or whaterver)

    create a network definition for each of the /25 networks.

    only MASQ the lower IPs

    SNAT each of the upper IPs.

    Don't forget the packetfilter rules also.

    Barry
  • Rather simple, they are inserted from top to down from the list into the NAT table. 
    So instead of using names, I used numbers to sort the nat table. 

    Like:
    1
    111
    112
    2
    222
    223 and so on.

    This will take sure, that the NAT rule is inserted into the right position, avoiding wrong translations. Don't know why Astaro didn't insert a sort feature like in the packet-filter table. 

    Chris
  • [ QUOTE ]
    Rather simple, they are inserted from top to down from the list into the NAT table. 
    So instead of using names, I used numbers to sort the nat table.

    This will take sure, that the NAT rule is inserted into the right position, avoiding wrong translations. Don't know why Astaro didn't insert a sort feature like in the packet-filter table. 

    [/ QUOTE ]I do a similar thing. ASL should definitely add ordering as a feature, it's a pain to move NAT rules around as this usually means recreating the rule with the proper name to get it into the location you want.
  • Thanks for the info.
    I inserted my 2 test SNAT rules above the Masquerade rule by using the suggested numbering, but it seems that the hosts are still using the external IP from the Masquerade rule. I've tested with several IP displaying web sites, and they all show the Masq address.

    1_TestRule server1 -> Any / Any outside_test1(Address)  None
    2_TestRule server2 -> Any / Any outside_test2(Address)  None
    Default_Masq Internal (Network) -> All / All MASQ__External  None

    Is there a log I can check to see what NATting rules are getting applied to which addresses?
Reply
  • Thanks for the info.
    I inserted my 2 test SNAT rules above the Masquerade rule by using the suggested numbering, but it seems that the hosts are still using the external IP from the Masquerade rule. I've tested with several IP displaying web sites, and they all show the Masq address.

    1_TestRule server1 -> Any / Any outside_test1(Address)  None
    2_TestRule server2 -> Any / Any outside_test2(Address)  None
    Default_Masq Internal (Network) -> All / All MASQ__External  None

    Is there a log I can check to see what NATting rules are getting applied to which addresses?
Children
No Data