LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Debian Networking Doesn't Work with Home Wifi (https://www.linuxquestions.org/questions/linux-networking-3/debian-networking-doesnt-work-with-home-wifi-942291/)

52358 04-28-2012 11:31 AM

Debian Networking Doesn't Work with Home Wifi
 
I've used Ubuntu for a few years at home and I use CentOS at work, but getting tired of Ubuntu's Unity interface and the general direction it's going I decided to switch my home computer to Debian, so I guess this makes me as a Debian noob.

Once I booted for the first time, I noticed that I did not have internet while connected to my home wifi. I thought at first that Comcast might be down again, but then I noticed all my other wifi devices worked fine with the router. I then connected to a neighbor's unsecured wifi, and the internet worked fine, so that rules out a problem with the wifi card.

I then got my laptop close to the router and connected them with an ethernet cable, disconnected from wifi, and I once again had internet. However, because I have a laptop, this is not a realistic solution.

I thought maybe I MAC address-blocked myself from my router, so I booted to my Windows partition and I was able to get online from my home wifi, so I ruled out that.

The only logical thing left is that my Debian system is somewhat misconfigured for that hotspot. So I went to System > Preferences > Network Connections > Wireless and deleted the profile for my hotspot, and reconnected, still nothing. I decided to give myself a manual IP, maybe there was a DHCP failure somewhere, still nothing. While connected I tried to go to 192.168.1.1, my router's config page, but I couldn't even access that.

here's my ifconfig:
Code:

eth0      Link encap:Ethernet  HWaddr 00:26:2d:52:eb:e0 
          inet addr:192.168.1.50  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::226:2dff:fe52:ebe0/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:1809022 errors:0 dropped:0 overruns:0 frame:0
          TX packets:911273 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2650615647 (2.4 GiB)  TX bytes:66119719 (63.0 MiB)
          Interrupt:16

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2040 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2040 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:195826 (191.2 KiB)  TX bytes:195826 (191.2 KiB)

wlan0    Link encap:Ethernet  HWaddr 70:1a:04:09:e2:c6 
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::721a:4ff:fe09:e2c6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:122503 errors:0 dropped:0 overruns:0 frame:0
          TX packets:106758 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:154428357 (147.2 MiB)  TX bytes:13256951 (12.6 MiB

And here's what I got when I tried to ping the router:
Code:

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.50 icmp_seq=1 Destination Host Unreachable

(it says my local IP is 192.168.1.50, so I guess this means it's trying to ping through my ethernet connection, despite not being connected through ethernet at the time)

and finally netstat -nr
Code:

Kernel IP routing table
Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 eth0
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 wlan0
169.254.0.0    0.0.0.0        255.255.0.0    U        0 0          0 eth0
0.0.0.0        192.168.1.1    0.0.0.0        UG        0 0          0 wlan0

This is as much troubleshooting as I remember from my networking classes, I really don't know what to do next. I'd really appreciate any feedback.

Skaperen 04-28-2012 12:17 PM

Try pinging an outside address to see if you get the response from 192.168.1.50 or from 192.168.1.4. You might use 8.8.4.4 or 8.8.8.8 (Google's public DNS array).

52358 04-28-2012 12:39 PM

okay, I was able to fix it :D

I opened up /etc/network/interfaces

and noticed that eth0 was defined with the static IP 192.168.1.50 and looked something like this:
Code:

auto eth0
iface eth0 inet static
    address 192.168.1.50
    network 192.168.1.0
    netmask 255.255.255.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

so I made it ask DHCP for an address instead by replacing the above with:
Code:

auto eth0
iface eth0 inet dhcp

Then I restarted networking by running
Code:

/etc/init.d/networking restart
and now everything works :D

Now I have no idea why that fixed it, but I figured that since when I pinged it told me that my IP was 192.168.1.50, I figured removing that might do something. I also don't understand why the configuration for eth0 was affecting wlan0, or more specifically only affecting it when connected to the device eth0 was last connected to (my router).

Skaperen 04-28-2012 02:18 PM

So what IP address did DHCP give you? Maybe what was happening is that the router blocks IP addresses that it has not assigned, at least if they are within the DHCP pool and not coming from the assigned MAC. If you prefer a static IP address, maybe one outside the pool (check the router configuration) would work.

If you just want static IP for internal purposes, adding another subnet with a second IP address in that range would work, such as 192.168.2.0/24 or 172.16.0.0/16 or 10.0.0.0/8 depending on how greedy you are :) Or try out IPv6 with huge subnets like fc00::/16.

In a pinch you can use the IPv6 autoconfigured scope local addresses that Linux gives fixed assignments to based on the MAC address (MS Windows does not do it that way). Do "ifconfig eth0 | grep fe80:" to see yours. These "fe80" addresses need "%eth0" appended when using them (or "%wlan0" or whatever interface you want it to use). This is a good way to test specific interfaces since normal addressing can go by way of other interfaces in many cases.

urapain 03-13-2017 08:11 AM

You can't properly test wifi while connected to the wired network. Your wired port (eth0) has 192.168.1.50. Your wifi (wlan0) has 192.168.1.4. That will never work because both numbers are from the same network.


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