You are not logged in.

#51 2007-11-04 08:40:11

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: netcfg2 beta - Network profiles updated

iphitus wrote:

Neuro: If you don't do it before me, I'll separate out your automatic connection into another script and include that in the next tarball.

Sorry, I wasn't available lately. I think it would be best if you did the separation, because I think you know best how it should be separated. Although, if you lack the time, I may do that if you tell me exactly how you'd like it done.

Anyway, a new bug a new patch:
The resolv.conf wasn't changed upon connection. This is due to a nasty bash bug: When checking for string properties (empty, nonempty etc) use the double brackets [[ ]] instead of the sh-backwards compatible single brackeds [ ]. The "-R" value was always attached to DHCP_OPTIONS regardles of one's settings. It should work now.

diff -r netcfg-1.99.31/src/ethernet.subr netcfg-1.99.31.new/src/ethernet.subr
31c31
<         [ -z $DHCP_TIMEOUT ] && DHCP_TIMEOUT=10
---
>         [[ -z $DHCP_TIMEOUT ]] && DHCP_TIMEOUT=10
43c43
<             [ -n $DNS1 ] && DHCP_OPTIONS="-R $DHCP_OPTIONS"
---
>             [[ -n $DNS1 ]] && DHCP_OPTIONS="-R $DHCP_OPTIONS"

I don't know if this is the only place where such a coding bug appears, I don't have time to check right now.

Still, nice work.

Offline

#52 2007-11-04 09:09:57

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

Odd. I use single brackets throughout netcfg without problems, and there's no reason for them to not work... because they work smile

Additionally... I use different networks with different DNS setups on a daily basis... so I'd have noticed if my resolv.conf had not been updated. You sure you havn't defined DNS1?

James

Offline

#53 2007-11-04 09:48:35

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: netcfg2 beta - Network profiles updated

iphitus wrote:

Odd. I use single brackets throughout netcfg without problems, and there's no reason for them to not work... because they work smile

Additionally... I use different networks with different DNS setups on a daily basis... so I'd have noticed if my resolv.conf had not been updated. You sure you havn't defined DNS1?

James

Nah, it doesn't work. I added echo right under it... and it always displayed "-R". And no, I don't have DNS1 defined..

CONNECTION="wireless"
DESCRIPTION="Continuity WiFi AccessPoint"

INTERFACE=eth1
# DHCP Example
IP=dhcp
# Standard Wireless Settings
ESSID=Continuity
SECURITY=wpa-config # One of wep, wpa, wpa-config, none
# Scans to see if network is available before connecting (reccomended)
SCAN="YES"
# Time to wait to connect to a network. Default 15.
TIMEOUT=10

# Commands to run at various stages of configuration
PRE_UP=
POST_UP="mount /mnt/pub;"
PRE_DOWN="umount -l /mnt/pub"
POST_DOWN=""

Tip  Using the [[ ... ]] test construct, rather than [ ... ] can prevent many logic errors in scripts. For example, the &&, ||, <, and > operators work within a [[ ]] test, despite giving an error within a [ ] construct.

Offline

#54 2007-11-04 16:29:06

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: netcfg2 beta - Network profiles updated

