Linux routing help needed

thehuman

Expert Member
Joined
Nov 2, 2004
Messages
4,406
Reaction score
1,174
Location
PE
Running debian "Sarge"
Can dial “saix” and “is” at same time but would like to know how to use route to direct local to is and international to saix
I already have the list of local subnets courtesy of ant1b0dy(if it is okay to use)

I like routesentry, but I cant dial my account on all the pc’s I have here only allowed 2 concurrent connections

Thanks Conrad

Google is the answer just dont know where to begin
 
Do you mind posting the subnets so I can have a bash at it?

You going to use the route command and just add routes really. Something like route -net 196.0.0.0 , but I also have to read the man to figure the right path :)
 
do you dial SAIX and IS over the same ADSL line? If so, how do you do that?
 
To get an updated route list, and assuming you have netcat installed:

echo -e "terminal length 0\nshow ip bgp\nexit" | nc route-server.is.co.za 23 | grep ^* | awk '{print $2}' > routes.txt

All the routes in routes.txt should be added to you IS adsl connection.

And the default route should be the SAIX connection

- twiga
 
Last edited:
Swordfish i have set my router in bridge mode and just setup two conections

here is a few subnets it is about 1% of all of them

i have figered out it must be policy routing but i realy dont know anything about it after 3 hours of googling i gave up for night

32.106.152.0,255.255.255.0
32.106.153.0,255.255.255.0
32.238.152.0,255.255.255.0
32.238.153.0,255.255.255.0
32.239.182.0,255.255.255.0

thanks to twiga i dont have to past all of them
 
Last edited:
thehuman said:
Running debian "Sarge"
Can dial “saix” and “is” at same time but would like to know how to use route to direct local to is and international to saix
I already have the list of local subnets courtesy of ant1b0dy(if it is okay to use)

I like routesentry, but I cant dial my account on all the pc’s I have here only allowed 2 concurrent connections

Thanks Conrad

Google is the answer just dont know where to begin


I know for a fact other forum members have managed to configure linux to do exactly what you're trying to do so hopefully one of them reads your thread and helps out. :)

Another possible solution is to only have one of your windows PC connect using routesentry and run a proxy server app on it. Your other PCs would then connect to the net via this proxy. You could possibly use my free ddproxy for this.
 
If your route file is in the format:

32.106.152.0,255.255.255.0
32.106.153.0,255.255.255.0
.
.
.

Then the following command will add all the routes to your IS ip.

for i in `cat routefile.txt`; do `route add -net `echo $i | sed s/\,/\ netmask\ /g` gw ISIP` ;done

Replace "ISIP" with the IP from your ppp0 device, you could also use dev ppp0 instead of gatewaing.

After this is done, add the default route to your SAIX IP.

Hope it makes sense.

- twiga
 
heya,

Just setup something similar on my machine at home. The command (if i remember correctly) is something like this

route add -net 196.0.0.0 subnet 255.0.0.0 dev ppp0 metric 1
route add default dev ppp1 metric 0

assuming your ppp0 is local (IS) and ppp1 is int (SAIX)

let me know if that works, otherwise ill post the proper commands once i get home.

also, what firewall/NATing are you using ? you might also need to add the new pppoe interface to ur firewall script for the NATing to work properly.

regards

EDIT: twiga beat me to it, but posted the alternative to gatewaying.....let the routing begin
 
Last edited:
Got the same setup at home, but I'm not there now so I can just give you some vague help from memory :)

What I did is edit my etc/ppp/ip-up file and put in something like this:

Code:
case $IP in
	196.*)
#route local		
		route add -net x.x.x.x/x dev $PPP
		...
		...
		
		;;
	165.*)
#international is default route
		route add default gw dev $PPP
		;;
esac

(again, that's from memory so some syntax could be wrong)

Basically you check the first octet of your public IP and set the routing accordingly.
 
The problem with just checking just 165/8 and 196/8 is that it isn't just local. eg:

# whois 196.0.0.0
% This is the AfriNIC Whois server.
% Note: this output has been filtered.
% Information related to '196.0.0.0 - 196.0.255.255'

inetnum: 196.0.0.0 - 196.0.255.255
netname: UGANDA-TELECOM-01
descr: Uganda Telecom
country: UG
org: ORG-UTL1-AFRINIC
admin-c: RM2-AFRINIC
tech-c: RM2-AFRINIC
status: ALLOCATED PA
mnt-by: RM2-MNT
mnt-lower: RM2-MNT
source: AFRINIC # Filtered
parent: 196.0.0.0 - 196.255.255.255

or
# whois 165.1.0.0

OrgName: Associated Press
OrgID: ASSOCI-10
Address: 50 Rockefeller Plaza
City: NY
StateProv: NY
PostalCode: 10020
Country: US

- twiga
 
Yes, that was just an example. I pulled the routing tables from route-server.is.co.za. The 196.* and 165.* are the IP's assigned to you from SAIX(165) or IS (196).

Edit: Maybe I should clear that up.

/etc/ppp/ip-up is a script that is executed when you establish a PPPoE connection on debian. The $IP bit is the IP that is provided by the ISP and the $PPP is the name of the connection (ppp0, ppp1 etc.)

Doing it that way allows me to "pon saix" or "pon is" and let the OS worry about the routing.
 
Last edited:
b3dlam said:
heya,
...

also, what firewall/NATing are you using ? you might also need to add the new pppoe interface to ur firewall script for the NATing to work properly.


using shorewall and webmin's bandwidth monotoring module that will most prob also be a problem will try it 2 night

thanks for help so far
 
thanks thehuman, I didn't realise you can authenticate twice over the same physical connection
 
Nearly there

90 % there
in
for i in `cat ../localroutes.dat`; do
# echo ``route add -net `echo $i | sed s/\,/\ netmask\ /g` gw $1 `` ; #1
`route add -net `echo $i | sed s/\,/\ netmask\ /g` gw $1 ` ; #2
done

#1 give me this
route add -net 32.106.152.0 netmask 255.255.255.0 ppp0

but #2 gives me this error

bash: ppp0: command not found
Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject
inet_route [-FC] flush NOT supported
32.106.152.0 netmask 255.255.255.0

repruduced it by using this

`route add -net `echo "32.106.152.0,255.255.255.0" | sed s/\,/\ netmask\ /g` ppp0 `

but if i
echo ``route add -net `echo "32.106.152.0,255.255.255.0" | sed s/\,/\ netmask\ /g` ppp0 ``

then i get this output

route add -net 32.106.152.0 netmask 255.255.255.0 ppp0

Thanks for help so far
Conrad

Only problem my is is not yet softcapped
 
Last edited:
$1 must be replaced with the IP address of ppp0 and not the string "ppp0". If you want the script as is, replace gw with dev. Else, pass the IP to the script and not ppp0.

- twiga
 
Top
Sign up to the MyBroadband newsletter
X