Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Howto] moving between 2 wlans automaticly - dhcpcd example
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Sun Jul 15, 2012 1:38 pm    Post subject: [Howto] moving between 2 wlans automaticly - dhcpcd example Reply with quote

If you don't like the extra effort to handle wicd or networkmanager, take the newest
~ net-misc/dhcpcd-5.5.6
+ net-wireless/wpa_supplicant-1.0

as an expample
/etc/wpa_supplicant/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
network={
   ssid="amyssid"
   bssid=00:16:B6:C0:DE:8A
   scan_ssid=1
   mode=0
   frequency=2427
   proto=RSN
   key_mgmt=WPA-PSK
   pairwise=CCMP TKIP
   group=CCMP TKIP
   psk="YOURpasswordA"
   priority=1
}
network={
   ssid="bmyssid"
   bssid=00:22:75:EA:ED:ED
   scan_ssid=1
   mode=0
   frequency=2452
   proto=RSN
   key_mgmt=WPA-PSK
   pairwise=CCMP TKIP
   group=CCMP TKIP
   psk="YOURpasswordB"
   priority=2
}

The following has deep sequence semantics
/etc/dhcpcd.conf
Code:

hostname
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
nohook lookup-hostname
noipv4ll
#
# following the sequence is important
interface wlan0
ssid amyssid
static ip_address=192.168.1.88
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
release
ssid bmyssid
static ip_address=192.168.2.88
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
release
You probably can comment out these static:
static ip_address=192.168.2.88

/etc/conf.d/net.wlan0
Code:
template="interface"
rc_need="wpa_supplicant"
rc_need="dhcpcd"
description="wlan interface"

If You like google dns:
/etc/resolv.conf.head
Code:
nameserver 8.8.8.8
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Jul 15, 2012 2:47 pm    Post subject: Reply with quote

ulenrich ...

I'm having difficulty seeing what your trying to achieve here. Firstly, you can currently set 'priority' with wpa_supplicant-0.7.3 and secondly the DHCP options do nothing that can't be achieved via config_SSID, config_001122334455, etc.

Also, staticly defined IP/route/DNS via DHCP would seem to make DHCP unnecessary. So, I'm finding this all very mysterious, but perhaps I'm missing something.

best ... khay
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Sun Jul 15, 2012 3:18 pm    Post subject: Reply with quote

My goal was to be able to move between two wlan nets with my notebook. This I was able to achive by just using the priority in the wpa_supplicant.conf some time ago. Then after some updates this feature was lost. But I don't know exactly which update, because I do not use the second wlan every week. Using this easy config I was reenabling the feature.

What astonished me, how dependend the sequence in /etc/dhcpcd.conf this is.

Also I want to route some ports to my notebook:
You can use the dhcpcd package as if without dhcp-feature.
This is very neat as the Gentoo conf.d/net syntax is a little obscure to me ...

If you look at discussions in bugs of openrc the Gentoo net features do not seem stable to me.
But dhcpcd~unstable works stable for me!

@khayyam, do you think your example is easily understood? I think using dhcpcd methods with static ip is most easy.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Jul 15, 2012 5:16 pm    Post subject: Reply with quote

ulenrich wrote:
My goal was to be able to move between two wlan nets with my notebook. This I was able to achive by just using the priority in the wpa_supplicant.conf some time ago. Then after some updates this feature was lost. But I don't know exactly which update, because I do not use the second wlan every week. Using this easy config I was reenabling the feature.

ulenrich ... I don't know why in your case it doesn't work, but I am able to do this with 0.7.3-r5. The only thing I could think of that may be different is perhaps you use dbus, which I don't, and have USE="-dbus".

ulenrich wrote:
What astonished me, how dependend the sequence in /etc/dhcpcd.conf this is.

I really don't follow you, dhcp is subsequent to association and so subsequent to the 'priority' of any given network.

ulenrich wrote:
Also I want to route some ports to my notebook: You can use the dhcpcd package as if without dhcp-feature.
This is very neat as the Gentoo conf.d/net syntax is a little obscure to me ...

In your example above the only difference between the standard dhcpcd.conf and the one provided is the static IP/route/DNS, given that DHCP provides IP, route, DNS, NIS, NTP what else do you think your aquiring from its use?

I don't think conf.d/net is really that complex, like anything it requires some study, but its not exactly archaen. Being 'shell' its flexable enough to support functions, etc, but for most purposes three or so variables are all thats needed for a given interface or equivilant (_SID or _MAC) to be configured.

ulenrich wrote:
If you look at discussions in bugs of openrc the Gentoo net features do not seem stable to me. But dhcpcd~unstable works stable for me!

OK, but I still don't understand how you think it works. As for openrc, I don't know what bugs your reffering to (openrc is bigger than net.${IFACE}) and if I consider just the problems reported here relating to networking then most of them come from those using NetworkManager/wicd. In my own experience then openrc is stable, but there are other factors to take into consideration WRT networking, such as drivers, kernel configuration, firmware, etc.

ulenrich wrote:
@khayyam, do you think your example is easily understood? I think using dhcpcd methods with static ip is most easy.

Is this a trick question ... easily understood by whom? If the "user" is a cloud of abstraction then obviously its easy to reduce to a very uncertain level of comprehension, but such a leveling doesn't refer to actual use (the only place where the term "user" makes sense). So, yes, my example (and I assume you mean the example I provided in another thread) is comprehensible, but thats no guarentee of understanding. Not to argue over our respective knowledge but from where I sit I simply don't get what it is that your "dhcpcd methods with static ip" is, and how it works in regard to "switching between wlans", and in that regard can't credit it as "easy".

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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