I wrote a script to do this for multiple websites for use with Network Manager's dispatcher service. See https://www.mankier.com/8/NetworkManager
#!/bin/bash
URL_LIST=("smtp.secureserver.net" "anothersite.com" "space-delimited.net")
GATEWAY="192.168.0.1"
IP_LIST=()
for url in $URL_LIST
do
ip=`dig +short $url`
IP_LIST+=("$ip")
done
for ips in $IP_LIST
do
ips=(`echo $ips | tr " " "\n"`)
for ip in $ips
do
ip route add $ip via $gateway
done
doneAdd in the URLs you need, save it as root in /etc/NetworkManager/dispatcher.d as whatever you want to call it and it will run after connecting to a network.