Expand all | Collapse all

static-host-mapping not working?

Jump to Best Answer
  • 1.  static-host-mapping not working?

    Posted 02-26-2019 08:00

    We have a domain,, whose DNS points to our WAN IP address. Our Juniper is then configured with NAT to send requests to our reverse proxy (Nginx).  Everything works great externally.  However, internally, we cannot access because of the way the NAT is set up.  I'm fairly new to the Juniper world, so instead of configuring a new NAT entry, I thought I'd just use the static-host-mapping method to point to the IP address:


    static-host-mapping { inet;


    But this does not work.  When I ping it internally (after flushing DNS), it still resolves to the WAN address.  What am I missing?

  • 2.  RE: static-host-mapping not working?
    Best Answer

    Posted 02-26-2019 08:23

    static-host-mapping is used to resolve SRX originated traffic. It has no effect on transit traffic which you are generating internally.

    You may add static entry in your PC's hosts file for your domain with internal IP address. Refer:

    Or if you are using static nat in SRX for your DNS, you may try dns doctoring:


  • 3.  RE: static-host-mapping not working?

    Posted 02-26-2019 08:41

    Thank you for the response. I'll look into DNS doctoring.  The goal was to simplify management as much as possible, so I don't really want to use the local hosts file and have to keep it synced on all PCs.  We are currently using DNS Forward Lookup zones, but I was hoping to manage all of this in one or two places (Nginx, Juniper).

  • 4.  RE: static-host-mapping not working?

    Posted 02-26-2019 11:50

    I think you are looking for the dns proxy functionality on the SRX:


    There you can define static "cache" entries besides your forwarders. Look at "DNS proxy cache configuration" on above URL.


    Let me know if you need a more specific example.

  • 5.  RE: static-host-mapping not working?

    Posted 02-27-2019 08:01

    I saw that you deleted your previous post. You were missing the interface on the dns-proxy configuration where the SRX should listen for DNS requests. Example which is copied directly from a working installation.


    This example forwards all requests for somedomain.local to and everything else to or

    Also remember to allow dns under host-inbound-services in your zone definition.


    user@fw# show system services dns dns-proxy
    interface {
    view internal {
        domain somedomain.local {
            forwarders {
        domain * {
            forwarders {
    user@fw# show security zones security-zone trust interfaces irb.10
    host-inbound-traffic {
        system-services {


  • 6.  RE: static-host-mapping not working?

    Posted 02-27-2019 08:20

    Thank you, I appreciate the extra effort.


    Since my original question was about why static-host-mapping doesn't work I accepted the answer from