Archive | September 2015

Mass import IP Subnets into Fortigate firewall

Recently, while working through an Office 365 Hybrid migration for a customer, we needed to bring the Exchange Online Protection IP address ranges into their firewall for policy changes.  Microsoft publishes this list here:  Unfortunately, I needed them in the following format:

config firewall address
edit ExchangeOnline-
set subnet

Thankfully, this was made much easier with using Word find/replace with the following syntax:
17-09-2015 7-06-44 a-m-
Find: (<*>).(<*>).(<*>).(<*>)/(<*>)
Replace: edit ExchangeOnline-\1.\2.\3.\4^lset subnet \1.\2.\3.\4/\5 ^lnext^l

Turns this:
17-09-2015 7-08-09 a-m-
Into this:
17-09-2015 7-07-56 a-m-
edit ExchangeOnline-
set subnet

Simply copy and paste into SSH, upload script, etc. and you’re sorted!

17-09-2015 7-08-33 a-m-