DNS/Domain Based Routing
-
Hello,
I am currently have 2 different ISP which ISP1 is for regular use and ISP2 offers free youtube access unlimited and also for fail-over.
I would like to implement all youtube traffic will be going to ISP2 and rest of traffic will be going to ISP1 in order to take the advantage of the offer.
How can I implement that since youtube server are all over the place and there are too many of them which I don't even know which server/IP I am connected to. I was think if there is a way for PFSENSE to know if this is a youtube traffic by detecting the DNS or such then can implement policy based routing to ISP2.
Thank you so much!
-
You may add an alias of type IP and add all youtube host names to it like "youtube.com", "www.youtube.com". Then use this alias in the firewall rule for policy routing.
Alternatively you can search for youtube IP addresses in the Web. You will find lists like this one: http://artica-proxy.com/youtube-tcpip-addresses-list
Copy the addresses into a text file, then import it into an alias. -
Thanks for the reply.
How can you add alias with wildcard? After analyzing youtube traffic, I realize that they have thousands subdomain under youtube.com as well as googlevideo.com. Each subdomains points to different IP. If I decide to create Alias then use the entire network CIDR to route, then it will affect the entire google service such as gmail, drive, and others.
What I really want to have route policy is just youtube server only.
For artica-proxy.com, the list of server is no longer valid.
Thank you
-
There is an alternative way.
First, you need build a custom kernel to enable multiple routing table.
http://wiki.stocksy.co.uk/wiki/Multiple_default_routes_in_FreeBSD_without_BGP_or_similar
Then use DNS forwarder (dnsmasq), which provide a nice feature called ipset. It will add the resolved IPs from matching hostname to a pf table. You also need to manually edit /etc/inc/filter.inc, to add a custom pf rule, which force IPs listed in a pf table go through a route other than the default WAN.