SRX

last person joined: yesterday 

Ask questions and share experiences about the SRX Series, vSRX, and cSRX.
  • 1.  Traffic hair-pinning with static NAT

    Posted 12-09-2016 11:25

    Hi, guys,

     

    I have a not-so-standard request from our application team, please refer to the following topoloyg:

     

    HostA (192.168.0.1/24), HostB(192.168.0.2/24) -----> (SRX trusted interface 192.168.0.254) SRX (untrusted 1.2.3.254/24)

     

    Host A and host B are on the same subnet with default gateway being SRX's trust interface, the two hosts are statically NAT'd to public IP addresses 1.2.3.1 and 1.2.3.2 respectively

     

    Now application needs that hostA talk to hostB -- via their public DNS names, aks their public IP addresses (split DNS is not yet implemented), would SRX be able to do that?

     

    Thanks,



  • 2.  RE: Traffic hair-pinning with static NAT

    Posted 12-09-2016 11:52

    You said "not yet" in there, so I'm guessing this would be "temporary" ...

     

    I'm not sure if the SRX will do it, but you could hack the setup by assigning 1.2.3.1 and 1.2.3.2 as secondary IPs on Host A and Host B so they'd talk to each other.



  • 3.  RE: Traffic hair-pinning with static NAT

    Posted 12-09-2016 12:31

    Thanks, that hack won't work for us,  hosts are actually empheral (one reason why split DNS implementation is not trivial), the NAT entries on SRX are configured programatically.



  • 4.  RE: Traffic hair-pinning with static NAT

    Posted 12-09-2016 12:58

    Well, in that case, why not D-NAT + S-NAT from the trusted zone to the trusted zone...

     

    Also, this:

    http://66.129.228.18/techpubs/en_US/junos15.1x49-d60/topics/concept/nat-hairpinning-overview.html

     



  • 5.  RE: Traffic hair-pinning with static NAT



  • 6.  RE: Traffic hair-pinning with static NAT
    Best Answer

    Posted 12-15-2016 14:43

    Since I have static NAT mapping for every host, I simply allowed intra-zone traffic in security policy and hairpining just worked!



  • 7.  RE: Traffic hair-pinning with static NAT

    Posted 12-10-2016 08:37

    As I understand you scenario, you will need to convert off of static nat and start using the combination of destination and source nat in order to accomplish the hairpin.  You should be able to do that programatically as well it will just be more configuration items.



  • 8.  RE: Traffic hair-pinning with static NAT

     
    Posted 12-10-2016 19:01

    Hello,

     

    Can you give me relevant configuration of the existing NAT on the device for Host A & Host B?

     

    I think there is a way to achieve this.

     

    Regards,

     

    Rushi



  • 9.  RE: Traffic hair-pinning with static NAT

     
    Posted 12-10-2016 19:11

    Hello,

     

    Logically speaking, this should work with configuration below:

     

    Part 1)  Add a context of zone trust (in addition to untrust) for the static NAT.

     

    root# show security nat static
    rule-set test {
    from zone [ trust untrust ];
    rule for-host-A {
    match {
    destination-address 1.2.3.1/32;
    }
    then {
    static-nat {
    prefix {
    192.168.0.1/32;
    }
    }
    }
    }
    rule to-host-B {
    match {
    destination-address 1.2.3.2/32;
    }
    then {
    static-nat {
    prefix {
    192.168.0.2/32;
    }
    }
    }
    }
    }

    [edit]
    root#

     

    Part 2) Configure source NAT interface for any source in 192.168.1.0/24 subnet going to public IPs of Host A & Host B so that direct communication between two hosts can be avoided for the reply traffic.

     

    root# show security nat source
    rule-set hair-pin-part-1 {
    from zone trust;
    to zone trust;
    rule hostA {
    match {
    source-address 192.168.1.0/24;
    destination-address 1.2.3.1/32;
    }
    then {
    source-nat {
    interface;
    }
    }
    }
    }
    rule-set hair-pin-part-2 {
    from zone trust;
    to zone trust;
    rule hostB {
    match {
    source-address 192.168.1.0/24;
    destination-address 1.2.3.2/32;
    }
    then {
    source-nat {
    interface;
    }
    }
    }
    }

     

    Let me know if you have any query.

     

    Regards,

     

    Rushi