1

I connect to wifi and ifconfig report 3 interfaces (lo, eth0 and wlan0), but I cannot ping anything, including the router.

Only after ifconfig eth0 down I get to actually use the internet.

What is going on? How do I avoid this problem?

My /etc/network/interfaces:

auto lo wlan0
iface lo inet loopback

route:

before ifconfig eth0 down:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.7.1     0.0.0.0         UG    0      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.7.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.7.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

after ifconfig eth0 down:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.7.1     0.0.0.0         UG    0      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.7.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

ifconfig

before ifconfig eth0 down:

eth0      Link encap:Ethernet  HWaddr 00:90:f5:a6:6c:de  
          inet addr:192.168.7.100  Bcast:192.168.7.255  Mask:255.255.255.0
          UP BROADCAST RUNNING 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:45 

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:430 errors:0 dropped:0 overruns:0 frame:0
          TX packets:430 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:34157 (34.1 KB)  TX bytes:34157 (34.1 KB)

wlan0     Link encap:Ethernet  HWaddr 74:f0:6d:27:3e:4d  
          inet addr:192.168.7.156  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::76f0:6dff:fe27:3e4d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:878 (878.0 B)  TX bytes:10870 (10.8 KB)

after ifconfig eth0 down:

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:1435 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1435 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:116494 (116.4 KB)  TX bytes:116494 (116.4 KB)

wlan0     Link encap:Ethernet  HWaddr 74:f0:6d:27:3e:4d
          inet addr:192.168.7.156  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::76f0:6dff:fe27:3e4d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:63915 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50926 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:95400944 (95.4 MB)  TX bytes:4750543 (4.7 MB)
11
  • Could you please try to connect only to WiFi by removing the LAN cable if connected. I'm not too sure as to why its causing problem since both the wired & wireless are on the same subnet (by looking at the outputs). I don't see multiple gateways on your route print too. Could you also a post an output for for ping google.com
    – AzkerM
    Mar 9, 2014 at 5:49
  • @AzkerM: there is nothing plugged into the ethernet outlet.
    – sds
    Mar 9, 2014 at 5:55
  • It make sense now. Have you by any-chance configured static IP's for the LAN interface??? or may there's something wrong within the config over wired.. Navigate to the network manager (on top, left corner) > select edit connections > select "wired" tab > select any available profile there, then hit on "edit" > navigate to "IPv4 settings" & have look into it. If you've any IPs configured just remove & change it to "Automatic DHCP". once done sudo service NetworkManager restart and try to check. :)
    – AzkerM
    Mar 9, 2014 at 6:01
  • @AzkerM: I have "auto dhcp" there; service fails with NetworkManager: unrecognized service.
    – sds
    Mar 9, 2014 at 6:12
  • my bad.. I'm sorry, it should be sudo service network-manager restart ... BTW, after the restart could you please post the output for cat /etc/network/interfaces & also re-post output for ifconfig before making the eth0 go down. :)
    – AzkerM
    Mar 9, 2014 at 6:19

3 Answers 3

1

By looking at the comments & I've added as an answer expanding more.

Possible cause is that IP's are assigned to the interface statically instead requesting automatically by adding a gatway too (just an assumption). If there are multiple gateways though the subnet is same, system does not know where to look into unless there's a persistent/static route added separately.

  • You may click on the nm-applet (enter image description here) & select Edit connections to get the entire network manager preferences or you may achieve this using terminal (press CTRL+ALT+T) & key-in below;
nm-connection-editor            # this will give you below nm-editor screen

enter image description here

  • Navigate to Wired tab, select the profile & click edit or either delete if necessary. If editing, then navigate to IPv4 settings select the Method as Automatic (DHCP) for the eth0 to request IP from an available DHCP server (see below screen);

enter image description here

  • Once done, restart the network manager to re-authenticate to the network.
sudo service network-manager restart

And as you requested, all saved network profiles can be found under system-connections directory. You may edit/delete in there but I'd recommend to use the GUI if you're to create a new connection profile. Below are the command to view your current network profiles.

 cd /etc/NetworkManager/system-connections/    # will change in to the directory
ls -l                                          # will display all the profiles in a sequense
sudo rm -fr profile_name                       # you will need root to add/edit/delete & this will remove a specified profile

Hope this helps!! :)

0

You probably have problem with multiple gateways. If you do not go too internet thought eth0, you simple can erase gateway setting for eth0 card. Averting is ok to have 3 interfaces when you are connected to wifi [lo, eth0 and wlan0].

If this don't solve your problem please give me output from command ifconfig and route.

4
  • I added ifconfig & route
    – sds
    Mar 9, 2014 at 5:35
  • Problem occur because is your eth network and you wless network the same 192.160.7.0 and gateway is 192.168.7.1 for both networks. Change one network. You can not delete default gateway because dhcp is provide on your comp request.
    – 2707974
    Mar 9, 2014 at 10:54
  • Routing table shows that if eth0 and wlan0 is up priority is on eth0 network. Metric for wlan0 route is 2.
    – 2707974
    Mar 9, 2014 at 10:57
  • You can manually configure eth0 witout gateway. When you connect wifi network you pc will got default gateway and internet will work.
    – 2707974
    Mar 9, 2014 at 11:54
0

solution from @AzkerM:

  1. navigate to network manager (top right corner) --> edit connections --> wired tab
  2. delete all profiles
  3. create a new profile; make sure that edit --> IPv4 settings is Automatic DHCP
  4. sudo service network-manager restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .