Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 18. Configuring ip networking with ifcfg files
Interface configuration (ifcfg
) files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are named ifcfg-name_pass
, where the suffix name refers to the name of the device that the configuration file controls. By convention, the ifcfg
file’s suffix is the same as the string given by the DEVICE
directive in the configuration file itself.
NetworkManager supports profiles stored in the keyfile format. However, by default, NetworkManager uses the ifcfg
format when you use the NetworkManager API to create or update profiles.
In a future major RHEL release, the keyfile format will be default. Consider using the keyfile format if you want to manually create and manage configuration files. For details, see Manually creating NetworkManager profiles in keyfile format.
18.1. Configuring an interface with static network settings using ifcfg files
If you do not use the NetworkManager utilities and applications, you can manually configure a network interface by creating ifcfg
files.
Procedure
To configure an interface with static network settings using
ifcfg
files, for an interface with the nameenp1s0
, create a file with the nameifcfg-enp1s0
in the/etc/sysconfig/network-scripts/
directory that contains:For
IPv4
configuration:DEVICE=enp1s0 BOOTPROTO=none ONBOOT=yes PREFIX=24 IPADDR=10.0.1.27 GATEWAY=10.0.1.1
For
IPv6
configuration:DEVICE=enp1s0 BOOTPROTO=none ONBOOT=yes IPV6INIT=yes IPV6ADDR=2001:db8:1::2/64
Additional resources
-
nm-settings-ifcfg-rh(5)
man page
18.2. Configuring an interface with dynamic network settings using ifcfg files
If you do not use the NetworkManager utilities and applications, you can manually configure a network interface by creating ifcfg
files.
Procedure
To configure an interface named em1 with dynamic network settings using
ifcfg
files, create a file with the nameifcfg-em1
in the/etc/sysconfig/network-scripts/
directory that contains:DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yes
To configure an interface to send:
A different host name to the
DHCP
server, add the following line to theifcfg
file:DHCP_HOSTNAME=hostname
A different fully qualified domain name (FQDN) to the
DHCP
server, add the following line to theifcfg
file:DHCP_FQDN=fully.qualified.domain.name
NoteYou can use only one of these settings. If you specify both
DHCP_HOSTNAME
andDHCP_FQDN
, onlyDHCP_FQDN
is used.To configure an interface to use particular
DNS
servers, add the following lines to theifcfg
file:PEERDNS=no DNS1=ip-address DNS2=ip-address
where ip-address is the address of a
DNS
server. This will cause the network service to update/etc/resolv.conf
with the specifiedDNS
servers specified. Only oneDNS
server address is necessary, the other is optional.
18.3. Managing system-wide and private connection profiles with ifcfg files
By default, all users on a host can use the connections defined in ifcfg
files. You can limit this behavior to specific users by adding the USERS
parameter to the ifcfg
file.
Prerequisite
-
The
ifcfg
file already exists.
Procedure
Edit the
ifcfg
file in the/etc/sysconfig/network-scripts/
directory that you want to limit to certain users, and add:USERS="username1 username2 ..."
Reactive the connection:
# nmcli connection up connection_name