Having trouble to configure ifplugd to start automatically on boot

Hello, im new in openSuse and i had to do a work for my school. I need to configure and use ifplugd to detect cable if a cable is plugged and configure the network automatically. Ifplugd is doing it i read the man page but it doesnt really help me. I have ifplugd installed on my VM. But when i try to do ifplugd start nothing is happening. And when i do ifplugd -c to see if it’s running it say me ifplugd is not running. I dont know how to do to start ifplugd automatically on boot so he can detect if i plug a ethernet cable or not and then configure the network.

Thank you for your help and sorry for my bad english.

Hi, welcome

Appreciating you’re telling us this is a school project. Things work a bit differently than you assume. You don’t have to run ifplugd. What you’re looking for ( and this may have changed since the docs you’re having were writen ) is


knurpht@knurphtlaptop:~> sudo ifplugstatus 
enp4s0: link beat detected
lo: link beat detected
wlp3s0: unplugged
knurpht@knurphtlaptop:~> sudo ifplugstatus 
enp4s0: unplugged
lo: link beat detected
wlp3s0: unplugged
knurpht@knurphtlaptop:~> sudo ifplugstatus 
enp4s0: link beat detected
lo: link beat detected
wlp3s0: unplugged

This comes from my laptop, with Tumbleweed, but it should be the same on 13.2.

Thx for your answer. Yeah when i do sudo ifplugstatus i have:
eno16777736: unplugged (when the cable is unplugged)
lo: link beat detected

and when i plugged the cable i have:

eno16777736: link beat detected
lo: link beat detected

But my question was how to start ifplugd cause it’s like it isn’t running.When i plug the ethernet cable i cant connect to internet automatically and i had to do it manually with ifconfig eth0 192.168.xx.xxx but normally ifplugd must do it no? It detect if a ethernet device is plugged and if yes it configure the network for me( he do a ifup) and then im connected to the internet. With ifplugstatus i can just check if a cabble is plugged or not that’s not what i need to do:/ I need to configure the network automatically by using ifplugd who detect if i pluged or not a ethernet device and then configure it.

Well, now ifplugd is working well but not totaly. when i plugged a cable it detect it and it set the ifstatus to up when i plug the cable. and my network card is find (i can see it when i do ifconfig) but i dont have a configured ip etc for my network card and i want to know how i can do it. In the /etc/sysconfig/network/ifcg-eno1677736 for BOOTPROTO i have dhcp. but it seems that ifplugd dont do really a ifup . When i do it manualy the network card is configured totaly…

If someone can help me it will be nice!

I haven’t looked at ifplugd for many, many years and Linux architecture has changed a lot since.
IIRC ifplugd doesn’t have to be running all the time, but I don’t remember how it was invoked (maybe udev?)
As you’ve stated, the bottom line is that your system <should> automatically detect a working network connection at any time by default.

The problem with a wicked (traditional ifup/ifdown) is that regardless of the changed state of hardware, the <network interface> needs to be <manually> set (up or down).

If you want your machine to auto-configure and use the new network connection, AFAIK you have to use Network Manager instead of Wicked, and likely configured as a DHCP client to avoid possible IP address collisions.

TSU

Have you read the manpage for ifplugd yet?

man ifplugd
man ifplugd.conf

In particular, it might be necessary to configure /etc/ifplugd/ifplugd.conf to monitor/control the required network interface(s).

Hi, yes i read it. and i configured the ifplugd.conf. I will explain you how i did to make it work (but with some weakness). I find a README.initScript in /usr/share/doc/packages/ifplugd and this README tell me that now ifplugd is integrated with the network configuration scripts and i need just to put STARTMODE=ifplugd in the ifcfg-eth0 file. I test it and it work, when i plug the cable the i have the connection and when i unplug i lost the connection and if i do ifconfig i can still see my network card . BUT when i do manualy ifdown eth0 its the end i can’t anymore see my network card after i do ifconfig. It’s weird because ifplugd work with ifup and ifdown right? Im blocked i dont know why it behaves like it…

Based only on my observation and not on any hard technical reading (or discussion),

Generally speaking,
Network Manager seems to have a capacity to detect connections and act accordingly. This is why NM is highly recommended over traditional ifup/ifdown when using wireless. The relatively new Wicked implementation enables some additional functionality over “just” ifup/ifdown but can’t yet be relied upon to provide the full detection and automation NM provides.

As I mentioned in my prior post,
The network interface and how it’s managed should be considered separately from how your hardware detects and activates. It may help to activate ifplugd by way of the interface but I suspect that likely requires the interface to be in a state that would actively invoke ifplugd. A different state may change whether ifplugd is running… and remember also that ifplugd is only needed to <detect> the changed hardware status and IIRC is not required after detection (ie. an active connection).

Some may be wrong, but is based on what I remember when I looked at ifplugd years ago and on general assumptions and observation about NM and Wicked.

HTH,
TSU