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.

[edit]
root@J200# set system static-host-mapping gw1 inet 100.100.100.71 

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

root@J200> ping gw1 count 1    
PING gw1 (100.100.100.71): 56 data bytes
64 bytes from 100.100.100.71: 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

Worked for more than 10 years as a Network/Support Engineer and also interested in Python, Linux, Security and SD-WAN // JNCIE-SEC #223 / RHCE / PCNSE


You have a feedback?

Discover more from RtoDto.net

Subscribe now to keep reading and get access to the full archive.

Continue reading