[CentOS] Network configuration: desktop vs. laptop

Sat Apr 8 20:57:18 UTC 2017
Nicolas Kovacs <info at microlinux.fr>

Hi,

I'm just migrating some stuff from Slackware Linux to CentOS, and I have
a question about the orthodox way of configuring a network connection.

On a desktop or workstation, I usually get rid of NetworkManager:

  # systemctl stop NetworkManager
  # yum remove NetworkManager

Then I edit the /etc/sysconfig/network-scripts/ifcfg-XXXXX file
corresponding to my network interface. Here's a working example:

  # /etc/sysconfig/network-scripts/ifcfg-enp2s0
  DEVICE=enp2s0
  TYPE=Ethernet
  ONBOOT=yes
  BOOTPROTO=dhcp

Now I wonder how I should configure things on a laptop, where I usually
keep NetworkManager. On a Slackware system, it's usually just a matter
of leaving a pristine /etc/rc.d/rc.inet1.conf file, and then activate
/etc/rc.d/rc.networkmanager. Starting from there, when there's a
wireless connection available, I can connect using the little
NetworkManager applet on the desktop. And when I switch to cable,
NetworkManager will prefer that connection automagically.

On a default installation (I went for the KDE version), NetworkManager
is active, so I'll keep that. 'ifconfig' shows me that the cabled
connection is up and running via enp3s0 on the laptop. Wireless doesn't
seem to work, but 'ifconfig -a' shows me a wlp2s0 interface, which means
there's a chance it will work.

First thing I did was edit ifcfg-enp3s0 like this:

  DEVICE="enp3s0"
  TYPE="Ethernet"
  NM_CONTROLLED="yes"

Then I edited ifcfg-wlp2s0 from scratch, since there's nothing present:

  DEVICE="wlp2s0"
  TYPE="Wireless"
  NM_CONTROLLED="yes"

I rebooted (just to be on the safe side), and I have a partial success.
I can connect via KDE's NetworkManager applet. But when I plug in an
Ethernet cable, the wireless connection stays up and is not replaced by
the cabled connection.

Any suggestions?

Niki Kovacs
-- 
Microlinux - Solutions informatiques durables
7, place de l'église - 30730 Montpezat
Web  : http://www.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32