12.3 KNetwork Manager - Two networks bug?

I have just installed 12.3 on a laptop for somebody and I have noticed what I think is a bug in KNetwork Manager.

I use the wired ethernet connection for installs and then enable the wireless one when all the heavy lifting has been done.

For the user’s convenience, I installed network manager so that they could switch among several wireless APs.

I have noticed that when I have the cable plugged in at the same time as one of the user’s wireless APs is available, network manager connects them both. This is undesirable and I can find no settings in the network manager widget that allows me to specify that if the cable is connected, don’t try to set up the wireless…

If there were only the possibility of a wired and a single wireless AP, I could use ifup to prioritise the cable over the wireless but that is not the case with this user.

This situation was reported over a year ago as bug in network manager that occured between release 0.6 and 0.7 I think.

Any suggestions?

TIA.

It is of course a bit difficult for a designer what to do in which case. I also heard about the wired connection being prefered above the wifi and thus switching off the wifi when the cable was connected. But I guess that is only applicable when cable and wifi connect to the same network. When the two IP addresses are from different networks, I guess that one could decide that then the wifi should not be switched off.

The above is a bit of an idea from me, no hard prove known, but it seems logical.

So the question then would be, are these two connections to the same or different networks (IP ranges).

Henk, thanks for the reply.

My apologies, I should have made it clearer. Yes, they are on the same network acquiring addresses from the same DHCP server.

Looking back over my notes, I realised that this issue had been brought up in 2008 when it was noticed as being a difference in behaviour between two release of network manager.

I, too, can see the rational for being able to run multiple network interfaces at the same time. All the “desktop” machines in my home network have at least two NICs. One connects to the router that gives outside world access and the other(s) are for intra-net comms for NFS, printing, scanning and the like.

Intuitively, I think what should be happening is that the network manager should be giving me the options to specify just what I need my NICs to be configured as. That is, do I want them all up or do I want two or more to be mutually exclusive? If the latter, what priority do I want for them?

Looking at one of my own laptops for which I used ifup and banned network manager, I thought I could use the “priority” option to give me the situation whereby if the wired was up, the wireless would not be brought up and vice-versa. However, when I plugged in a wire, I found that both the wireless NIC and the wired one came up.

I will be looking more closely at the documentation for ifup later today to see if I have made a configuration mistake here.

I have also got a script that I might try to enable me to achieve what I want despite network manager. Will post it here if it succeeds.

