Page 1 of 1

config file for second network device

Posted: 2020/09/13 21:03:27
by silentbirdie
ok so i have a virtual machine set up for a school assignement where i need to allow forwarding using iptables. the only issue i am having is whenever i try to have a second network interface there is never a second config file in /etc/sysconfig/network-scripts/ my first card that was setup automatically on install has the file ifcfg-ens33, my second network card doesn't have a file called ifcfg-ens37 to configure it. how to i get my operating system to create this file or how to i create it so the system uses the file and load up the settings? I can do it via gui but would like to kow how to do it via command line for future reference.

Re: config file for second network device

Posted: 2020/09/13 22:00:22
by TrevorH
One way is to copy the existing one and edit it, changing MAC address, and mentions of one device name to the other.

Re: config file for second network device

Posted: 2020/09/14 06:49:00
by jlehtone
silentbirdie wrote:
2020/09/13 21:03:27
I can do it via gui but would like to kow how to do it via command line for future reference.
CentOS 7 has two services that can configure network settings: NetworkManager.service and network.service.
Only one of them can manage any given interface/connection and it is usually better, if only one service is enabled.
NetworkManager.service is the default. Its command line tool is nmcli.

Code: Select all

man nmcli
man nmcli-examples
One does not "edit a file" for NetworkManager. One uses NM tools (GUI applet, nmtui, nmcli) that modify files for you.