This is all because [ is actually the test binary on your system, and [[ ]] are builtins for bash.  It's almost always easier to use [[ ]], as the result is usually what you expect.

Offline

#55 2007-11-04 20:17:41

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

Will fix smile Thanks for that one Neuro.

codemac wrote:

This is all because [ is actually the test binary on your system, and [[ ]] are builtins for bash.  It's almost always easier to use [[ ]], as the result is usually what you expect.

Ah, gotcha. I've always used [ because that's what' in the "test" manpage.

So there's no syntactical differences between the builtin and binary?

James

Last edited by iphitus (2007-11-04 20:18:20)

Offline

#56 2007-11-05 10:12:29

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

Neuro: Could you try hosting that automatic script patch somewhere, one line's throwing up an error and I think it's a copy paste/forum error.

grep: The -P option only supports a single pattern

Also... the script recognises ssids with spaces as two ssids rather than one. I'll tackle that and adopt your essid listing to wireless.subr as it might be useful for others.

Anyway, 1.99.32 is uploaded.
* Fixed aformentioned bugs regarding [.
* Added a DHCP_DEBUG option to help me debug an erratic issue i've been experiencing with dhcpcd.
* Added netcfg manpage.
* Uploaded wireless connection guide: http://wiki.archlinux.org/index.php/Network_Profiles

Anyone want to add to the testing matrix here? http://wiki.archlinux.org/index.php/Net … ts#Testing

James

Last edited by iphitus (2007-11-05 10:59:27)

Offline

#57 2007-11-05 21:37:34

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: netcfg2 beta - Network profiles updated

Iphitus , are you still looking for someone to test ppp with netcfg2 ?

Currently i use a no networkinterface profile for Umts connections and start ppp through Kppp, but starting it from a real netcfg2 profile would be neater and more consistent, and offcourse more KISS.

Last edited by Lone_Wolf (2007-11-05 21:38:07)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#58 2007-11-05 23:02:45

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

Lone_Wolf wrote:

Iphitus , are you still looking for someone to test ppp with netcfg2 ?

Currently i use a no networkinterface profile for Umts connections and start ppp through Kppp, but starting it from a real netcfg2 profile would be neater and more consistent, and offcourse more KISS.

This should just drop in, I have no idea how it'll go though.

http://src.iphitus.org/ppp.subr
http://src.iphitus.org/ppp.example

Put ppp.subr in /usr/lib/network and modify ppp.example as needed, it goes in /etc/network.d/ like other profiles.

For the moment, ignore the 'INTERFACE' variable, netcfg will complain if it isnt there -- I'll fix that next version.

James

Offline

#59 2007-11-06 01:00:02

MAC!EK
Member
Registered: 2005-09-27
Posts: 267

Re: netcfg2 beta - Network profiles updated

It would be nice if bash completion for netcfg -d <TAB> would work smile
Without any option works.

EDIT:
sorry, my mistake smile I thought that bash_completion is supported, but I was only in /etc/network.d thats why I got bash completion. ;]

Last edited by MAC!EK (2007-11-06 01:02:14)

Offline

#60 2007-11-06 01:36:34

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

ill look into a tab completion, that'd be useful!

Offline

#61 2007-11-10 00:32:12

MAC!EK
Member
Registered: 2005-09-27
Posts: 267

Re: netcfg2 beta - Network profiles updated

On wiki http://wiki.archlinux.org/index.php/Network_Profiles

or add it to the NET_PROFILES=() line in /etc/rc.conf for start on boot.

But /etc/rc.d/net-profiles uses $NETWORKS variable. Either wiki is wrong or the script.

PS. ipw3945 works well with WPA, tested on two networks

Last edited by MAC!EK (2007-11-10 00:33:21)

Offline

#62 2007-11-10 00:41:15

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

MAC!EK wrote:

On wiki http://wiki.archlinux.org/index.php/Network_Profiles

or add it to the NET_PROFILES=() line in /etc/rc.conf for start on boot.

But /etc/rc.d/net-profiles uses $NETWORKS variable. Either wiki is wrong or the script.

PS. ipw3945 works well with WPA, tested on two networks

thanks for that, typo on the wiki side smile. Thanks for the testing also!

netcfg v2.0.0 is now in [testing] formatting fixed, and the space issue fixed up.

James

Offline

#63 2007-11-12 20:15:25

MAC!EK
Member
Registered: 2005-09-27
Posts: 267

Re: netcfg2 beta - Network profiles updated

Hello again smile

I'm often using two different wifi networks, these are the profiles:
"home" profile

CONNECTION="wireless"
DESCRIPTION="home Wifi"
INTERFACE=wlan0
SCAN="yes"
SECURITY="wpa"
ESSID="home_essid"
KEY="home_key"
IP="dhcp"
TIMEOUT=20

"away" profile

CONNECTION="wireless"
DESCRIPTION="away WiFi"
INTERFACE=wlan0
SCAN="yes"
SECURITY="wep"
ESSID="dlink"
KEY="away_key"
IP="dhcp"
TIMEOUT=20

The problem is that when I use "home" profile, then suspend my notebook, go to the area where using "away" profile. I try to connect to "away" network like this:
netcfg -a
netcfg away

I get the error:
"Wireless association failed."
iwconfig shows that key is set, essid to, but the card is not asociated with any AP.
I'm using ipw3945.

PS.
in [testing] there's still v1.99.32-1 not v2.0.0

Offline

#64 2007-11-13 00:22:04

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

MAC!EK wrote:

Hello again :)
I get the error:
"Wireless association failed."
iwconfig shows that key is set, essid to, but the card is not asociated with any AP.
I'm using ipw3945.

Not sure. If the essid is set... it's up to the drivers to do the associating -- that's not the scripts' job. Possibly look at reloading the driver after suspend, or making sure the network is down before you suspend.

PS.
in [testing] there's still v1.99.32-1 not v2.0.0

probably for the better, v2.0.0 had an older issue re-opened. v2.0.1 should be in there tonight.

James

Offline

#65 2007-11-14 14:47:34

iggy
Member
From: Germany, L.E. - Leipzig
Registered: 2004-10-17
Posts: 367

Re: netcfg2 beta - Network profiles updated

hey hello!

i can connect with the netcfg2 script, it shows me [DONE].

but i can't ping or browse through the internet.

here is my profile:

CONNECTION="wireless"
DESCRIPTION="wlan @ uni"

INTERFACE=wlan0
HOSTNAME=laptop

# Interface Settings (use IFOPTS="dhcp" for DHCP)
#IFOPTS="192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
GATEWAY=

# DHCP Example
IFOPTS="dhcp"
#DHCP_TIMEOUT=20 # Default is 10.
#DHCP_OPTIONS="" # Extra arguments for dhcpcd

# DNS Settings (optional)
DOMAIN=localdomain
DNS1=
DNS2=
SEARCH=

# Standard Wireless Settings
ESSID="802.1X"
SECURITY="wpa-config" # One of wep, wpa, wpa-config, none
#KEY=""

# Scans to see if network is available before connecting (reccomended)
SCAN="YES"

# Time to wait to connect to a network. Default 15.
TIMEOUT=20

# Pass *custom* options to iwconfig. Usually not needed (optional)
IWOPTS="mode managed essid $ESSID channel 8"

# Any extra arguments for wpa_supplicant
WPA_OPTS="-Dwext"

# For SECURITY='wpa-config' only - filename of a wpa-supplicant config
WPA_CONF="/etc/wpa_supplicant.conf"

# Commands to run at various stages of configuration
PRE_UP=
POST_UP="echo 1 > /sys/devices/platform/asus-laptop/wlan"
PRE_DOWN=
POST_DOWN="echo 0 > /sys/devices/platform/asus-laptop/wlan"

the wpa_supplicant.conf is correct, with the old network-scripts i can connect without any problems.

driver: iwl3945

mfg iggy


sorry for my bad english smile

Offline

#66 2007-11-21 19:40:04

jinn
Member
From: Gothenburg
Registered: 2005-12-10
Posts: 506

Re: netcfg2 beta - Network profiles updated

Doesnt work for me with iwl3945 on wpa network:

CONNECTION="wireless"
INTERFACE=wlan0
SCAN="yes"
SECURITY="wpa"
ESSID="Atilla"
KEY="wpakeyhere.."
IP="dhcp"
TIMEOUT=20

@IGGY
Can you post your wpa-supplicant.conf.. I think I havent set mine correctly.. Just as an example I want to compare..

Last edited by jinn (2007-11-21 19:41:25)


The ultimate Archlinux release name: "I am your father"

Offline

#67 2007-11-21 21:02:38

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

iggy: try v2.0.1

jinn: umm. more info please, what does netcfg say. Also, if you're using a config like the one there, then you dont need a wpa_supplicant.conf.

Last edited by iphitus (2007-11-21 21:05:29)

Offline

#68 2007-11-22 00:32:06

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: netcfg2 beta - Network profiles updated

Thanks for this, iphitus... I've never used the built-in network features for my wireless so I'm new to the whole concept of text-based wired/wireless management.  That being said, I've been giving this a go and trying to figure out how things operate.  I would like to create a detailed wiki describing best practises, and other faq's.  For me, it has been difficult to figure out exactly what is and isn't necessary to run these scripts, but I'll do my best to explain my observations:

I'm using the iwl3945 drivers... and so far I've created a profile for my dhcp eth0 connection and my wpa1-tkip wlan0 connection, both of which work flawlessly individually.

But I have questions:

1. Assuming I want to use the NETWORKS array for all of my connections, is the 'network' daemon still required?  Is INTERFACES still required?  If neither are, should I just create a 'loopback' profile and add it to the NETWORKS array to manage the 'lo' device automatically?

2. Can netcfg2 be used in some way to connect to open/unsecured networks on the fly?  More specifically, can I connect to open networks without creating a detailed profile with the particular SSID for each open network I encounter?

3. If I bring up my wireless connection first and then later bring up my ethernet connection, both interfaces have their own IP.  If I then take down the wireless, I lose all Internet connectivity until I disable/re-enable the ethernet connection.  Is this by design or am I missing something here?

4. Is the manpage for ethernet missing?

5. The one thing I never liked about the 'network' daemon was that it would hang at boot if my eth0 wasn't available (unplugged).  Is there a best practise to avoid this?  Obviously my first question above may be the answer, but I thought I'd throw it out there.

If you, or anyone else can answer these questions I'll put together some thorough documentation.

Update1: Regarding question 3, ideally what I'd like to happen is for my wifi to go down when I plug in my ethernet cable and vice versa, rather than having both connections up at the same time.  Does this require something a bit more complex than what netcfg2 offers OOTB?

Last edited by thayer (2007-11-22 00:51:10)


thayer williams ~ cinderwick.ca

Offline

#69 2007-11-22 03:19:31

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: netcfg2 beta - Network profiles updated

I've taken the time to answer some my own questions... someone please correct me if any of this information is wrong, as it will eventually end up as a wiki:

1. netcfg2 is completely independent of the 'network' daemon, as well as the INTERFACES array and interface declarations.  My rc.conf is much slimmer now.

1.b I also notice that 'lo' is brought up despite the fact that it's blacklisted in INTERFACES and as a NETWORKS profile, so it must be managed automatically with the new scripts.

2. The following profile should connect to any unencrypted network without the need to specify an SSID (tested successfully with an open WEP AP):

CONNECTION="wireless"
DESCRIPTION="Generic connection for open networks"
INTERFACE=wlan0
SCAN="yes"
SECURITY="none"
ESSID="*"
IP="dhcp"

5. I figured out that if I background (@) the daemon it won't hang the boot process waiting for an IP (duh, I should've known this)