I do not use NetworkManager at all (having only desktop systems here), so apart from my logic above (which ma b far from what happens “real life”, I can not contribute much.

Only thing is that I know that when using ifup, you can then (through YaST e.g.) choose when you want your NIC being up. E.g. on boot, or on cable connection. I do not know if NM offers such a feature and if it may help.

Hello Henk.

No, it doesn’t. The best it has is an “automatic” connection.

Sorry, better wait for a real NM guru :stuck_out_tongue:

I can confirm that if you exclude network manager and uses ifup to manage the NICs, you can get a perfectly reasonable outcome.

If you have multiple NICs going on the same network, simply use the “On Cable Plug In” option for them and use the priority to define your preferences. Zero will always bring it up otherwise the one with the highest priority will be used provided it can be brought up.

Fixed address NICs should go to zero. I am not at all sure how one would handle say 4 NICs to give you the option of two on one network and two on the other. Possibly a mix of fixed addresses and priority but, thankfully, I don’t have that situation.

In the short-term, I’ve told the user to switch off the wireless if they want to use the cable but I am still looking for a better solution.

To whom do I submit the desired behaviour request to? Anybody know?

This ‘dispatcher.d script’ solution might suit

http://superuser.com/questions/233448/disable-wlan-if-wired-cable-network-is-available

It is designed to drop the wireless connection as soon as wired ethernet connectivity is available. (Obviously, you’ll have to edit the naming to suit your ethernet interface.)

Hi Deano and thanks for this.

In fact, I have a script that is basically the same as one of the others posted on that thread so I will give them a try.

I am a bit concerned that we even need to do this. I don’t understand why it is considered desirable to have more than one NIC to the same network but…

ifplugd does exactly what is needed in this case so I wonder why the same logic cannot be applied to the Network Manager.

I would like to engage with the guys who maintain the Network Manager stuff about this so do you happen to know who they are?.

Good. Let us know how you get on. :slight_smile:

I am a bit concerned that we even need to do this. I don’t understand why it is considered desirable to have more than one NIC to the same network but…

I have to connect to multiple networks and devices in the course of my job, and so have a variety of wired and wireless network connections defined. Most are not set to ‘Connect Automatically’, instead I select them manually to connect to devices using various default IP addresses/subnets. I only have a gateway assigned to the interface I use for internet connectivity. Thus, I can reach LAN or internet on one interface, while configuring a network device or managing another network.

ifplugd does exactly what is needed in this case so I wonder why the same logic cannot be applied to the Network Manager.

Well, clearly it has the flexibility to do so (ie dispatcher scripts), but I find it useful the way it is. I prefer to manually select the connectivity anyway.

I would like to engage with the guys who maintain the Network Manager stuff about this so do you happen to know who they are?.

https://mail.gnome.org/mailman/listinfo/networkmanager-list

Thanks Deano.

Will drop those folks a line.

Yes, I see the point of the “manual” option and that is workable for this user.

It might not for others though.

OK. Using the "Dispatcher script, I got the behaviour I needed.

However, the script as given doesn’t do the whole job. It will take down the WLAN when the cable is plugged in but doesn’t bring the WLAN back when the cable is removed.

The Network Manager says that the WLAN is disabled by hardware.

Ahead of the nmcli command to bring the WLAN back, you need to rfkill unblock wifi in order for the NM to succeed.

In my case, rfkill installed in /usr/sbin which was not on root’s normal path so I had to explicitly issue /usr/sbin/rfkill.

Thanks for the input.

Wel… sort of.

I thought I could mark this thread as solved by using “Thread Tools” but there isn’t the option there.

We do not Close or Solve threads. Saying in a post your are satisfied (and reporting how, what you did IMHO) is enough. Others may want to add more information after that.

  1. I do not consider the ability for a system to support more than one network device at a time a bug. In fact, it’s a normal and required configuration for multi-homed systems that for example forward or route traffic from one network to another. But, it <is> critical for the User to understand that only one network device should be actively connected to the same network or you will experience massive routing errors (Traffic will want to return through the same interface)

  2. I have never had any problem using ifup/ifdown when using Network Manager. Unlike the dispatcher script, it does not kill the network device altogether, ifup/ifdown only disables or enables the <interface> you specify (you should mention the interface or all interfaces go up or down)

# ifup|ifdown [interfacename]

So, I always practice and recommend the following…

  • Physically disconnect any network connections that are not being used. This is easy to do with a wired connections, just pull the plug.
  • Disable the wireless when not working. This can be done a number of ways
    a. As described above, you can “ifdown” the wireless interface (usually wlan0)
    b. You can install and run the “rfkill” utility. It will “turn off” the wireless adapter in a more acceptable way than described in the dispatcher script. Yes, you can easily create a script that will invoke rfkill to enable or disable wireless.
    c. Lastly, but perhaps should be first many laptops have a hardware wireless switch. Just turn wireless off, it’s like pulling the plug.

HTH,
TSU

TSU2.

I understand. Many of my “users” do not have the advantage of your knowledge.

In such situations, I ask myself “what would a reasonable person who does not have my inside knowledge expect the behaviour to be?”.

If I have two possibilities to connect to the network, I expect you to choose the “best” one. What you choose, I can maybe disagree with but choose one. Not both!

What I would want is that if you see a cable, use it. If you don’t and there is wifi, use that. If I then give you a cable, disable the wifi and use the cable. This is what I get when I “manually” do it via ifupd.

Network Manager has flaws.

Consider that I used the dispatcher script linked to by Deano. I am not a typical user so I am OK with putting my fingers in the pie. Other users are not.

The dispatcher script that I used courtesy of Deano does not give the required behaviour I think is reasonable. I found this on further testing.

If the last state of the box was that a cable connection was in use but I now boot the box without the cable, Network Manager insists on having a cable present. It shows an angry red cross on top of a cable connection icon and it marks its “Enable Wireless” button greyed out. Pressed, it tells me that the wireless is disabled by hardware.

My wifi on/off switch is on and glowing with a blue light. Am I confused? **** straight I am. What you tell me doesn’t fit what I see. Even if I turn the switch off and on again, the story doesn’t change.

“rfkill list” shows me that the wifi is “up”. Why does Network Manager insist that it is off? BUG. Network Manager is clearly unable to determine the current state.

If I issue an “rfkill unblock wifi” (to a wifi that rfkill list tells me has no block). Network Manager wakes up and marks its “Enable Wireless” button. If I click it, the wireless interface is brought up. So right there, I lose the “seamless, just works” argument.

In a past life, I engaged with some of the Apple folks. They have a point and we should listen!

The dialogue surely has to start with "What do I see with the hardware? Does Network Manager keep some file somewhere that it defines as the known universe?

Drop it!

Look at what is there in front of you and follow something like " Is the cable in? Yes, bring it up and use it. No? is there a wifi? Yes, bring it up. No? Oh bugger! no networking right now."

Deano gave me a link to get on the mailing list of the NM group. It told me my email was blocked. Hmmm. I have no idea why so I sent a msg to the admin.

On 2014-01-29 23:06, antttikutoja wrote:

> This situation was reported over a year ago as bug in network manager
> that occured between release 0.6 and 0.7 I think.
>
> Any suggestions?

I have a laptop here, using 13.1, XFCE, and NM.

I have it using WiFi, then I connect the cable. Both interfaces remain
up, both have an IP, as shown by “ifconfig”. But the output of “route”
shows that only the ethernet connection will be used (default route).


> cer@minas-tirith:~> /sbin/route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> default         router.valinor  0.0.0.0         UG    0      0        0 eth0
> 192.168.1.0     *               255.255.255.0   U     1      0        0 eth0
> 192.168.1.0     *               255.255.255.0   U     9      0        0 wlan0
> cer@minas-tirith:~>

From outside, both interfaces respond to the ping. I can connect to both
IPs via ssh.

The icon displayed by the applet changes, from the bar graph used for
wifi to one depicting two displays, as used for ethernet.

So yes, it is a bit confusing because both interfaces remain active. But
the situation works, because the routing tables are set to use in
preference the cable.

It seems intentional.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

That is only true for connections that use the deafult gateway. But not for LAN connections. Here packets could go out of the first interface and the partnet could send an answer packet to the second interface.

On 2014-01-31 22:16, hcvv wrote:
>
> robin_listas;2621062 Wrote:
>>
>> So yes, it is a bit confusing because both interfaces remain active. But
>> the situation works, because the routing tables are set to use in
>> preference the cable.

> That is only true for connections that use the deafult gateway. But not
> for LAN connections. Here packets could go out of the first interface
> and the partnet could send an answer packet to the second interface.

I tried local connections (LAN), both directions. No problems.
I’m not sure if they use the GW or go direct, though. Not sure how to
find out.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

:slight_smile:

Hook up a packet sniffer and capture what really is happening.
And, communicating through both NICs is a hit/miss thing. Eventually something will fail.

So, if you want <reliable> networking you should only connect <one> NIC to the network unless you’re doing something advanced like bonding NICs.

As for creating an auto-configuring script that enables/disables interfaces according to various combinations, I’m sure if you wanted to create something that <really works> in all scenarios would be received with praise. But, there are many types of network connections. You also have options to utilize(or not) sensing whether a NIC is live (connected).

In the end, when I briefly considered something like this years ago, I felt it was more trouble than it was worth to simply provide proper instructions and/or provide a set of simple scripts the User would just click on (or run from console) according to the situation (eg wlan_on.sh and eth_on.sh which would disable the "other interface while activating the desired connection).

Or, as I strongly recommend just “flip the switch” or pull the cable to disable the undesired connection.

TSU