Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[SRX] How to add static DNS mappings in SRX



Article ID: KB26800 KB Last Updated: 27 Jul 2020Version: 3.0

This article provides information on how to add static DNS mappings in SRX devices.



The requirement is to add static DNS mappings; for example, if you want, no DNS requests should be sent to a DNS server and it should automatically be resolved to an IP address (for example,



There are a couple ways to achieve this:

Add host to /etc/hosts file.

To add the static DNS mappings, modify the /etc/hosts file on the SRX device as follows:

  1. Go to the shell:

root@SRX> start shell
  1. Edit the /etc/hosts file via the VI editor:

root@SRX% vi /etc/hosts
  1. Press i to enter the insert mode and add the following entry:
  1. Type : wq to save the file.

Then, when you try to ping, the SRX device will automatically ping

root@SWITCH# run ping
PING ( 56 data bytes

Use static-host-mapping

Another method is to add an alias to an IP address using the static-host-mapping option:

root# set system static-host-mapping DPT inet
root# set system static-host-mapping DPT alias
root# commit

You can also add host-name to an IP address:

root# set system static-host-mapping inet
root# commit

root# run ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=57 time=31.675 ms
64 bytes from icmp_seq=1 ttl=57 time=31.133 ms
64 bytes from icmp_seq=2 ttl=57 time=31.152 ms
--- ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 31.133/31.320/31.675/0.251 ms

For more information, refer to static-host-mapping.


Modification History:

2020/07/27: Article reviewed for accuracy; no changes required; article valid and relevant


Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search