Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
DNS with dhcpcd and WiFi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Thu Oct 12, 2017 7:20 pm    Post subject: DNS with dhcpcd and WiFi Reply with quote

I have a laptop running gentoo, and it consistently has issues with WiFi. I can add access points by editing /etc/wpa_supplicant/wpa_supplicant.conf, and it connects fine. Ping with an IP address works fine, but ping with a URL returns nothing at all, and I get errors about "unable to resolve address" issues from the browser.

/etc/resolv.conf has four IP addresses manually entered (two each for OpenDNS and google), plus one added by the router from dhcpcd.

How can I debug why DNS lookups aren't working, and how can I fix it?

Cheers,

EE
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Oct 12, 2017 7:48 pm    Post subject: Reply with quote

libc (the main reader of /etc/resolv.conf) is normally limited to 3 resolvers max - so the last two won't be used.

But you can test DNS by use of the dig command

Code:
dig www.gentoo.org @192.168.1.1


Replace 192.168.1.1 with the DNS server you want to test.
Then, just omit the faulty ones.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Fri Oct 13, 2017 4:07 am    Post subject: Reply with quote

What package provides dig? I don't seem to have it installed.

Also, the four nameservers I have listed are apparently added to resolv.conf, as deleting them gets overwritten on reboot. Where else might I have them listed?

Cheers,

EE
Update: I take it back. It's not just DNS: commenting out two nameservers, I could resolve addresses. But then I got "destination host unreachable" errors. Even checking with ping, it can't get past the router. So wifi connects to the router, but cant get past it. How can I debug this and fix it?
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1785
Location: Oranienburg/Germany

PostPosted: Fri Oct 13, 2017 5:52 am    Post subject: Reply with quote

Hi,

did you set a default route? Please check with

Code:

netstat -rn


greets, bb
_________________
1st: i5-4570, 16GB, 1.75TB
2nd: i5-4570, 16GB, 620GB
3rd: i5-4570, 16GB, 10,5TB
4th: Asus N61VN, 8GB, 240GB
5th: C2D T7200, 2GB, 16GB USB + NFS
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Fri Oct 13, 2017 3:04 pm    Post subject: Reply with quote

'netstat -rn' returns:

Code:
#netstat -rn
Kernel IP routing table
Destination.     Gateway.     Genmask.      Flags.    MSS Window.  irtt. Iface
0.0.0.0.              192.168.1.1 0.0.0.0.          UG.                0 0.            0.  enp4s0
0.0.0.0.               192.168.2.1 0.0.0.0.         UG.                0 0.            0.  wlp3s0
192.168.1.0.      0.0.0.0.        255.255.255.0  U.              0 0.            0.  enp4s0
192.168.2.0.      0.0.0.0.        255.255.255.0. U.              0 0.            0.  wlp3s0

Sorry for all the terminal periods. I'm typing on a phone .

See anything here?

Cheers,

EE
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1785
Location: Oranienburg/Germany

PostPosted: Fri Oct 13, 2017 4:07 pm    Post subject: Reply with quote

Hi,

there is your issue; two default gateways and no metric. Your system doesnt know which way it should go and where the packages return.

greets, bb
_________________
1st: i5-4570, 16GB, 1.75TB
2nd: i5-4570, 16GB, 620GB
3rd: i5-4570, 16GB, 10,5TB
4th: Asus N61VN, 8GB, 240GB
5th: C2D T7200, 2GB, 16GB USB + NFS
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Sat Oct 14, 2017 9:28 am    Post subject: Reply with quote

netstat won't show route metric - you need iproute2 for that

Code:
$ ip r                                                                       
default via 10.73.2.1 dev wlan0 proto static metric 600                                             
10.73.2.0/24 dev wlan0 proto kernel scope link src 10.73.2.30 metric 600                           
169.254.0.0/16 dev wlan0 scope link metric 1000

_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Sun Oct 15, 2017 10:56 am    Post subject: Reply with quote

'ip r' returns:

Code:
#ip r
default via 192.168.1.1 dev enp4s0 metric 2 linkdown
default via 192.168.2.1 dev wlp3s0 src 192.168.2.52 metric 304
192.168.1.0/24 dev enp4s0 proto kernel scope link src 192.168.1.3 linkdown
192.168.2.0/24 dev wlp3s0 proto kernel scope link src 192.168.2.52 metric 304

When I'm at home I use ethernet (enp4s0) but when elsewhere use WiFi (wlp3s0). Is something misconfigured here?

Cheers,

EE
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Sun Oct 15, 2017 5:30 pm    Post subject: Reply with quote

Does it start working either after removing this route manually:
Code:
default via 192.168.1.1 dev enp4s0 metric 2 linkdown

or restarting dhcpcd?
Lower metric has higher priority, so it is possible that you attempt to send packets via a disconnected wired NIC. I never really used dhcpcd in daemon mode, don't know how it handles such cases.
I don't move my box very often, and I've always had more "gui friendly" managers on my laptops.
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Sun Oct 15, 2017 5:39 pm    Post subject: Reply with quote

I didn't get better results restarting dhcpcd; how do I remove that route manually?

Cheers,

EE
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Sun Oct 15, 2017 9:26 pm    Post subject: Reply with quote

Code:
ip route del default dev enp4s0

Did the default route go away from wired NIC after restarting dhcpcd? (And before invoking the above command)
Back to top
View user's profile Send private message
ExecutorElassus
Veteran
Veteran


Joined: 11 Mar 2004
Posts: 1170
Location: Stuttgart, Germany

PostPosted: Mon Oct 16, 2017 9:15 am    Post subject: Reply with quote

no, restarting dhcpcd did not remove that route. However, removing it manually did enable me to get a working internet, hurrah!

Now: how do I ensure that the routes associated with enp4s0 aren't active when I'm not connected to an ethernet cable, so that only the routes associated with wlp3s0 are used?

Thanks for the help! It's almost there!

EE
Back to top
View user's profile Send private message
nokilli
Apprentice
Apprentice


Joined: 25 Feb 2004
Posts: 195

PostPosted: Mon Oct 16, 2017 9:22 am    Post subject: Reply with quote

Not saying this is right, but I've always been manually starting and stopping these things.

Code:
rc-service net.wlan0 stop

Code:
rc-service net.enp5s0 start


And I've never had the issues you're experiencing. Then too, I don't run a Gnome or KDE which handles this stuff for you.
_________________
Today is the first day of the rest of your Gentoo installation.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum