You are not logged in.
Hey guys,
Basically I'm looking to configure my system to use Five Gateways/ IP ranges. Can I do this with rc.conf? Is there a way to specify which gateway each device goes through?
Thanks,
Kyle.
Offline
It's not easy, but it's possible.
Can you give us more information on the network topology?
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Why yes I can.
216.245.195.2 -> 216.245.195.6 is one range.
69.162.109.178 -> 69.162.109.182 is another.
Gateway is -1 at the start of the range, Broadcast is +1 at the end of the range.
Offline
A default gateway is just where your computer sends outgoing packets that are not destined for a configured network. You can only have one.
You can configure multiple IPs(networks) like this:
eth0="eth0 216.245.195.2 netmask 255.255.255.248.0 broadcast 216.245.195.7"
eth0_0="eth0:0 69.162.109.178 netmask 255.255.248.0 broadcast 69.162.109.183"
INTERFACES=(lo eth0 eth0_0)
Offline
This is the article you want:
http://lartc.org/howto/lartc.rpdb.multiple-links.html
iproute2 is in [core]
TheCox -> You have only have 1 default gateway per route table. Fortunately, Linux allows you to have multiple route tables.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I used this like a script, but it is not working. Can you see what is wrong?
#!/bin/bash
# interface
IF0=lo
IF1=wlan0
IF2=wlan1
# ips
IP1=192.168.1.5
IP2=192.168.6.9
# gateways
P1=192.168.1.1
P2=192.168.6.1
# ip network
P0_NET=0.0.0.0
P1_NET=192.168.1.0
P2_NET=192.168.6.0
# create routing tables
ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2
# main routing table
ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2
# default route preference
ip route add default via $P2
# routing rules
ip rule add from $IP1 table T1
ip rule add from $IP2 table T2
#ip route add $P0_NET dev $IF0 table T1
#ip route add $P2_NET dev $IF2 table T1
#ip route add 127.0.0.0/8 dev lo table T1
#ip route add $P0_NET dev $IF0 table T2
#ip route add $P1_NET dev $IF1 table T2
#ip route add 127.0.0.0/8 dev lo table T2
ip route add default scope global nexthop via $P2 dev $IF2 weight 1
###########################################################
After executing this, wlan0 is still default interface.
nestat -ar
192.168.1.0 * 255.255.255.255 UH 0 0 0 wlan0
192.168.6.0 * 255.255.255.255 UH 0 0 0 wlan1
192.168.6.0 * 255.255.255.0 U 0 0 0 wlan1
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
And no traffic is going trought wlan1.
Last edited by ammon (2010-11-30 21:32:51)
Offline
I think you need 'ip route replace' rather than 'ip route add' in your default route command.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline