SRX

 View Only
last person joined: yesterday 

Ask questions and share experiences about the SRX Series, vSRX, and cSRX.
Expand all | Collapse all

Juniper SRX300 Split DNS Proxy

  • 1.  Juniper SRX300 Split DNS Proxy

    Posted 20 days ago

    Hello! 

    I am trying to get split DNS working correctly.  My lookups to my domain work just fine but any other traffic is not going through my domain * forwarders. Also when I look at the cache for dns-proxy it shows that all the entries have an appended domain.com to them. For example test.com would show test.com.domain.com (domain being my internal domain name). Is there anything wrong with my attached proxy config? Or another part of the config I need to change to make this work?

    dns {
    max-cache-ttl 86400;
    max-ncache-ttl 600;
    dns-proxy {
    interface {
    ge-0/0/1.0;
    }
    view internal {
    match-clients 192.168.6.1/24;
    match-clients 10.6.100.1/24;
    match-clients 10.6.110.1/24;
    match-clients 10.6.120.1/24;
    match-clients 10.6.130.1/24;
    match-clients 10.6.160.1/24;
    match-clients 10.6.170.1/24;
    match-clients 10.6.190.1/24;
    domain domain.com {
    forwarders {
    192.168.1.24;
    192.168.3.24;
    }
    }
    domain * {
    forwarders {
    8.8.8.8;
    8.8.4.4;
    }
    }
    }
    }
    }


    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------


  • 2.  RE: Juniper SRX300 Split DNS Proxy

    Posted 20 days ago

    How are you doing the lookups?

    This may be a function of the DNS client.  In Windows, for example, try:

    nslookup google.com.

    instead of 

    nslookup google.com

    (i.e. with a period at the end)



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 3.  RE: Juniper SRX300 Split DNS Proxy

    Posted 20 days ago
    Edited by ZAKRIS SHMAGRANOFF 20 days ago

    Both of those options fail. Also when I run dig google.com from the juniper shell it fails. If I change my DNS proxy to the following it works (making it not split and just sending everything to my internal servers):

    dns {
    max-cache-ttl 86400;
    max-ncache-ttl 600;
    dns-proxy {
    interface {
    ge-0/0/1.0;
    }
    view internal {
    match-clients 192.168.6.1/24;
    match-clients 10.6.100.1/24;
    match-clients 10.6.110.1/24;
    match-clients 10.6.120.1/24;
    match-clients 10.6.130.1/24;
    match-clients 10.6.160.1/24;
    match-clients 10.6.170.1/24;
    match-clients 10.6.190.1/24;
    domain * {
    forwarders {
    192.168.1.24;
    192.168.3.24;
    }
    }
    }
    }
    }



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 4.  RE: Juniper SRX300 Split DNS Proxy

    Posted 20 days ago

    Hmmm ... I don't know ... it still seems to me that the DNS client is appending the domain it knows about.

    I've used split DNS like that before, but in my case instead of a view, I had default-domain domain.com and default-domain * and it worked just fine.

    You know, why not monitor the DNS queries to see if they're coming in with the domain appended. Something like this:

    monitor traffic interface ge-0/0/1.0 no-resolve detail matching "port 53"



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 5.  RE: Juniper SRX300 Split DNS Proxy

    Posted 20 days ago

    Good idea! The request does come with the domain name appended to it so the client must be doing something weird with DNS. Thanks for the tips!



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 6.  RE: Juniper SRX300 Split DNS Proxy

    Posted 20 days ago

    dns-proxy cache must be working properly for split dns to work correctly. Split dns will still work but not fully proper. For it to work properly the gateway address must be entered in the cache.

    Example

    c-xx-xxx-xxx-xxx.hsd1.ca.comcast.net inet 192.168.1.1;

    It must stick, if the address keeps disappearing then you must keep entering it till it stays entered.

    I deal with constant windows dns repairs("diagnose") to keep up with ipv6.

    If you have anything before the srx it must be operating properly. I mention this because im working as internal zone only. Not global. It's a problem. I have an approved common wireless gateway first. Xfinity.

    Perhaps other things might be problematic in all this, but this is key. Don't forget the forwards here.



    ------------------------------
    Adrian Aguinaga
    B.S.C.M. I.T.T. Tech
    (Construction Management)
    A.A.S. I.T.T. Tech
    (Drafting & Design)
    ------------------------------



  • 7.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Unfortunately still no luck. It seems that the Juniper is appending the domain.com to my lookups because if I try to run  dig example.com or dig example.com. if fails. If I run dig test.domain.com it works just fine. I also tried getting rid of the domain-name attribute that DHCP hands out and the lookup still fails. I also tried deleting the system domain-name domain.com setting on the juniper. Any other insights would be appreciated! Thanks



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 8.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Can you share some of what you've captured with "monitor traffic interface"? Did you try configuration without "view internal" ?



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 9.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago
    Edited by ZAKRIS SHMAGRANOFF 19 days ago

    Sure thing here are some of the logs I got from monitoring. On my client I ran nslookup example.com.. The captured traffic shows the raw lookup for example.com so that seemed to work just fine from the client however it never resolved. I ran that after cleaning the dns-proxy cache to make sure it was fresh as well. Lookups to my internal domain.com services still worked just fine. I have also tried it with the domain-default options instead of view and that still fails

    Monitored traffic: 

    18:05:45.908969  In IP (tos 0x0, ttl  64, id 11361, offset 0, flags [none], proto: UDP (17), length: 57) 10.6.120.3.33219 > 192.168.6.1.53:  2919+ A? example.com. (29)



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 10.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    The ServFail response you've included is for a request that you haven't included.

    You haven't included the response for the example.com request you've included.



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 11.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Whoops sorry I didn't mean to include that OUT response. There is no out response for that query in my monitoring it only shows the IN request.



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 12.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Okay ... can you capture several requests and responses??

    Also check "show security packet-drop records" for potentially dropped / rejected DNS traffic.



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 13.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Good idea with checking the packet drop records. It shows the following entries between my client and juniper DNS proxy address. Some sort of routing issue for the return traffic maybe?

    18:07:49.224371:LSYS-ID-00 192.168.6.1/53-->10.6.120.3/43262;udp,ipid-21005,.local..0,Dropped by FLOW:First path Pkt not syn
    18:07:49.222454:LSYS-ID-00 192.168.6.1/53-->10.6.120.3/55432;udp,ipid-21004,.local..0,Dropped by FLOW:First path Pkt not syn


    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 14.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Yeah, this will require closer examination of your overall config. If would be useful if you can sanitize it and post it.

    One pitfall that comes to mind is that the DNS proxy service on the SRX runs only in the main / default / master routing instance, and you should bind it only to an interface in that routing instance. Even then, though, you can use D-NAT send traffic from other routing instances to the default routing instance so the DNS request can be processed.

    If you don't have non-default routing instances configured, then check security zone configuration.



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 15.  RE: Juniper SRX300 Split DNS Proxy

    Posted 19 days ago

    Sounds good! I will go through the config again and see if I have any asymmetrical routing problems. I think that is the issue though. Thanks!



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 16.  RE: Juniper SRX300 Split DNS Proxy

    Posted 17 days ago

    I found the issue I believe! It seems that even though I have the interface selected as ge-0/0/1.0 in my dns-proxy config it is sending the requests out my st0.0 interface which is at 10.0.0.20. See the security flow below that shows this. Is that a Junos bug? In my other site where this dns-proxy works it sends the requests out the correct address specified by the interface in dns-proxy.

    Session ID: 90194319426, Policy name: self-traffic-policy/1, State: Stand-alone, Timeout: 4, Valid
    In: 10.0.0.20/58122 --> 8.8.8.8/53;udp, Conn Tag: 0x0, If: .local..0, Pkts: 1, Bytes: 71,
    Out: 8.8.8.8/53 --> EXTERNAL_PUBLIC_IP_HERE/23509;udp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 349,
    Session ID: 85899391940, Policy name: self-traffic-policy/1, State: Stand-alone, Timeout: 2, Valid
    In: 10.0.0.20/61488 --> 8.8.8.8/53;udp, Conn Tag: 0x0, If: .local..0, Pkts: 1, Bytes: 92,
    Out: 8.8.8.8/53 --> EXTERNAL_PUBLIC_IP_HERE/3959;udp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 308,
    Session ID: 85899402554, Policy name: self-traffic-policy/1, State: Stand-alone, Timeout: 2, Valid
    In: 10.0.0.20/49776 --> 8.8.8.8/53;udp, Conn Tag: 0x0, If: .local..0, Pkts: 1, Bytes: 68,
    Out: 8.8.8.8/53 --> EXTERNAL_PUBLIC_IP_HERE/4988;udp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 329,

     



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 17.  RE: Juniper SRX300 Split DNS Proxy

    Posted 17 days ago

    The interface you configure under "dns-proxy" specifies which interface is listening for DNS requests for clients, not which interface is used when sending requests to the configured forwarders. 

    Also, the session output you included shows the SRX is successfully reaching out to the forwarders, so that not the problem.

    Please provide a traffic capture (monitor traffic interface ge-0/0/1.0) of one or more complete request-and-response pairs illustrating the problem you're having.



    ------------------------------
    Nikolay Semov
    ------------------------------



  • 18.  RE: Juniper SRX300 Split DNS Proxy

    Posted 17 days ago

    Correct but why would my Juniper try to route via 10.0.0.20 in the first place? That is a static interface used for my VPN tunnels and doesn't even route to the outside internet. I need the juniper to use 192.168.20.1 as the source for the lookup since that address can access the external internet. Like I said before there is no traffic that comes back when I run the monitor command because the Juniper is dropping it on the way back because it is async from the original path. The flow should go like this: Client query sent to 192.168.20.1 > Juniper recognizes its an external domain > sends requests to 8.8.8.8 via 192.168.20.1 > requests follows the same path back.



    ------------------------------
    ZAKRIS SHMAGRANOFF
    ------------------------------



  • 19.  RE: Juniper SRX300 Split DNS Proxy

    Posted 17 days ago

    We're conflating multiple things here.

    -----------------------------

    Note this:

    Session ID: 85899391940, Policy name: self-traffic-policy/1, State: Stand-alone, Timeout: 2, Valid
    In: 10.0.0.20/61488 --> 8.8.8.8/53;udp, Conn Tag: 0x0, If: .local..0, Pkts: 1, Bytes: 92,
    Out: 8.8.8.8/53 --> EXTERNAL_PUBLIC_IP_HERE/3959;udp, Conn Tag: 0x0, If: ge-0/0/0.0, Pkts: 1, Bytes: 308,
    One packet sent out to 8.8.8.8, one packet received. Traffic from the SRX to the configured forwarder is fine (because of S-NAT covering 10.0.0.20), so 10.0.0.20 can access the internet just fine.
    For any particular self-originated traffic (which this falls under), unless there's a configuration statement to select a particular address, the SRX will use its default source address selection mechanism (in your case, perhaps 10.0.0.20 is the lowest IP address configured amongst all the interfaces). See https://www.juniper.net/documentation/us/en/software/junos/transport-ip/topics/topic-map/tcp-configure-features.html#id-configuring-junos-os-to-select-a-fixed-source-address-for-locally-generated-tcpip-packets
    --------------------------------
    As for the captured traffic, I'm still configured, because previously you had posted one reply that the SRX sent (it was a ServFail) without its request (but the request must have existed otherwise why would the SRX reply to nothing), and one request that the SRX received (but that was a separate query from a different client). So you were able to see both requests and replies in that traffic capture. Yes, I understand there's some traffic that gets dropped due to asymmetric routing, but you had captured requests and replies previously. Even if the response was being dropped, it would still be helpful to see what requests and response were, in pairs, as captured. I'm really confused as to why you edited that out. The reason I'm still looking for this is because you were getting different results based on the domain in the DNS query and I wanted to see how the clients are formatting their requests. This is to figure out why the response form the SRX was ServFail.
    ---------------------------------
    Lastly, yes, you're having some sort of asymmetric routing issue which seems to be preventing the response from the SRX from reaching client devices (regardless of whether the response was ServFail or not).  This will require closer examination of your overall config. If would be useful if you can sanitize it and post it.


    ------------------------------
    Nikolay Semov
    ------------------------------