Improved Network Wizard (and rc.network)

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Improved Network Wizard (and rc.network)

#1 Post by Dougal »

I've overhauled the way the network-wizard saves configurations, in
conjunction with re-writing rc.network, to make it more flexible and
be able to support both different HW (when running off USB drive) and
different locations (for laptops).

The only thing left is to test it...

(Note that you might want to use a special pup_save for it, or at least
backup the files that are overwritten: /etc/rc.d/rc.network,
/usr/sbin/net-setup.sh, /usr/sbin/wag-profiles.sh and
/usr/sbin/ndiswrappergui.sh )


Here's how it now works (you don't need to know this to use the wizard...):

Interface configuration
Interfaces have configuration files named after the HW address of the
network adapter, as seen in the output of ifconfig (eg. 00:10:60:BD:4A:D7).

This way we are not dependent on the interface name, which would most
likely be the same (eth0, wlan0) on different machines. (if the HWaddres
isn't unique enough, I can easily add the module name or something...)

- When every interface is configured, a config file is created:
/etc/network/interfaces/$HWADDRESS.conf
This file might be empty, or include some info, such as the details of
a static ip address (in case it was configured that way).

- In case of a wireless interface, another config file will be created:
/etc/wireless/interfaces/$HWADDRESS.conf
This file might include information like whether to use wlanctl-ng
instead of iwconfig/wpa_supplicant (in case of devices using the prism2
drivers), or which wpa_supplicant driver to use.

Both of these files are used as markers, to let us know that the interface
has actually been "configured" by the user -- so we don't try and use an
interface that the user doesn't want us to.


Network configuration
Unlike previously, the different "profiles" you save when configuring
wireless networks are not saved in the same file.
Now a directory (/etc/wireless/profiles) is used, with each profile having
its own config file, named after the MAC address and the type of encryption
used. For example:
/etc/wireless/profiles/00:1B:9E:6F:61:F6.WPA.conf

In case of WPA/WPA2, an appropriate wpa_supplicant.conf file is created
in /etc/wireless/wpa_profiles. Example:
/etc/wireless/wpa_profiles/00:1B:9E:6F:61:F6.WPA.conf

This way, at bootup, a wireless scan is performed and each detected network
is checked, to see if there is a profile matching it (and its encryption
mode!)

Note: this should mean that you can have profiles for your home router
in different modes, without them interfering with each other.

Now, if none of the detected networks matches an existing profile (or if
some do, but fail to connect), then an attempt will be made to connect
to each of the detected open networks, so theoretically you should be able
to just go somewhere and boot and it will connect you to something...


I have also added the option of giving priority to certain networks (i.e.
your home network) over the rest, but that isn't incorporated into the
guy yet...
What you need to do is add to the wireless config file (the one for the
interface, in /etc/wireless/interfaces!) a line such as:

Code: Select all

PRIORITY_LIST='00:1B:9E:6F:61:F6 00:0E:2E:7B:E5:D8'
Connecting to the addresses in the list will be attempted before all
others (assuming they were detected by the scan, of course...).


That's about it, at the moment.

There are some things I'm still not completely sure about, including some
other modifications I made to the wizard, which people might help me with:
- Tempestuous mentioned once that running "iwlist $INTERFACE ap" will
return a list of access-points with their signal quality (and listed by
decreasing signal strength).
Is the order the networks are listed "normally" (iwlist $INTERFACE scan)
the same (i.e. listed by decreasing signal strength)?

- I took some code from Wicd, which is used to "clean up" every time before
an interface is configured: dhcpcd killed, wpa_supplicant killed, routing
table flushed etc.
This kills all instances of dhcpcd every time. Is this safe to
do? Could a user run more than one instance of dhcpcd at once, connecting
via more than one interface?

- Do people ever use static ip addresses with wireless??

UPDATE July 21st: fix some bugs and updated the attachment.
UPDATE July 22nd: updated the attachment.
UPDATE july 23rd: a few fixes (see post on page 3)
UPDATE july 25th: modify wireless profiles dialog and add "connect" argument (see post on page 3)
UPDATE july 28th: a bunch of fixes and added a loop for bootup sleep (see page 4)
Last edited by Dougal on Sun 12 Apr 2009, 09:24, edited 33 times in total.

Arvi Pingus
Posts: 8
Joined: Fri 18 Jul 2008, 18:32
Location: Behind the dutch dunes

Re: Improved Network Wizard (and rc.network)

#2 Post by Arvi Pingus »

Dougal wrote:I've overhauled the way the network-wizard saves configurations, in
conjunction with re-writing rc.network, to make it more flexible and
be able to support both different HW (when running off USB drive) and
different locations (for laptops).

The only thing left is to test it...
How can one participate in testing?
(I am not a fan of tar.gz binary stuff. Like to install with the help of a packetmanager.)
Dougal wrote:Do people ever use static ip addresses with wireless??
Me, myself and I, including all members of my family on our home LAN.
Know where you are talking about instead of talking about what you know.

kirk
Posts: 1553
Joined: Fri 11 Nov 2005, 19:04
Location: florida

#3 Post by kirk »

Sounds great.

Works fine with my wide-open network. I'll try it next week on a wpa network.

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#4 Post by tempestuous »

Dougal, while you're overhauling the Network Wizard, what about this small enhancement -
http://www.murga-linux.com/puppy/viewto ... 545#208545
I think that the "Supplic" "Driver" "Hidden" labels are too technical. They refer to the underlying tecnology of wpa_supplicant, and are not useful to the user.

I believe those 3 options should instead be labelled:
"SSID broadcast" "Driver" "SSID Hidden"

... or since "Hidden" is the default setting, a more logical order would be:
"SSID Hidden" "SSID broadcast" "Driver"

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Re: Improved Network Wizard (and rc.network)

#5 Post by Dougal »

Arvi Pingus wrote:How can one participate in testing?
(I am not a fan of tar.gz binary stuff. Like to install with the help of a packetmanager.)
I didn't make into a dotpet intentionally, so people won't just download it and click to install, then, if they can't connect anymore, complain to me... since it doesn't back up the old files.
You can always just turn the tarball into a .pet by running in a terminal
"tgz2pet" on it.
Dougal wrote:Do people ever use static ip addresses with wireless??
Me, myself and I, including all members of my family on our home LAN.
Ok. It isn't supported at the moment, but shouldn't be hard to add.

The main problem I have with static ip is that it ties up the interface (well, at least with ethernet, I guess with wireless I can save it as part of the wireless network config).
What I mean is that if you configure your laptop ethernet to one network, then, trying to connect with it somewhere else, it will just try that static ip address, not trying dhcp.
Is there a way to find out if to use the static ip address? (like the address of the service provider?)
Could I test, via ping or something, if the static connection worked and if not -- try auto dhcp?
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#6 Post by Dougal »

tempestuous wrote:Dougal, while you're overhauling the Network Wizard, what about this small enhancement -
http://www.murga-linux.com/puppy/viewto ... 545#208545
I think that the "Supplic" "Driver" "Hidden" labels are too technical. They refer to the underlying tecnology of wpa_supplicant, and are not useful to the user.

I believe those 3 options should instead be labelled:
"SSID broadcast" "Driver" "SSID Hidden"

... or since "Hidden" is the default setting, a more logical order would be:
"SSID Hidden" "SSID broadcast" "Driver"
Sure.
I would have liked to do a proper overhaul of the wizard UI, using tooltips to cut down on the text and simplify things, but it seems like gtkdialog only supports tooltips when using glade, which I've never done (I'm also not sure it will be worth the effort -- at least not if we need to generate the glade files on-the-go, rather than just having a static one.
(I actually took the .glade file from wicd and run gtkdialog with it and it brought up a gui! the only question if we can use variables to fill in the parts that need filling in).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
paulh177
Posts: 975
Joined: Tue 22 Aug 2006, 20:41

#7 Post by paulh177 »

I was having problems with network setup persisting between reboots on my laptop, running Puppy4.1alpha4 (Lin'n'Win on WinXP SP3 VFAT).

Installed your update and that seems to have resolved.

paul

hanishkvc
Posts: 1
Joined: Sun 20 Jul 2008, 16:50

Working with Static IP configuration dynamically

#8 Post by hanishkvc »

Hi Dougal,

I noticed above that you have asked if there is a way to identify a static IP configuration uniquely with respect to its network so that when booting you can decide whether to apply that particular static ip configuration or force going for DHCP.

The solution
------------------
What I feel is if one captures/stores the MAC ID associated with the GATEWAY IP address of a static configuration. Then when booting or starting networking on a machine with Static IP configuration, it can be varified as to whether the system is still running on the SAME network or not by using ARP and based on that one can decide whether to apply that particular Static configuration on that run or switch to DHCP for that run.

Hope that helps.

Keep ;-)
HanishKVC

