Internet loss when changing networks

I had been playing around with wpa_supplicant, iwconfig and dhcpcd to get an x-less internet connection. However, this seems to have broken my Internet connection. I have reverted my wpa_supplicant settings, but every time I change networks, I must manually run

$ sudo /sbin/dhcpcd wlan0

in order to get a connection.
Unfortunately, this sometimes results in


err, wlan0: timed out
warn, wlan0: using IPV4LL address ###.###.###.###

Using KDE 4.6 on openSUSE 11.4 32-bit. I want KNetworkManager to just automatically work.


$ ping google.com
ping: unknown host google.com

Pinging my other computer:


$ ping 192.168.1.101
connect: Network is unreachable


$ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1B:24:50:F0:F5  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:41 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:127 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:10261 (10.0 Kb)  TX bytes:10261 (10.0 Kb)

wlan0     Link encap:Ethernet  HWaddr 00:13:E8:3C:CE:65  
          inet addr:**169.254.##.##**  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:143 errors:0 dropped:0 overruns:0 frame:0
          TX packets:281 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11981 (11.7 Kb)  TX bytes:41984 (41.0 Kb)

The inet addr, should be 192.168.1.*.


$ ps aux | grep dhcp
root      2391  0.0  0.1   5228  2980 ?        S    21:58   0:00 /sbin/dhclient -d -4 -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-wlan0.pid -lf /var/lib/dhcp/dhclient--wlan0.lease -cf /var/run/nm-dhclient-wlan0.conf wlan0
root      5160  0.0  0.0   2100   588 ?        Ss   21:59   0:00 /sbin/dhcpcd wlan0
xxxx     5814  0.0  0.0   3680   768 pts/0    S+   22:08   0:00 grep dhcp


$ ps aux | grep wpa_supplicant
root      1421  0.0  0.1   5676  2456 ?        S    21:56   0:00 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -u -f /var/log/wpa_supplicant.log
xxxx     5785  0.0  0.0   3684   764 pts/0    S+   22:07   0:00 grep wpa_supplicant


$ cat /etc/*-release
openSUSE 11.4 (i586)
VERSION = 11.4
CODENAME = Celadon

Using ifup on wireless connections is OK if you never change locations or APs,
but awful if you do as you really need to change
/etc/sysconfig/network/ifcfg-wlanX to make it work right.

I think you need to explore nmcli, the command-line interface to NetworkManager.
With it, you can switch APs, etc. in the way that you would with the applet.

So, is this a legitimate fix:

sudo mv ifcfg-wlan0 ifcfg-wlan0.bak

I did this and restarted, and my internet is working for the moment. But, I haven’t had the chance to change networks yet.

On 03/16/2011 03:06 PM, jslick0 wrote:
>
> lwfinger;2306125 Wrote:
>> Using ifup on wireless connections is OK if you never change locations
>> or APs,
>> but awful if you do as you really need to change
>> /etc/sysconfig/network/ifcfg-wlanX to make it work right.
>>
>> I think you need to explore nmcli, the command-line interface to
>> NetworkManager.
>> With it, you can switch APs, etc. in the way that you would with the
>> applet.
>
> So, is this a legitimate fix:
>
> Code:
> --------------------
> sudo mv ifcfg-wlan0 ifcfg-wlan0.bak
> --------------------
>
> I did this and restarted, and my internet is working for the moment.
> But, I haven’t had the chance to change networks yet.

You shold make a separate file for EVERY ESSID whith which you wish to connect.
That file should match the contents of ifcfg-wlan0 with the correct ESSID and
encryption secrets. Give these names like ifcfg-wlan0-<essid>. When you want to
change APs, then


sudo cp ifcfg-wlan0-<essid> ifcfg-wlan0

That is a pain, which is why NM was developed.

You might experiment with switching to dhclient (instead of dhcpcd). I recently ran into problems switching WiFi connections, with dhcpcd inappropriately using cached information. I have not yet tested whether dhclient also uses inapppropriately cached information. I said a bit more on this at traditional (ifup) and networkmanager problems using KDE 11.4

I had never changed from networkmanager to ifup. Rather, it seems I was using the ifup tools while using networkmanager.

Having to manually edit and activate a configuration for each network is very undesirable. How do I make internet work with networkmanager again?

I have found that if I delete /etc/resolv.conf and restart networking, the internet works and a new resolv.conf is generated. But, I have to do this every time I connect to a different network.
In my /etc/sysconfig/network/config, I have:

NETCONFIG_DNS_POLICY="auto"

What should the value be if I want to use nm?

If you are using nm, then take a look at “/etc/dhclient.conf”. It contains comments about changes you can make. I’m have it forcing a domain name. I’m pretty sure that you can get it to prepend some dns nameservers to the list returned by a dhcp query. That will probably solve your “resolv.conf” problem.

If this is a laptop, I would keep a copy of the unmodified file around somewhere, as you might want to revert to that when traveling.

Hey guys; thanks for pointing me in the right direction. After deleting /etc/resolv.conf and restarting networking, my wireless internet has worked flawlessly in several wireless networks with different configurations. Fortunately, it started working before I even looked at /etc/dhclient.conf.

lwfinger,
thanks for pointing me to nmcli. I have managed to figure it out, and I have been able to connect to stubborn Wireless networks that don’t broadcast their SSIDs. (As a side note, KNetworkManager seems to have improved in this area, but it is still flawed at connecting to ‘hidden’ networks).

Yes it is unfortunately. You could try the network manager plasmoid. Maybe this one connects to them without pain. Other than that You can search trough this thread for workarounds when using hidden SSID.

Best regards,
Greg