Laptop wireless - flaky at home, OK at office

Discussion in 'Linux Networking' started by Charlie Gibbs, Mar 3, 2014.

  1. I have a laptop running CrunchBang Waldorf:

    cjg@cjglap-crunchbang:~$ uname -a
    Linux cjglap-crunchbang 3.2.0-4/amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux

    I've configured its wireless interface both at home and at the office.
    I take the machine back and forth without re-booting - at home I close
    the lid and the machine goes into hibernation, I go to the office, open
    the lid, and it wakes up, finds the wireless access point, gets a new IP
    address (192.168.1.xxx), finds the office router, and happily accesses
    the Internet. The reverse - going from office to home - doesn't work
    so well. The laptop wakes up, gets an IP address (192.168.0.xxx), and
    seems to know that the router is at 192.168.0.1 - but it only works for
    a while, if at all. Taking wlan0 down and bringing it back up makes
    it work for a while, then it stops. If I plug in an Ethernet cable,
    everything is happy. More or less - pings to the Internet take 5
    seconds each, and pings to machines on my LAN (including my WAP/router)
    come back "Destination Host Unreachable", even if I specify an IP
    address instead of a hostname.

    The route command takes 10 seconds to come back with:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
    192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
    192.168.0.0 * 255.25.255.0 U 0 0 0 eth0

    If I unplug the Ethernet cable, the route command returns "wlan0" under
    the Iface column on the default line, and loses the last eth0 line.

    The copy of Windows XP I have running under VirtualBox on my laptop
    doesn't have any trouble accessing machines on my LAN - or the
    Internet - as long as the Ethernet cable is connected. My wife's
    laptop, which runs Windows 7, can access my LAN wirelessly.

    The wireless network at the office broadcasts its ESSID, while my
    home network doesn't. Could this make a difference?

    There must be some sort of configuration problem in my laptop.
    Any suggestions as to where to look? Is there a good guide to
    setting up wlreless networking, expecially for laptops that move
    from one network to another?

    Thanks for any pointers anyone can provide...
     
    Charlie Gibbs, Mar 3, 2014
    #1
    1. Advertisements

  2. Charlie Gibbs

    Moe Trin Guest

    On 02 Mar 14, in the Usenet newsgroup comp.os.linux.networking, in article
    Not familiar with it
    Problem has existed for 20+ years, but people keep repeating it.
    Try "/sbin/route -n" (telling it to not make a DNS lookup). "ping"
    also has a -n option.
    So, is 192.168.0.x on eth0 or wlan0. ONE, NOT BOTH. When the kernel
    sees two routes to the same destination, it chooses the one that was
    declared last, because it assumes you screwed up making the first
    declaration, and the second one is the correction. You can prove
    this by running a packet sniffer on each interface, and seeing which
    one is getting which packets.

    Solution: change wlan0 _OR_ eth0 to some other address range. Or
    simply don't use two interfaces.

    Old guy
     
    Moe Trin, Mar 3, 2014
    #2
    1. Advertisements

  3. It's a lean distribution built on Debian.
    But it is both - eth0 gets 192.168.0.24, wlan0 gets 192.168.0.23.
    Yup, eth0 was getting all the packets.
    cjg@cjglap-crunchbang:$ sudo ifconfig eth0 down

    Presto!

    As for why it worked at the office, I never bothered plugging in an
    Ethernet cable there, and wlan0 picked up an address of 192.168.1.xxx
    instead of 192.168.0.xxx, so there was no conflict.

    Thanks for the help. I was primarily using the wired connection to
    my laptop at home because I haven't been able to get VirtualBox to
    bridge to a wireless connection, and I need my laptop to have access
    to machines on my LAN as well as to the Internet, both natively and
    through the virtual WinXP machine. Unfortunately, this means that
    I get wireless access to my LAN from the Linux host at the cost of
    any network access from the virtual machine.

    It could be worse, I suppose. The WinXP VM is for work, so if I
    want to use it I'll go into my home office, plug in the Ethernet
    cable, bring up eth0, and do work. If I want to play somewhere
    else in the house, I'll unplug the cable, set eth0 down, and
    have full wireless access from the Linux side. It beats borrowing
    my wife's laptop, which is a singularly unpleasant experience
    seeing as it runs Windows 7 and has a really crappy keyboard.
     
    Charlie Gibbs, Mar 3, 2014
    #3
  4. Charlie Gibbs

    Moe Trin Guest

    On 03 Mar 14, in the Usenet newsgroup comp.os.linux.networking, in article
    About a month ago, Distrowatch.com reported

    DistroWatch database summary
    * Number of all distributions in the database: 768
    * Number of active distributions in the database: 290
    * Number of dormant distributions: 58
    * Number of discontinued distributions: 420
    * Number of distributions on the waiting list: 348

    I simply don't try to keep track of them all.
    Therein lies the problem. By default, the interfaces will each get a
    "network route" for what is thought to be connected. Your tool
    brought up 192.168.0.24 as a /24 (255.255.255.0 mask), so everything
    with a 192.168.0.xxx address is assumed to be connected/reachable via
    that interface. Another tool brought up 192.168.0.23. and we have the
    same assumption - 192.168.0.xxx address is assumed to be
    connected/reachable via _that_ interface. Somebody must be wrong. It's
    possible to have identical routes on both interfaces, but that requires
    a dynamic routing daemon such as "routed", "gated" or "zebra" on all
    hosts to sort things out - severe pain in the neck to do so.
    Is CrunchBang using a "let me do this for you" type of network tool
    such as Network Manager? They try to second guess, and often get it
    wrong. What is often missing from the tool is a "sanity checker".
    Yup - that will do it.
    When IP was developed (early 1980), multiple interfaces on a computer
    were quite rare. The networking code in Linux was based on that
    assumption. It will work quite well with multiple interfaces, but it
    takes a tiny bit more effort - a LOT more if the same network is on
    both interfaces. Dynamic addressing service (BOOTP, later replaced by
    DHCP) was much later (1988) and provided as a means of sharing scarce
    IP addresses among multiple hosts. RFC1597 (from 1994, replaced by
    RFC1918 in 1996) provided for "private" IP space, which eliminated the
    scarcity, but microsoft took advantage of the dynamic configuration to
    simplify setup for the average user (who couldn't spell "IP" if asked).

    The simple minded solution is separate networks. At home, my wired
    network is 192.168.1.x, and the router to the world is at 192.168.1.1.
    The wireless network is on 192.168.3.x, and only 192.168.3.10 has a
    second network card for 192.168.1.x. Hosts on the 192.168.3.x, network
    use 192.168.3.10 as their route to the world. The second NIC on that
    box is listed as the route to 192.168.3.x for those on the wired LAN.

    Ethernet hosts
    default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    192.168.3.0 192.168.1.10 255.255.255.0 UG 0 0 0 eth0

    192.168.[13].10
    default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0

    Wireless hosts
    default 192.168.3.10 0.0.0.0 UG 0 0 0 wlan0
    192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0

    Thus, there is no confusion of how to get where. The wireless hosts
    know they can talk directly to each-other, and if they want to talk to
    a wired host (or the world) they send packets to 192.168.3.10 which
    is acting as a router and will forward them. Ethernet hosts know about
    the other wired systems, know to send packets to 193.168.1.10 (the other
    side of 192.168.3.10) to be forwarded to the wireless systems, and
    everything else goes to 192.168.1.1.
    Planing ahead is often easier ;-) Incidentally, the '-n' option to
    ping and route is to stop them from trying to look up the hostnames
    for _display_ purposes.
    It's nice being retired - but I haven't used windows since about 1990.
    Not knowing what you are trying to do network-wise, I can't say much,
    but having wired and wireless networks separated might do the job for
    you. In the example above, host .10 on both networks is the primary
    file-server, and seeing as how it wasn't all _that_ busy, I added the
    second interface, and let it do routing between the two networks as
    well. My Ethernet uses fixed addresses, and the router/file-server
    also ran a DHCP server for the wireless side (but using fixed addresses
    based on MAC addresses). That way, the laptops were asking for a
    dynamic address/setup - which allowed them to work at the local
    hot-spots, and yet gave them "known" addresses when they were at home.

    Old guy
     
    Moe Trin, Mar 4, 2014
    #4
  5. I suspected that something like that might be the answer. But it's
    not really worth the effort to set up. The only time I really need
    to put the laptop's virtual machine on the network is when I back up
    my main development box (another VM) - the laptop has compilers and
    copies of my test beds so I can even do development on it as a
    freestanding box, and copy everything back over at another time.
    Meanwhile, the Linux side is fully operational wirelessly, so I
    can wander around the house with it, and even ssh -X into my main
    Linux box.

    Thanks again for the help.
     
    Charlie Gibbs, Mar 5, 2014
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.