View previous topic :: View next topic |
Author |
Message |
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1602 Location: Fayetteville, NC, USA
|
Posted: Sat Mar 26, 2016 8:03 pm Post subject: NetworkManager overriding static IP... |
|
|
I have a strange issue in Gentoo that does not exist in Debian. If I set a static address on an interface in Gentoo, NM takes over once a user logs into the system and gets a new address from DHCP. How can I prevent this? We use NM for VPN so we do need it, but we do not want it overriding the system defaults. _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
Posted: Wed Mar 30, 2016 1:32 pm Post subject: Re: NetworkManager overriding static IP... |
|
|
The_Great_Sephiroth wrote: | If I set a static address on an interface in Gentoo, | Has it been set manually or via dhcpcd-ui?
What does the /etc/dhcpcd.conf entry look like? |
|
Back to top |
|
|
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1602 Location: Fayetteville, NC, USA
|
Posted: Mon Apr 04, 2016 1:14 pm Post subject: |
|
|
I set it in /etc/conf.d/net per the Gentoo guide. I then symlink /etc/init.d/net.lo to /etc/init.d/net.enp0s25. Upon boot, I have the correct address. Once I log into K, NM takes over and over-writes it. _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
|
Back to top |
|
|
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1602 Location: Fayetteville, NC, USA
|
Posted: Mon Apr 25, 2016 1:46 pm Post subject: |
|
|
Back again with this problem. I disabled everything else and made a system connection in NM, but I do not know how to tell NM to use the connection on boot. It seems dead set on using DHCP. There are no networking items in my runlevels EXCEPT NM. How do I tell NM to use said connection when it starts instead of using DHCP? This is driving me crazy! I cannot believe how hard it is to do such a trivial task here! We use NM for VPN connections so we NEED it, but it has zero support for anything but DHCP on boot? That is insane!
Also, if you can recommend something as simple to use as NM for the brainless ones that work here and do not understand the CLI, I may be open to change, but I cannot fathom how such a feature-rich app falls on its face when it comes to a static address on boot. _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Tue Apr 26, 2016 7:45 am Post subject: |
|
|
In the NetworkManager GUI front-end (plasma-nm or nm-applet, or whatever you are using), did you tick 'Automatically connect to this network when it is available' for the connection with a static IP address and also make sure no other connection has that option ticked? You can edit NetworkManager's system connections configuration file directly (it is in the directory /etc/NetworkManager/system-connections/) rather than doing it via the GUI, and change 'autoconnect=false' to 'autoconnect=true' (or add 'autoconnect=true' if the autoconnect option is not listed already in the file). Here is an example (addresses anonymised):
Code: | # cat /etc/NetworkManager/system-connections/Office\ Wired\ Network
[connection]
id=Office Wired Network
uuid=xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx
type=ethernet
autoconnect=true
permissions=user:fitzcarraldo:;
secondaries=
[ethernet]
mac-address=xx:xx:xx:xx:xx:xx
mac-address-blacklist=
[ipv4]
address1=xx.xx.xx.xxx/24,xx.xx.xx.x
dns=xxx.xx.xx.xx;xxx.xx.xx.xx;xxx.xx.xx.xx;xxx.xx.x.xx;
dns-search=
may-fail=false
method=manual
[ipv6]
dns-search=
method=ignore |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1602 Location: Fayetteville, NC, USA
|
Posted: Tue Apr 26, 2016 4:13 pm Post subject: |
|
|
I did, but when I edited the connections I do not remember seeing the "autoconnect" line. That is PROBABLY the issue. I will report back. _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Wed Apr 27, 2016 4:58 am Post subject: |
|
|
While you're at it, as NetworkManager manages everything it would be worth you double checking a few other things to make sure your installation is configured correctly to use NetworkManager.
You should not have any netifrc and DHCP services configured to run independently of NetworkManager (NetworkManager takes care of everything itself, launching the DHCP client you chose* as and when it needs to):
Code: | # rc-update show -v | grep dhcp
dhcpcd |
dhcpd |
# rc-update show -v | grep net
net-online |
net.enp4s0f1 |
net.lo |
netmount | default |
* In my case, I merged NetworkManager with the DHCP client USE flags "dhclient" and "-dhcpcd", i.e. I chose to make NetworkManager use dhclient rather than dhcpcd. I used to make NetworkManager use dhcpcd instead of dhclient ("-dhclient" and "dhcpcd"), but in the last few releases of NetworkManager I found that my laptop was not obtaining a lease, so I switched to dhclient. Actually, the NetworkManager developers favour dhclient over dhcpcd:
Dan Williams wrote: | If NetworkManager was built with support for dhclient or dhcpcd, you can use either of these clients by setting this option to the client’s name. Note that if you enable both dhclient and dhcpcd, dhclient will be preferred for maximum compatibility. |
https://blogs.gnome.org/dcbw/2015/02/16/networkmanager-for-administrators-part-1/
I have specified the DHCP client explicitly in /etc/NetworkManager/NetworkManager.conf:
Code: | [main]
plugins=keyfile
rc-manager=none
dhcp=dhclient
no-auto-default=*
[keyfile]
hostname=clevow230s |
(See man NetworkManager.conf for all the possible settings.)
Additionally, if, like me, you want to use the netmount service to mount network file systems, then check that NetworkManager is specified in /etc/conf.d/netmount:
Code: | # grep "^rc_need" /etc/conf.d/netmount
rc_need="NetworkManager" |
If you don't use the netmount service, then stop it from being launched at start-up:
Code: | # rc-update del netmount default |
By default, NetworkManager manages /etc/resolv.conf itself ("-resolvconf" USE flag when you merge net-misc/networkmanager) instead of it launching resolvconf to do it, but you can optionally declare 'rc-manager=none' in /etc/NetworkManager/NetworkManager.conf to tell NetworkManager explicitly to manage /etc/resolv.conf itself instead of running resolvconf (as I have done in NetworkManager.conf -- see above). Here is what /etc/resolv.conf contains at the moment on my laptop (I'm using an office Wi-Fi network at this precise moment) and, as you can see, it is generated by NetworkManager (IP addresses anonymised):
Code: | $ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver xx.xxx.xxx.xx
nameserver xxx.xx.xxx.xx
nameserver xxx.xx.xxx.xx
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognised.
nameserver 8.8.8.8 |
Here are the USE flags I am currently using in the latest version of NetworkManager available in Gentoo:
Code: | # eix -I networkmanager
[I] net-misc/networkmanager
Available versions: 1.0.6-r1 1.0.10-r1 1.0.12 1.0.12-r1 {bluetooth connection-sharing consolekit +dhclient dhcpcd gnutls +introspection +modemmanager ncurses +nss +ppp resolvconf selinux systemd teamd test vala +wext +wifi zeroconf ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" KERNEL="linux"}
Installed versions: 1.0.12-r1(10:55:59 18/04/16)(bluetooth consolekit dhclient introspection modemmanager ncurses nss ppp wext wifi zeroconf -connection-sharing -dhcpcd -gnutls -resolvconf -selinux -systemd -teamd -test -vala ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" KERNEL="linux")
Homepage: https://wiki.gnome.org/Projects/NetworkManager
Description: A set of co-operative tools that make networking simple and straightforward |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1602 Location: Fayetteville, NC, USA
|
Posted: Wed Apr 27, 2016 5:04 pm Post subject: |
|
|
Thank you, but the autoconnect entry seems to be the missing variable here.
Code: |
officemgr ~ # rc-update show -v | grep dhcp
dhcpd |
officemgr ~ # rc-update show -v | grep net
net-online |
net.enp0s25 |
net.lo |
netmount | default
|
As you can see, nothing is starting. NM is set to run in default. It works great now, so thank you VERY much for the help. I cannot figure out why the autoconnect entry was not added despite being set to connect automatically, but it works now. This means I can still use NM for VPN (users can simply click the icon in KDE, click the VPN which is needed, then enter their password to connect) and I don't have to confuse normal users! _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
|
|
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
|
|