You are not logged in.

#1 2007-04-21 17:59:25

OutOfPhase
Member
From: The Netherlands
Registered: 2007-03-13
Posts: 33

Persistent Network script?

One of the issues that most Linux distros, including Arch, have is that during the boot process, there is only one dhcp lease request issued from the init scripts. This poses a problem when:
- The user boots the computer and the router at the same time. As the router needs some time to initialize, when Arch boots and runs the network script, the dhcp lease request from the network script does not arrive at the router, because the router is still busy initializing, hence the network script fails, and there is no network connection.

I can imagine that the network connection also gets lost when:
- A subsequent dhcp lease request gets lost. Dhcp lease is not sustained.
- IP address collisions. Network communication is disrupted.
- Router goes offline and back upline and requires that all clients re-request a dhcp lease.

I have not investigated these cases, maybe someone can comfirm this?
Anywayz, in all these cases, a dhcp lease re-request fixes the problem, alas, this does not happen in the current situation.

The network script should persistently try to gain a dhcp lease, when there is no dhcp lease received as of yet, to prevent this behaviour. This is the case in Windows.
Maybe there is a common solution to this problem already?

Yes, I am aware of the fact that root can login and run '/etc/rc.d/network restart' to (re-)establish the network connection, but it's a hassle and root intervention should not be needed.

EDIT: This could be a dhcpcd issue.

Last edited by OutOfPhase (2007-04-21 18:04:09)

Offline

#2 2007-04-21 19:04:47

Mikko777
Member
From: Suomi, Finland
Registered: 2006-10-30
Posts: 837

Re: Persistent Network script?

Wohoo I know this one!

1st: Yes that does suck

2nd: Phrakture is coding new network scripts as we speak!

3rd: I use networkmanager meanwhile which seems to do what you ask. -Wiki for further details.

4th: Beer <3 Me ^^

Offline

#3 2007-04-21 19:41:00

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Persistent Network script?

Mikko777 wrote:

Wohoo I know this one!
2nd: Phrakture is coding new network scripts as we speak!

I thought it was Iphitus wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#4 2007-04-21 19:41:47

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: Persistent Network script?

don't reinvent the wheel: use ifplugd.
ifplugd waits for link events/link status from the network card, and takes action accordingly.
configure eth* in rc.conf, do not start them, and add ifplugd to daemons. all your problems vanish at once. I even use it for wireless, and this gives me a totally event driven, minimal, layered, async configuration for maximal ease of use:

/etc/rc.conf

lo="lo 127.0.0.1"
eth0="dhcp"
wlan0="dhcp"
INTERFACES=(lo)
daemons=( ... ifplugd wpa_supplicant ...)

/etc/ifplugd/ifplugd.conf

NET_IFS="eth0 wlan0"
ARGS="-fwI -u0 -d10"
ARGS_wlan0="-MwI -u5 -d5"

I won't detail the wpa_supplicant daemon script, as it's not relevant to your situation.

I always wondered why people bothered with baroque sequential (start A, an if it succeeded start b else do that and... etc...) solutions (like in gentoo, see the size of their net scripts!) when such layered async solutions are both easy, stable, and hassle-free (even supports roaming OOTB)

Last edited by lloeki (2007-04-21 19:56:11)


To know recursion, you must first know recursion.

Offline

#5 2007-04-24 11:16:15

OutOfPhase
Member
From: The Netherlands
Registered: 2007-03-13
Posts: 33

Re: Persistent Network script?

Thx, ifplugd works like a charm.

Offline

#6 2007-04-25 10:46:27

OutOfPhase
Member
From: The Netherlands
Registered: 2007-03-13
Posts: 33

Re: Persistent Network script?

I was mistaken, ifplugd doesn't cut it. ifplugd only reacts on cable plug/unplug events, but in my case the cable is plugged all the time. It is the router that does not send a response over the cable for a short amount of time during initialization.
Oh well, guess I'll have to wait for the new network scripts.

Offline

#7 2008-06-01 08:48:59

sylvain77
Member
Registered: 2007-09-25
Posts: 20

Re: Persistent Network script?

Is it possible to run /etc/rc.d/network restart as a normal user?

Offline

#8 2008-06-01 08:58:46

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Persistent Network script?

Have you tried using networkmanager ? That's what I use on my laptop


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#9 2008-06-01 09:18:57

sylvain77
Member
Registered: 2007-09-25
Posts: 20

Re: Persistent Network script?

The use of networkmanager solves the problem on my laptop.
However, I don't want to install it on my workstation if it is possible.

Offline

#10 2008-06-01 10:02:24

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: Persistent Network script?

Is it possible to run /etc/rc.d/network restart as a normal user?

yes, install sudo and with visudo, add a rule like

%network ALL=NOPASSWD: /etc/rc.d/network *

this way users in the network group can run

sudo /etc/rc.d/network restart

(or any other parameter, if you don't want that replace the * by 'restart') without a password (if you want them to type their password, remove the 'NOPASSWD:")


To know recursion, you must first know recursion.

Offline

#11 2008-06-01 10:10:36

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: Persistent Network script?

OutOfPhase,

ifplugd only reacts on cable plug/unplug events, but in my case the cable is plugged all the time

I don't see why it is irrelevant.

first, if the computer starts up before the router, a 'plugged' event will be raised when the router starts up, because for the NICs there's 'link' only when they're powered up at both ends. therefore for the started device NIC, having the cable always connected but with one device shut down is like having the cable unplugged.

second, if your problem is a delay, then try to adjust the -u parameter of ifplugd. it means that the link must be up for a given time in seconds before starting '/ect/ifplugd/ifplugd.action eth0 up'. see the man pages for details.

what's more you can integrate ifplugd with both /etc/rc.d/network and netcfg2. see a bug report by me for the first, and one of my posts here for the second.

Last edited by lloeki (2008-06-01 10:11:22)


To know recursion, you must first know recursion.

Offline

#12 2008-06-01 11:56:43

sylvain77
Member
Registered: 2007-09-25
Posts: 20

Re: Persistent Network script?

Thanks for the info.

Your proposed solution works like a charm.:D

Offline

#13 2008-06-03 20:31:15

madeye
Member
From: Denmark
Registered: 2006-07-19
Posts: 331
Website

Re: Persistent Network script?

lloeki wrote:

I won't detail the wpa_supplicant daemon script, as it's not relevant to your situation.

I don't want to hijack the thread, but I for one would be interested in the wpa_supplicant daemon script. I tried adding wpa_supplicant to the daemon line in /etc/rc.conf, but of course it tells me "File does not exist".

Until now the only way for me to start my wireless lan is to run the following commands as root

[root@workstation /] wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf 
[root@workstation /] dhclient wlan0

MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage

Offline

#14 2008-06-03 23:29:39

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: Persistent Network script?

if you use ifplugd, make it monitor wlan0 (see /etc/ifplugd/ifplugd.conf and read man pages) and modify /etc/ifplugd/ifplugd.action according to the bug report I made, the last step is useless.

as for the script, I lost it in some transition and am in the process of rebuilding it in a better way. I'll share it with pkgbuild and all.


To know recursion, you must first know recursion.

Offline

Board footer

Powered by FluxBB