config file for second network device

Issues related to configuring your network
Post Reply
silentbirdie
Posts: 1
Joined: 2020/09/13 20:57:57

config file for second network device

Post by silentbirdie » 2020/09/13 21:03:27

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.

User avatar
TrevorH
Forum Moderator
Posts: 29915
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: config file for second network device

Post by TrevorH » 2020/09/13 22:00:22

One way is to copy the existing one and edit it, changing MAC address, and mentions of one device name to the other.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 3180
Joined: 2007/12/11 08:17:33
Location: Finland

Re: config file for second network device

Post by jlehtone » 2020/09/14 06:49:00

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.

Post Reply

Return to “CentOS 7 - Networking Support”