Configure NetworkManager to use dhcp for better connection

User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Configure NetworkManager to use dhcp for better connection

Post by laprjns »

Nate_KS wrote:One thing that could trip up a newcomer to Salix, is anyone who has an OpenWRT router set up as I apparently do, is the failure of Network Manager to maintain a network connection.
Yes, I have a router running OpenWRT and have had this connection problem with all my computers, both wired and wireless running Slackware 14.2 and any derivatives (Salix, Slackel, Slint). Up until now, my solution was to install and run Wicd, but installing WIcd can be somewhat problematic without a solid internet connection.
Nate_KS wrote: To correct that I had to find and install the Slackware dhcp package and then change the Network Manager's DHCP settings.
So I did this also and now I have a solid network connection using. To be a little more expliced, here's what I did to get NetworkManager working with my OpenWRT router.

1) Installed dhcp

Code: Select all

sudo spi -i dhcp
2) Edit the 00-dhcp-client.conf file found in /etc/NetworkManager/conf.d/ to change the dhcp client from dhcpcd to dhclient

Code: Select all

[main]
# Choose a DHCP client below.  Upstream recommends dhclient, but results may vary.
# dhcpcd is the DHCP client usually used by Slackware:
# dhcp=dhcpcd
# dhclient is the ISC reference DHCP client, part of the dhcp package:
dhcp=dhclient
# This is a simple DHCP client that is built into NetworkManager:
# dhcp=internal
3) Restarted the NetworkManger service

Code: Select all

$ sudo service start networkmanager
An viola it worked, solid internet connection using Networkmanager.
Nate_KS wrote: I don't know if this is 100% a Salix issue as Slackware prefers the dhcpcd package at installation time and I had the same issues. The dhcp package is considerably larger which may be part of the reason why dhcpcd is favored.
Slackware does default to the dhcpcd client and the NeworkManager dhcp client configuration file is set up for the dhcpcd client, but it is compounded somewhat by the fact that Salix is not a full Slackware install, meaning that the dhcp package was not installed. I did try several times in the past when trying to fix this problem to make the change to dhclient in the dhcp client configuration file without success. But until I read this post I always assumed ( :oops: ) that dhcpand dhcpd were the same package.

Thanks for posting this, it has help me fix a problem that I've been living with since the first beta releases of 14.2
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
Nate_KS
Posts: 12
Joined: 17. Feb 2017, 17:03
Location: Bremen, KS
Contact:

Re: What is a good distro to recommend for beginners?

Post by Nate_KS »

You're welcome!

Actually, I resolved this when trying the latest Liveslack last month where I ran into the same issue.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: What is a good distro to recommend for beginners?

Post by mimosa »

I can confirm this works with a different libre router I've been using. In general, I've found NM unreliable with wireless connections with some routers. This is generally when I'm away from my trusty home ethernet connection.

I wouldn't be surprised if this smooths over those problems.

Thanks very much, laprjns!
reedych
Posts: 37
Joined: 11. Mar 2017, 05:24

Re: What is a good distro to recommend for beginners?

Post by reedych »

I would recommend them sit on windows. Or if they wants, well, Salix.
User avatar
gapan
Salix Wizard
Posts: 6236
Joined: 6. Jun 2009, 17:40

Re: What is a good distro to recommend for beginners?

Post by gapan »

Nate_KS wrote:To correct that I had to find and install the Slackware dhcp package and then change the Network Manager's DHCP settings.
So, that was it? We've had a couple of reports that NetworkManager wouldn't work (laprjns was one), but nobody else would be able to reproduce it. Obviously (now) because nobody else had OpenWRT routers, but nobody else had made the connection before. Are there any side effects of using dhcp instead of dhcpcd on non-OpenWRT users? I'll have to do some testing with that. But then again, I'm not that certain on how to approach fixing this at this point. The NM configuration files are .new, and are not automatically replaced when upgrading the package (rightly so). Even if we upgraded NM with a default configuration that used dhcp instead of dhcpcd and a new dependency on the dhcp package so it would get installed, the user would still need to change the setting manually.

Maybe the best course of action is just to document it?
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: What is a good distro to recommend for beginners?

Post by mimosa »

And of course, we can consider it for next time.

As I think I've posted above, I don't think it's just those routers; quite often when out and about, I find I get a ropy connection with NM (wireless). Where I am at the moment, this change has proved fully effective. Using Wicd instead generally seems to help, too, but I don't think it did in this case.
User avatar
gapan
Salix Wizard
Posts: 6236
Joined: 6. Jun 2009, 17:40

Re: What is a good distro to recommend for beginners?

Post by gapan »

What is strange is that there are no such problems with wicd + dhcpcd, which is the default there too.
Image
Image
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: What is a good distro to recommend for beginners?

Post by DidierSpaier »

I have seen reports on linuxquestions.org of better behavior setting dhclient instead of dhcpcd as DHCP client for NetworkManager.

To try, edit /etc/NetworkManager/conf.d/00-dhcp-client.conf: comment the line dhcp=dhcpcd and uncomment the line dhcp=dhclient, then restart NetworkManager (sudo /etc/rc.d/rc.networkmanager restart).

Didier

PS don't forget that a slow name server can delay connection a lot . Consider using a Public Recursive Name Server then or set up a local name server.

And when you are satisfied with your setting, do a "sudo chattr +i /etc/resolv.conf" to prevent NetworkManager to change it.

EDIT: I just realized that this has mostly been already posted in the same thread. Sorry for the noise.
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: What is a good distro to recommend for beginners?

Post by laprjns »

I would have resolve this months ago if I didn't have my head up my butt not realizing that I actually had to install the dhcp package.
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
Nate_KS
Posts: 12
Joined: 17. Feb 2017, 17:03
Location: Bremen, KS
Contact:

Re: What is a good distro to recommend for beginners?

Post by Nate_KS »

gapan wrote:So, that was it?
So far, I've not had any issues by using dhclient from the dhcp package.
We've had a couple of reports that NetworkManager wouldn't work (laprjns was one), but nobody else would be able to reproduce it. Obviously (now) because nobody else had OpenWRT routers, but nobody else had made the connection before. Are there any side effects of using dhcp instead of dhcpcd on non-OpenWRT users?
Even though this is on a laptop, I don't roam off my home network often except to tether to my Android phone which NM handles seamlessly. I did spend a night in a hotel in late February and had no issues. I will be in the same hotel this week and expect no issues and I have no idea what WAP the hotel is using.
I'll have to do some testing with that. But then again, I'm not that certain on how to approach fixing this at this point. The NM configuration files are .new, and are not automatically replaced when upgrading the package (rightly so). Even if we upgraded NM with a default configuration that used dhcp instead of dhcpcd and a new dependency on the dhcp package so it would get installed, the user would still need to change the setting manually.

Maybe the best course of action is just to document it?
As previously noted, I resolved this for myself when trying Alienbob's Liveslak image last month. I had to resolve it in this manner on both the Plasma and Xfce images. My searching resulted in some others trying NM's internal DHCP client, which didn't work at all for me. Since I had used NM in the past on Debian with dhclient, I gave that pairing a try and it worked. I've also resolved this issue in the same manner with Slackware 14.2 but didn't have to install the dhcp package as it was already installed.

Knowing the fix and being able to tell those affected by it is probably all that is required at this time.

ETA: I seem to recall that if /etc/rc.d/rc.inet1 is used to setup a connection (in my case the laptop also has a wired Ethernet port) that the network worked fine. That configuration could be used as a means to install the dhcp package if required.
Post Reply