Lastly, I don't know if this expected behaviour for the beta, but in my case the net-profiles daemon is failing when halting my notebook.

Last edited by thayer (2007-11-22 06:05:55)


thayer williams ~ cinderwick.ca

Offline

#70 2007-11-22 10:05:41

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: netcfg2 beta - Network profiles updated

thayer wrote:

I've taken the time to answer some my own questions... someone please correct me if any of this information is wrong, as it will eventually end up as a wiki:

1. netcfg2 is completely independent of the 'network' daemon, as well as the INTERFACES array and interface declarations.  My rc.conf is much slimmer now.

I don't think netcfg2 really allows a cleaner rc.conf . It was already possible to use only the profiles with NET_PROFILES before,
instead of INTERFACES + ROUTES. At least since lo is always brought up.
netcfg2 only replaces the NET_PROFILES array with a very similar NETWORKS array. From rc.conf point of view, there is no difference.
I think the network profiles themselves are cleaner though.

1.b I also notice that 'lo' is brought up despite the fact that it's blacklisted in INTERFACES and as a NETWORKS profile, so it must be managed automatically with the new scripts.

No, it's the initscripts package which was updated, to have lo hardcoded. So lo was also removed from INTERFACES in rc.conf :
http://projects.archlinux.org/git/?p=in … 6b5c0a2dd7
You should probably have a rc.conf.pacnew.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#71 2007-11-22 10:18:42

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: netcfg2 beta - Network profiles updated

