You are not logged in.
In my lan I have two subnets. The first subnet has working Wifi, which I connect to with the card (wlan0). But for my hard wired connection (eth0) I use another router (where dhcp does not work).
Router A IP: 192.168.1.1
Router B IP: 192.168.1.129
How would I set the gateway for wlan0 to 192.168.1.1 and for eth0 set it to 192.168.1.129? I don't want to use dhcp because it's slow and I want my old laptop to boot as quick as possible.
Last edited by jordanwb (2008-08-06 21:32:24)
Offline
Hello!
To solve this you have to "associate" each gateway with a specific IP:
route add <your ip> mask 255.255.255.0 <router id>
so for example in your case for router A:
route add 192.168.1.3 mask 255.255.255.0 192.168.1.1
and for router B:
route add 192.168.1.133 mask 255.255.255.0 192.168.1.129
(I`m not quite sure about the netmasks in your case ...)
So as you now try to send sth with the IP 192.168.1.133 it will be forwarded to router B, so you have to assign this static IP to your interface (for example per ifconfig) and another static IP to the other interface
Top_se
Offline
Hello!
To solve this you have to "associate" each gateway with a specific IP:
route add <your ip> mask 255.255.255.0 <router id>
so for example in your case for router A:
route add 192.168.1.3 mask 255.255.255.0 192.168.1.1
and for router B:
route add 192.168.1.133 mask 255.255.255.0 192.168.1.129
Okay so do I put that in /etc/rc.conf?
(I`m not quite sure about the netmasks in your case ...)
In my lan I have two subnets.
That would make it 255.255.255.128
Offline
Okay, I have to admit, I was wrong, I tested the stuff I have posted and I came to the concluse they were just false.
My new advice is:
$ route add default gw 192.168.1.1 dev wlan0
$ route add default gw 192.168.1.129 dev eth0
assuming router a is for wifi and router b for ethernet
This ^^ inserted into /etc/rc.conf would look like this for example:
gateway_wlan0=(default gw 192.168.1.1 dev wlan0)
gateway_eth0=(default gw 192.168.1.129 dev eth0)
ROUTES=(gateway_wlan0 gateway_eth0)
But, my experience told me, that it`s not possible to setup any routes before the network connection isn`t established, which means you had to setup a valid network connection in your /etc/rc.conf before the script tries to setup the routes. (My conclusion might be just wrong, because it`s only my experience though ...)
E.g. I`m not able to setup a route for the dev eth0 if this interface isn`t working properly (e.g. no ethernet-cable plugged in -> no routes are added for this interface).
So my advice would be to write two different scripts for setting up your connections with the above line for each interface (route add ...) as the finishing line ...
btw, to look up your routes-table try:
$ netstat -nr
So, good luck, Top_se
Offline
Ok thanks it works.
Now sometimes I don't have my wifi card (wlan0) in the PCMCIA slot. Is there some way to configure Arch not to try to assign an IP to it if it doesn't exist? Also in this scenario if I plug in the wifi card how would I have Arch assign it an IP and try to connect?
Last edited by jordanwb (2008-08-07 19:52:27)
Offline