LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Wireless keeps asking for password and pops up when LAN (eth0) is available (https://www.linuxquestions.org/questions/linux-newbie-8/wireless-keeps-asking-for-password-and-pops-up-when-lan-eth0-is-available-930952/)

JohnLocke 02-23-2012 06:00 PM

Wireless keeps asking for password and pops up when LAN (eth0) is available
 
This is a fresh install of Ubuntu 11.10 and I haven't put this on a laptop before, so this is new to me (wireless with the newer network manager).

It quickly found eth0 and configured. Sweet.

I pulled it off and looked for the wireless network, which it found, and I connected to it. Also sweet.

The problem appears to be that it wants to connect to the wireless now, even when I have eth0 available. On startup, it connects to eth0, then starts asking over and over again for the wireless password.

Not sweet.

How do I tell it to ignore wireless when eth0 is available or already connected?

ac_kumar 02-24-2012 01:21 AM

you can right click on network connection icon in top right side(if gnome)
select edit connections and then click wireles than select wireless listed
than click edit if connect automatically is selected uncheck it.
And will not try to connect automatically.

JohnLocke 02-24-2012 11:35 AM

Quote:

Originally Posted by ac_kumar (Post 4610745)
you can right click on network connection icon in top right side(if gnome)
select edit connections and then click wireles than select wireless listed
than click edit if connect automatically is selected uncheck it.
And will not try to connect automatically.

I don't think that's quite the functionality I'm looking for, but it's certainly an option.

Is there no way for it to automatically detect some kind of priority like in windows? IE: If it's plugged in to eth0, use that. If eth0 becomes unavailable, /then/ try to connect to wlan0. If eth0 becomes re-available, disconnect from wlan0 and reconnect to eth0.

I spend good portions of the day docking and undocking this laptop at work (going to meetings). When I'm at my desk, the higher speed lan is the way to go (lots of file transfers, svn, etc), but it'd be good to not have to mess with the network settings every time I get up for and sit down from a meeting that I bring my laptop to. Windows did this automatically, so it's obvious the capability can exist, but does it exist in linux?

EDDY1 02-24-2012 11:44 AM

I think you missed the point.
If you have your wireless network to not automatically connect to a certain network, it is always available to connect to.
If the password is already saved, when you want to connect to it then scroll down network listings & connect.
The available networks notification also has a box that says, "do not ask again"

JohnLocke 02-24-2012 12:06 PM

Quote:

Originally Posted by EDDY1 (Post 4611138)
I think you missed the point.
If you have your wireless network to not automatically connect to a certain network, it is always available to connect to.
If the password is already saved, when you want to connect to it then scroll down network listings & connect.
The available networks notification also has a box that says, "do not ask again"

No, I think perhaps you've not understood me.

I can set it to not connect automatically. That's all well and good. But what I was hoping to avoid is the results of that ... going in and re-selecting the network I want to be on each time I switch positions.

For example:

Let's say I set it up to connect automatically to eth0 and not automatically to this particular wireless lan.

I start out at my desk. All is well.

I leave my desk, and the laptop detects (after some delay) that eth0 is disconnected, so it shows no connection. To connect to my wireless network, I have to go select it from the network manager.

I now go and sit back at my desk. eth0 reconnects, but the wireless network is also still attached. I have to tell it explicitly to disconnect.

While /both/ are connected, I do not know, and probably have no control over, which network my data is being sent through or requested from when obviously I want to use just the wired network (faster / more stable / more secure).

So while I realize the network is "still there" and I can still connect to and disconnect from it, I'd rather not have to make changes to my network settings (even simply connecting and disconnecting by hand) the 5 to 8 times a day I'd have to do it ... each time having to do it twice, once when I leave my desk and once when I return.

Especially since any time I might /forget/ to make that wireless connection, even though it's available, it would "fail silently", and I simply wouldn't be receiving my messages or e-mails, some of which are time sensitive.

So I'm asking if there's some kind of automatic network switching with priorities that can be set up. Windows does this, though it's not configurable (that I'm aware of) by simply preferring wired over wireless.

