# ifplugd not doing it's job?[Unsolved, I gave up]

## JohnerH

Good Afternoon,

Well, as the titles suggests I'm having a bit of a problem with ifplugd, it simply doesn't swap the main connection from net.wlan0 to net.eth0 when the cable is pluged in.

Here's my /etc/conf.d/net,

```

config_wlan0=( "192.168.2.40 netmask 255.255.255.0" )

routes_wlan0=( "default gw 192.168.2.1" )

config_eth0=( "192.168.2.40 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.2.1" )

ifplugd_eth0="--api-mode=wlan"

wpa_supplicant_wlan0="-Dwext"

modules=( "wpa_supplicant" )

dns_servers_eth0=( "192.168.2.1" )

dns_servers_wlan0=( "192.168.2.1" )

```

Any ideas as to why?

Thank you in advance,

J

----------

## UberLord

ifplugd_eth0="--api-mode=wlan"

Remove that line

----------

## JohnerH

 *UberLord wrote:*   

> ifplugd_eth0="--api-mode=wlan"
> 
> Remove that line

 

Did that....no dice....

I'm baffled as to why...it's even a new system and all...

----------

## JohnerH

Any other ideas?

J

----------

## UberLord

You'll have to post the contents of your routing table as we "change" connection based on routing metrics as the if there are routes to the same place for different interfaces then the kernel will select the route with the lowest metric.

----------

## JohnerH

 *UberLord wrote:*   

> You'll have to post the contents of your routing table as we "change" connection based on routing metrics as the if there are routes to the same place for different interfaces then the kernel will select the route with the lowest metric.

 

Sorry for being such a noob, but how do I get that routing table?

----------

## UberLord

route -n

----------

## JohnerH

As requested,

```

HooK ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         192.168.2.1     0.0.0.0         UG    2000   0        0 wlan0 

```

Let me just take the chance and thank you for your patience in this....

----------

## UberLord

OK, now plug the cable in.

Then re-post the routing table after say 1 minute of plugging the cable in.

----------

## JohnerH

It's still the same result as above nothing's changed, the only way it changes is if I do,

```

HooK~#/etc/init.d/net.wlan0 stop ; /etc/init.d/net.eth0 start

```

Then, the cable is the interface that starts getting used.

----------

## UberLord

That tells me that ifplugd is not finding the cable in/out events. Maybe the driver is faulty?

Look at this bug. https://bugs.gentoo.org/show_bug.cgi?id=166438

----------

## JohnerH

 *UberLord wrote:*   

> That tells me that ifplugd is not finding the cable in/out events. Maybe the driver is faulty?
> 
> Look at this bug. https://bugs.gentoo.org/show_bug.cgi?id=166438

 

They're talking about the e100 card, I'm running a 3Com card? You think I should post my output to that bug report as well?

----------

## UberLord

Well, it may now be an ifplugd problem as that bug just got updated.

I would create a new one though.

----------

## JohnerH

Before I do that...

Look what my messages say...

```

May  3 17:56:38 HooK eth0:  setting full-duplex.

May  3 17:56:38 HooK ifplugd(eth0)[4677]: Link beat detected.

May  3 17:56:39 HooK ifplugd(eth0)[4677]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.

May  3 17:56:42 HooK ifplugd(eth0)[4677]: client:  192.168.2.40 already taken on eth0

May  3 17:56:42 HooK rc-scripts: 192.168.2.40 already taken on eth0                                                         [ !! ]

May  3 17:56:42 HooK ifplugd(eth0)[4677]: Program executed successfully.

```

May be the cause?

----------

## UberLord

Yes, that is probably the cause. Try adding this to /etc/conf.d/net

modules="!arping"

----------

## JohnerH

 *UberLord wrote:*   

> Yes, that is probably the cause. Try adding this to /etc/conf.d/net
> 
> modules="!arping"

 

That kinda worked...  :Smile: 

```

HooK ~ # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0

0.0.0.0         192.168.2.1     0.0.0.0         UG    2000   0        0 wlan0

```

In the meantime my /etc/conf.d/net is...:

```

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

config_wlan0=( "192.168.2.40 netmask 255.255.255.0" )

routes_wlan0=( "default gw 192.168.2.1" )

config_eth0=( "192.168.2.40 netmask 255.255.255.0" )

routes_eth0=( "default gw 192.168.2.1" )

wpa_supplicant_wlan0="-Dwext"

modules_wlan0=( "wpa_supplicant")

modules=( "!arping" )

dns_servers_eth0=( "192.168.2.1" )

dns_servers_wlan0=( "192.168.2.1" )

```

But it's getting closer I think.....What else can it be?

btw, thank you for the help...not only a good developer but support person all round...thank you again.

----------

## UberLord

Nothing wrong with that. The route with the lower metric will be preferred for new traffic.

----------

## JohnerH

 *UberLord wrote:*   

> Nothing wrong with that. The route with the lower metric will be preferred for new traffic.

 

That's not whats actually happening, wlan0 is still being preferred eth0, I'm lost now....What else can it be?

----------

## UberLord

Well, the local subnet traffic you're probably right as they both share the same route metric of 0. This is because you've using static IP addresses, where we don't change the subnet route.

But for non local traffic it should prefer the ethernet.

How do you know that wireless is being preferred?

----------

## JohnerH

 *UberLord wrote:*   

> How do you know that wireless is being preferred?

 

I just transfered a 300MB file between boxes on the LAN and the wlan0 was used not eth0 (according to gkrellm2 & ntop).

And also the average transfer rate was 2.5mb/s (standard wireless rate)

I'm baffled as you are, the thing is not too long ago it was working fine even with the static IPs.

----------

## UberLord

As I said, as both wired and wireless have the same metric for the subnet (ie, the LAN) then the kernel normally sticks with the first working route.

If you use dhcpcd as a DHCP client then it will change the subnet route for you and this should work a lot better. It's a bit tricker to manage with static IPs.

----------

## JohnerH

 *UberLord wrote:*   

> As I said, as both wired and wireless have the same metric for the subnet (ie, the LAN) then the kernel normally sticks with the first working route.
> 
> If you use dhcpcd as a DHCP client then it will change the subnet route for you and this should work a lot better. It's a bit tricker to manage with static IPs.

 

I just tried changing eth0 to dhcpd and that produced the same results as the above 

```
route -n
```

Well, I think I'll give up for the time being, I'll just revert to changing between interfaces as I plug and unplug the cable, but thank you again for all your help...

----------

