www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

Route Specific URL to a different gateway

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message
sadnblueish



Joined: 24 Feb 2015
Posts: 14

PostPosted: Tue Feb 24, 2015 5:34 pm    Post subject: Route Specific URL to a different gateway Reply with quote

Hi,

I am using Netbalancer with 2 gateways. I also have a 3rd gateway with unfiltered internet access. Thats not currently added in my Netbalancer. My usual traffic should flow from 2 gateways already defined in Netbalancer while I want to force specific URLs (e.g., youtube.com) through 3rd gateway. Just to clarify again, I want to reroute specific URLs and not Destination IPs.

How can I do that? Appreciate help!

Regards,
Back to top
View user's profile Send private message
sadnblueish



Joined: 24 Feb 2015
Posts: 14

PostPosted: Mon Jun 22, 2015 4:44 pm    Post subject: Help Needed Reply with quote

Anyone?
Back to top
View user's profile Send private message
RCWielewski



Joined: 20 May 2015
Posts: 2

PostPosted: Tue Jun 23, 2015 2:50 pm    Post subject: Re: Route Specific URL to a different gateway Reply with quote

sadnblueish wrote:
Hi,

I am using Netbalancer with 2 gateways. I also have a 3rd gateway with unfiltered internet access. Thats not currently added in my Netbalancer. My usual traffic should flow from 2 gateways already defined in Netbalancer while I want to force specific URLs (e.g., youtube.com) through 3rd gateway. Just to clarify again, I want to reroute specific URLs and not Destination IPs.

How can I do that? Appreciate help!

Regards,


Try to add this gateway (or interface) in Netbalancer and create a rule with the protocol (layer 7) used to acccess the specific site and put the gateway in target gateway at the form... good luck
Back to top
View user's profile Send private message
RCWielewski



Joined: 20 May 2015
Posts: 2

PostPosted: Wed Jan 25, 2017 5:40 pm    Post subject: Specific route to facebook Reply with quote

Hello.

My data carrier (CLARO) does not charge for facebook, whatsapp and twiter data, so the logic is that access to these sites is done by the 4G connection.
I tried to create filters on the Net Balancer without success.
I decided to create the routes manually and as the access IPs change frequently the solution was to search for the IPs to create the correct routes.
I created a "script" to schedule it to run every 12 hours (time depends on each need).
Here's the example for facebook, whatsapp and twitter, I hope they're useful as an example (obviously they can be improved, but I'm a beginner in "linux script":

# Bash script: Routes-Cron

cd /tmp

## Facebook
whois -h whois.radb.net -- '-i origin AS32934' | awk '/^route:/ {print $2;}' | sort | uniq > facebook.routes
lines=`awk 'END {print NR}' facebook.routes`
i=1
while (( $i <= $lines ))
do
par="sed -n "$i"p facebook.routes"
$par > facebook.txt
ra=`cat facebook.txt`
route_add="ip route add "$ra" dev ppp0"
$route_add
i=$(( i+1 ))
done
## End for Facebook

## whatsapp
whois -h whois.radb.net -- '-i origin AS36351' | awk '/^route:/ {print $2;}' | sort | uniq > whatsapp.routes
lines=`awk 'END {print NR}' whatsapp.routes`
i=1
while (( $i <= $lines ))
do
par="sed -n "$i"p whatsapp.routes"
$par > whatsapp.txt
ra=`cat whatsapp.txt`
route_add="ip route add "$ra" dev ppp0"
$route_add
i=$(( i+1 ))
done
## End for whatsapp

## Twitter
whois -h whois.radb.net -- '-i origin AS13414' | awk '/^route:/ {print $2;}' | sort | uniq > twitter.routes
lines=`awk 'END {print NR}' twitter.routes`
i=1
while (( $i <= $lines ))
do
par="sed -n "$i"p twitter.routes"
$par > twitter.txt
ra=`cat twitter.txt`
route_add="ip route add "$ra" dev ppp0"
$route_add
i=$(( i+1 ))
done
## End for Twitrer
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group