Configure networking with different nics

Issues related to configuring your network
Post Reply
davidkoenig09
Posts: 4
Joined: 2018/10/24 04:50:26

Configure networking with different nics

Post by davidkoenig09 » 2018/10/30 12:40:27

Hi,

i created script to configure my Network. A command can be

Code: Select all

's/ONBOOT="no"/ONBOOT="yes"/g' /etc/sysconfig/network-scripts/ifcfg-enp0s3
The problem i currently have, is that the Name of the Network Card changes, depending on the environment i use. In my local virtualbox, the file is called "ifcfg-enp0s3", in our company internal cloud system it is called "ifcfg-eth0". How do is CentOS defining the names of the cards? Is there a script pattern to find out what is the right name? Or is there a list of known network-card-names?

Regards

Dave

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Configure networking with different nics

Post by hunter86_bg » 2018/11/01 05:03:46

The network naming was modified to be more consistent and it is created based on the location of the NIC on the server.
If you use KVM host for virtualization, with virtio NICs, all your interfaces will use the old naming convention.
As per my opinion, you can use

Code: Select all

nmcli device
to get the device list and then using nmcli to set your connections.
Another option is to use %post-install section of a kickstart in order to easily build and configure your machines.

Post Reply