Quick success report: working fine here with rt2x00-cvs, wpa, static IP.

Profile:

CONNECTION="wireless"
DESCRIPTION="Home wireless net"
INTERFACE=wlan0
HOSTNAME=tk-i5ka
IP="static"
IFOPTS="10.12.62.99 netmask 255.255.255.0 broadcast 10.12.62.255"
GATEWAY="10.12.62.1"
ESSID=tk-on-net-100103
SECURITY=wpa-config # One of wep, wpa, wpa-config, none
SCAN="YES"
TIMEOUT=5
IWOPTS="rate 54M"
WPA_CONF=/etc/wpa_supplicant.conf

wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1

network={
        ssid="tk-on-net-100103"
        scan_ssid=1
        psk=YADDAYADDAYADDAYADDAYADDAYADDA
        priority=5
}

Also, one little niggle - the "complete" profile example is not quite complete - it does not include the IP variable.

Offline

#72 2007-11-22 12:23:32

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: netcfg2 beta - Network profiles updated

tomk wrote:

Quick success report: working fine here with rt2x00-cvs, wpa, static IP.

Also, one little niggle - the "complete" profile example is not quite complete - it does not include the IP variable.

Great to hear. Thanks for reporting that niggle, fixed in git

netcfg2 can allow a cleaner rc.conf. I found that the original netcfg wasn't really stable enough to let it loose with everything, nor was it documented much/if at all. So... while it was capable of replacing networking details in rc.conf... netcfg2 is more so.

