You are not logged in.

#1 2009-02-20 14:37:15

stringchopper
Member
Registered: 2009-02-19
Posts: 38

automate various wireless connections on laptops, w/ & w/out wired

Here's a little background on my scenario:

At home, I use 10Mbps wired for home lan. This goes to an old cisco switch
and then up to an old cisco router.  The wired is on 172.16.0.0/16 network

I also use wireless at home, which "upstream" from my cisco router.  The
wireless router (linksys) connects to the cable modem.  It is on a different
network, 192.168.1.0/24.  I use WPA2 on the wireless, not WEP or WPA.

When at home, I sometimes want to be wired in to the 172.16.0.0 on eth0 but
I don't want default (internet) traffic to use the wired 10Mbps link.

When I'm out and about, I use public AP's for my wireless.  I'm currently
using wpa_supplicant, and with some luck, using wpa_cli, I can usually get
my wireless NIC to associate and authenticate with public AP's.

Now my question:
How can I automate the steps I take below to fit my needs?  These steps outlined
below are the steps I take at home.  Since eth0 (172.16.0.0/16) comes up
automatically, it gets automatically assigned as the default.  My simple
resolution has been to bring up wlan0, start wpa_supplicant, take down eth0
(to have it removed from the routing table), use dhcpcd for wlan0, which
assignes my wireless linksys as the default, then bring eth0 back up, which
gives me a route through eth0 to the home LAN, but doesn't assign the LAN
gateway as the default.

I have nothing configured here: /etc/network.d/examples and
my rc.conf shows no modules loading at boot...

MODULES=()

(is that weird?  everything seems to be working on my desktop, nvidia, etc,
and lsmod|sort shows a bunch of mods)


Here are other contents of rc.conf

eth0="dhcp"
INTERFACES=(eth0)

gateway="default gw 172.16.0.1"
ROUTES=(!gateway)
DAEMONS=(hal syslog-ng network netfs crond alsa cups)

I'm not sure what ROUTES=(!gateway) accomplishes? Does that just mean that
my route to 172.16.0.0 uses an outgoing interface instead of going out a
pre-defined gateway? ie, we assign the default gateway for all unknown
traffice, but for 172.16.0.0, just send it out eth0 (?)

Here is my routing table after booting up:

bash-3.2# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.0.0      *               255.255.0.0     U     0      0        0 eth0
default         172.16.0.1      0.0.0.0         UG    0      0        0 eth0

And this is what I do, manually - this works well, except it is not automated:

bash-3.2# ifconfig wlan0 up
bash-3.2# wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
bash-3.2# ifconfig eth0 down
bash-3.2# dhcpcd wlan0
bash-3.2# ifconfig eth0 up

And this is the route I end up with, (this routing table works very well for my needs at home).

bash-3.2# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
172.16.0.0      *               255.255.0.0     U     0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0

Regards,
Brian

Offline

Board footer

Powered by FluxBB