SRX Tips: Static Host Mapping

After a year of being away from SRX, I have noticed that I forgot the CLI command to set a static hostname to IP mapping. If you haven’t used this feature so far, it simply allows you to have a /etc/hosts file similar to what we have in Linux and here is how we set and use it.

root@J200# set system static-host-mapping gw1 inet 

root@J200# commit and-quit 
commit complete
Exiting configuration mode

root@J200> ping gw1 count 1    
PING gw1 ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=10.007 ms

--- gw1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 10.007/10.007/10.007/0.000 ms

As you can see, we can resolve hostname “gw1” we just created.

About: rtoodtoo

Genco has worked for more than 10 years as a Network/Support Engineer. He is also interested in Python, Linux, Security and SD-WAN, currently lives in the Netherlands and works as a Network Support Engineer at Tesla Inc. // JNCIE-SEC #223 / RHCE / PCNSE

You have a feedback?

This site uses Akismet to reduce spam. Learn how your comment data is processed.