On the point of "roaming" and connecting to networks ad-hoc... netcfg2 isnt designed to, and doesnt really make any attempts to do that. Most people will know in advance what networks they'll use, or will have a few they frequent, and for those, netcfg2 works great.

If you want roaming, the config files are simple and you could *easily* write a small script to generate them. Alternatively the functions used within netcfg2 are re-usable so you can source /usr/lib/network/wireless.subr and create your own automatic script. netcfg-wireless-auto is an example of what can be done (in contrib on git).

edit: There's also what thayer did here: http://bbs.archlinux.org/viewtopic.php? … 27#p301527

James

Last edited by iphitus (2007-11-22 12:41:45)

Offline

#73 2007-11-22 16:12:51

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: netcfg2 beta - Network profiles updated

shining wrote:

1.b I also notice that 'lo' is brought up despite the fact that it's blacklisted in INTERFACES and as a NETWORKS profile, so it must be managed automatically with the new scripts.

No, it's the initscripts package which was updated, to have lo hardcoded. So lo was also removed from INTERFACES in rc.conf :
http://projects.archlinux.org/git/?p=in … 6b5c0a2dd7
You should probably have a rc.conf.pacnew.

Ah ha, you're right, I missed that one somehow.

This is truly great stuff, I can finally give up my dependency on NetworkManager with confidence and not have to wrestle with Wicd to make it work.

A couple more questions:

Is it possible to specify an encrypted passkey without using wpa_supplicant.conf?

I notice that some people are using wpa_supplicant along with netcfg2... is this a requirement for some connections or just a complement, such as storing their key encrypted?


thayer williams ~ cinderwick.ca

Offline

Board footer

Powered by FluxBB