# ifplugd observations

## turtles

I recently had to setup a old laptop as a backup webserver (long story ends with you can never have too many backups)

The laptop was a goto choice as it had Apache and other needed tools and was right there.

It has been running Gentoo for about 12 years and is reasonably up to date  :Smile: 

It was configured to use wicd to connect via wireless, now it got assigned a special static ip address on a lan. 

I quickly noticed that wicd was not good at reestablishing a wired lan when needed, so I decided to use using a configuration more typical for a server /etc/conf.d/net and ifplugd.

My 5 requirements are: 

[1]The wired lan is to automatically start on boot up (easy)

[2]Reestablish connection if the lan carrier is lost or reset (ifplugd)

[3]Never attempt any ipv6 addressing as there is none on the lan. (?)

[4]Never attempt to use a RFC3927 IPv4 Link-Local, AutoIP or IP4vLL addressing.(?)

[5]Have net.eth1 fail if a dhcp IPV4 address is not obtained.

[6]In the event of eth1 failure attempt wireless 4g wlan0 interface. (optional)(probably custom ifplugd.action ?)

I have a few observations, questions concerns about the process:

The documentation on how to implement ifplugd the 'Gentoo way' using /etc/conf.d/net  ifplugd is lacking. From the official Gentoo documentation located 

here

 *Quote:*   

> # Replace eth0 with the interface to be monitored
> 
> ifplugd_eth0="..."

  Is ambiguous, and implied something is needed between the quotes for ifplugd to work on the interface eth0. 

```
man ifplug
```

 Indicates no options are "required" however the documentation implies something needs to go in between the quotes of ifplugd_eth1="". The documentation should demonstrate a default ifplugd implementation in Gentoo.

I chose to go with the seeming redundant 

```
ifplugd_eth1="--iface=eth1"
```

It seems no package owns /etc/conf.d/net? 

```
equery belongs /etc/conf.d/net

 * Searching for /etc/conf.d/net ... 

```

, The file 

```
/etc/conf.d/net.example
```

 is full of comments saying  *Quote:*   

> # This file is obsolete.

 

Yet thehandbook still points us to this file, there is no example file that covers all the options.

```
#Wired lan for backup webserver

ifplugd_eth1="--iface=eth1"

modules="dhcp"

#The dhcp server is supposed to serve the same ip address

dhcp_eth1="release"

#Complains if this is not specified

config_eth1="dhcp"

#found this in a conf.d/net file generated by networkmanager

enable_ipv6_eth1="false"

#This may be whats needed

#config_eth1="dhcp !IPV4LL !IPV6"

```

ifplugd was not working when the cable got unplugged and plugged in again.

```
 ifplugd(eth1)[23116]: ifplugd 0.28 initializing.

ifplugd(eth1)[23116]: Using interface eth1/(removed) with driver <e100> (version: 3.5.24-k2-NAPI)

ifplugd(eth1)[23116]: Using interface eth1/(removed) with driver <e100> (version: 3.5.24-k2-NAPI)

 ifplugd(eth1)[23116]: Using detection mode: SIOCETHTOOL

 ifplugd(eth1)[23116]: Using detection mode: SIOCETHTOOL

ifplugd(eth1)[23116]: Initialization complete, link beat detected.

ifplugd(eth1)[23116]: Initialization complete, link beat detected.

 ifplugd(eth1)[23116]: Executing '/etc/ifplugd/ifplugd.action eth1 up'.

 ifplugd(eth1)[23116]: Executing '/etc/ifplugd/ifplugd.action eth1 up'.

 ifplugd(eth1)[23116]: Program execution failed, return value is 1.

 ifplugd(eth1)[23116]: Exiting.

```

I observed that 

```
-rw-r--r--   1 root root  1209 May 25 10:51 ifplugd.action
```

was not executable so I tried making the file executable and then it seems to work.

I don't know if thats a bug in the ebuild or what? 

Thoughts, ideas suggestions?

Cheers Turtles

----------

## charles17

I have given up using netplug/ifplugd and netifrc some time ago in favour of dhcpcd alone and created this wiki article.  It might not serve all complex demand that netifrc does but makes it easy for most installations of end user computers.

----------

## krinn

the documentation is in /usr/share/doc/netifrc-version/net.example.bz2

you need nothing for ifplugd support, you need to emerge it only.

----------

## turtles

 *charles17 wrote:*   

> I have given up using netplug/ifplugd and netifrc some time ago in favour of dhcpcd alone and created this wiki article.  It might not serve all complex demand that netifrc does but makes it easy for most installations of end user computers.

 

Wow interesting!

 *krinn wrote:*   

> the documentation is in /usr/share/doc/netifrc-version/net.example.bz2
> 
> you need nothing for ifplugd support, you need to emerge it only.

 

Krinn When I get really lost I use the equery belongs to see which package owns a file. I wonder why the equery belongs does not show the file /ets/conf.d/net owned by netifrc?

Just to check I emerged ifplugd on another Gentoo box and the file 

/etc/ifplugd/ifplugd.action was executable so the problem was somehow I removed the executable bit and that caused it not to work.

----------

## NeddySeagoon

turtles,

/etc/conf.d/net is no longer created for you.  A blank/missing file runs dhcpcd anyway.

/etc/conf.d/net is no longer provided by Gentoo, so it doesn't belong to anything.

----------

