Sublime Text: Colour code network configuration

sublime-network-configuration-syntax-colour-code

I started off configuration using good old notepad and to be honest, it did the job so I never knew any better. Than I started scripting and started using notepad++ which really blew me as to how customizable it was.

Whenever I would be programming, I would enjoy the colour distinction inside code snippets. When I would come back to my network configuration, it would really bother me when I wasn’t able to distinguish things as well as I would like to. Reading through hundreds of lines of configuration on a traditional unicolour output can be pretty exhausting.

This is until I found Sublime text. Like notepad++, sublime text was geared towards programming but it had one cool feature that made it my number one configuration editing tool.

The ability to colour code configuration files based on vendor.

For example, look at the following juniper configuration snippet:

On a notepad, the above configuration snippet would look as dull as any network device configuration can get.

However, look below how it looks when pasted in sublime text:

I bet you can’t help but appreciate the turn around. This tool can be a life saver as you can spot errors in your configuration you previously might have missed.

However, sublime doesn’t come packed with this cool feature by default. You have to download the correct plugin to achieve networking nirvana!

Allow me to show you how this is done.

Sublime plugins:

Simply go to Tools > Command Palette.

 

Search for install Package and choose Package Control: Install Package. This would give you access to packages not available in the local library.

 

 

Go to Tools > Command Palette again.

 

 

Search for Junos and install the junos syntax package.

 

 

Select junos from the syntax in the bottom right and off you go!

 

 

You can also look for Cisco’s package but in my experience it isn’t as great as the junos package. However, it does highlight the no keyword really well which can help you avoid deleting configuration by mistake.

Got questions? Leave a comment! Let’s chat.

Rafay Rasool is a Network Specialist with over 8 years of experience designing, configuring and implementing core network solutions based predominantly but not limited to Juniper Routers, Switches and Firewalls along with other vendors such as Cisco, Huawei, Siemens, Aerohive, Ringmaster, Pulse etc for Internet Service Provider and Enterprise Networks.

Rafay is an avid supporter of network automation and likes to code and automate networking solutions.