JohnLocke 02-24-2012 12:20 PM

And just to be clear, I don't know that this is a big deal, that's why I was asking.

I can leave both to "connect automatically", and I get mostly the right behavior, except that both networks are fully connected any time I'm docked.

david1941 02-24-2012 03:20 PM

"except that both networks are fully connected any time I'm docked."
.. and that's a problem?

JohnLocke 02-24-2012 03:43 PM

Quote:

Originally Posted by david1941 (Post 4611281)
"except that both networks are fully connected any time I'm docked."
.. and that's a problem?

I don't know ... that's part of what I'm asking.

I don't know how to check whether it's using eth0 or wlan0 for its communication. Using wireless when eth0 is available would be way sub-optimal, so if it semi-randomly bounces between them, that'd not be good. If I'm doing stateless transactions over the network that use information from the originator as a kind of client key, it could break that as well.

I don't know what the behavior of having a second network connected looks like, in short.

If it /isn't/ an issue, then ... well ... I guess that's that. :)

david1941 02-24-2012 04:08 PM

Each connection is keyed to the source IP/port and Destination IP/port and so will not vary within that connection. What will happen is that two different connections, say to a smtp server may go through two routes (each on only one route). Mas nix... It doesn't really make a difference how it is delivered to the programs/servers so long as the IP/port setup works as it should. That's what TCP/IP does and it is transparent to the programs. I'm dual hosted here (IPv6/v4) and different servers switch back and forth all the time depending on the hosts/clients. No problem.

david1941 02-24-2012 04:16 PM

And, the kernel's routing procedure should select the fastest route to so the best (fastest) connection will be preferred.

JohnLocke 02-24-2012 04:27 PM

Quote:

Originally Posted by david1941 (Post 4611347)
And, the kernel's routing procedure should select the fastest route to so the best (fastest) connection will be preferred.

Then I think we're good to go!

Thanks for the info. Wasn't sure what the best way to set all this up was and it wasn't behaving the way it "seemed to me" like it should have :).

Heraton 02-24-2012 04:34 PM

Proper configuration or some kind of workaround
 
Hi there!

I myself hardly use network manager at all, so I can't tell if such a feature exists. But from a network administrators view, there are still some options:

You could set the metrics for your wireless higher than that of your ethernet device, if this is not standard already. To get that info, you can simply run
Code:

route -n
in your shell. It should show two entries for 0.0.0.0 network with 0.0.0.0 genmask (aka the route to internet), just having different routers.

Your routing table is the key to tell where your traffic goes. It first checks for all entries that match your target network and then simply chooses the entry with the longest subnet mask. If two of them are equal, the kernel will check which one of them has better metrics and chooses that one. All the time.

If you want to double check, you can run
Code:

sudo tcpdump -i eth0
This command line sniffer ships with a lot of distributions and shows whether there is traffic or not.

You could of cause use scripting too. Just run a script that checks if eth0 is available and disable wlan0 in that case:
Code:

#!/bin/bash
#
# infinite loop
while true;
do
        # testing whether eth0 is available:
        # if connected and up, there will be the RUNNING flag in ifconfig
        #
        IS_UP=`eval "ifconfig eth0" | grep RUNNING`
        if [ 0 != ${#IS_UP} ]
        then
                echo "shutting down eth1"
                ifconfig eth1 down
        else
                echo "starting eth1"
                ifconfig eth1 up       
        fi
        # just to reduce the amount of cpu load. Configure to suit your needs
        sleep 30
done


Okay, I guess testing my script took too long, but anyway, now that it is done, I want to share it anyway. Maybe some day some one stumbles across is and likes it.


Regards,

Heraton

JohnLocke 02-24-2012 04:38 PM

Very cool, Heraton.

As you suspected, the metrics for my wireless device are higher than my eth0 device. I actually have 4 entries in this case, but the others are equally partitioned out (metris of 0 [genmask and destination 0.0.0.0 on eth0], 1 [main eth0], 1000, and 2 [wlan0] for the different destination tables).


All times are GMT -5. The time now is 01:01 AM.