User avatar
prit1
Posts: 542
Joined: Fri 04 Jan 2008, 00:10
Location: Los Angeles

#9 Post by prit1 »

@Dougal:

I downloaded and installed the files provided. Tried running net-setup.sh and get the following error when saving the profile:

/usr/sbin/wag-profiles.sh: line 706: /etc/wireless/profiles/00: No such file or directory
[url=http://macpup.org][b]Macpup - The beauty of linux[/b][/url] [b] | [/b] [url=http://pritlog.com/][b]Pritlog - Simple blog app[/b][/url]

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#10 Post by Keef »

I'm using this with Fat Free 3.01 (frugal install) on a Dell 610 laptop with a NetgearWG111T.
I've found that it won't save a profile - if I try to save, the program closes.
The program seems to detect the wlan0 on alternate boots - but when it does detect it, it will connect to a network far quicker than previously. It has done it first time once I've entered the parameters. This could take several attempts before, so there is a definite improvement.

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

Re: Working with Static IP configuration dynamically

#11 Post by Dougal »

hanishkvc wrote:What I feel is if one captures/stores the MAC ID associated with the GATEWAY IP address of a static configuration. Then when booting or starting networking on a machine with Static IP configuration, it can be varified as to whether the system is still running on the SAME network or not by using ARP and based on that one can decide whether to apply that particular Static configuration on that run or switch to DHCP for that run.
Haa, but how do I do that... I really don't know much about networking.
A little code snippet is all I need.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#12 Post by Dougal »

prit1 wrote:I downloaded and installed the files provided. Tried running net-setup.sh and get the following error when saving the profile:

/usr/sbin/wag-profiles.sh: line 706: /etc/wireless/profiles/00: No such file or directory
Ok, I'll look into it.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#13 Post by Dougal »

Keef wrote:I'm using this with Fat Free 3.01 (frugal install) on a Dell 610 laptop with a NetgearWG111T.
I've found that it won't save a profile - if I try to save, the program closes.
Could you try tunning it from a terminal and see what kind of error message it give when closing? Just run "net-setup.sh -d".
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

nic2109
Posts: 405
Joined: Mon 01 Jan 2007, 20:24
Location: Hayslope, near Middlemarch, Midlands, England

#14 Post by nic2109 »

- Do people ever use static ip addresses with wireless??
Yes, I do.

This is because my household has 4 wireless laptops, one or two of which which run The Devil's Own Operating System. If 'Doze hibernates it (obviously) discards the lease on its I/P address but when it is woken up later it will try to re-lease the same address. If in the meantime one of the other devices has been auto-allocated the same address (because it was available) then there's a conflict straight away.

I can solve this in my Router by allocating a fixed I/P address to the MAC Address of each device and then use "Automatic" DHCP to get an address.

I imagine this scenario is not unique so I can see the need to retain the static address option for simialr situations but where changing router settings isn't possible.
Could a user run more than one instance of dhcpcd at once, connecting via more than one interface?
Yes, I do.

But I'd rather not! If you ever connect both wirelessly and wired, then you'll get both interfaces activated at bootup from then on. It's always struck me as a minor flaw that it does the second connection even if the first was successful.

It doesn't seem to "matter" until you want to switch mode; say you started wired but wish to move to working wirelessly. I haven't found how to cancel/disable/de-activate the first one you used and switch to the other without re-booting.

It's a small thing, but would add to the general friendliness of the experience.
[color=darkblue][b][size=150]Nick[/size][/b][/color]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#15 Post by Dougal »

I've updated the attachment in the parent post.
It should fix the bugs reported and enable support for static ip with wireless networks (the ip info is included in the network profile).
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
urban soul
Posts: 273
Joined: Wed 05 Mar 2008, 17:03
Location: "Killing a nerd is not as much fun as ist sounds" B.Simpson
Contact:

#16 Post by urban soul »

Hi, sounds great. - can you put the WPA driver specs into a separate config-file ? Otherwise every time a new driver is compiled by tempestuous the wizard itself has to be modified.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#17 Post by Keef »

Dougal,

When I run it from the command line I get:-
/usr/bin/net-setup.sh: line 1341: scanpci: command not found

When I try to save a profile I get:-
/usr/sbin/wag-profiles.sh: line 706: : No such file or directory


This was with the original version - I have since tried the new one, but could not get a connection (did not detect wlan0) even after several reboots. Now reverted to the first, and have got back on-line. No save though!

User avatar
prit1
Posts: 542
Joined: Fri 04 Jan 2008, 00:10
Location: Los Angeles

#18 Post by prit1 »

@Dougal:

I tried your latest version. This time, it created the network connection. This is better than the last time.

But when I rebooted, the network did not get enabled. I had to load the profile again, and run auto dhcp to get the network running. Tried rebooting once again with the same result.

Here is an error message I noticed when running net-setup.sh from the prompt.

Code: Select all

Failure (Operation not supported)
/usr/sbin/net-setup.sh: line 622: 4171 Terminated  gxmessage -center -bg "orange" -buttons "" -title "Puppy Network Wizard" "Configuring interface..."
Error, ra0: dhcpd not running
[url=http://macpup.org][b]Macpup - The beauty of linux[/b][/url] [b] | [/b] [url=http://pritlog.com/][b]Pritlog - Simple blog app[/b][/url]

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#19 Post by Dougal »

urban soul wrote:Hi, sounds great. - can you put the WPA driver specs into a separate config-file ? Otherwise every time a new driver is compiled by tempestuous the wizard itself has to be modified.
It would be easy to do, but I'm not sure worth it, since that will just have to be updated, just like the wizard, and it just makes things more scattered...
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

User avatar
Dougal
Posts: 2502
Joined: Wed 19 Oct 2005, 13:06
Location: Hell more grotesque than any medieval woodcut

#20 Post by Dougal »

Keef wrote:When I run it from the command line I get:-
/usr/bin/net-setup.sh: line 1341: scanpci: command not found
That means that Barry hasn't included scanpci in Dingo (which is part of the Xorg package).
When I try to save a profile I get:-
/usr/sbin/wag-profiles.sh: line 706: : No such file or directory
Ok, I'll have another look at it.
What's the ugliest part of your body?
Some say your nose
Some say your toes
But I think it's your mind

Post Reply