Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 20. 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 NetworkManager connection profiles in keyfile format.
20.1. Configuring an interface with static network settings using ifcfg files Link kopierenLink in die Zwischenablage kopiert!
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
ifcfgfiles, for an interface with the nameenp1s0, create a file with the nameifcfg-enp1s0in the/etc/sysconfig/network-scripts/directory that contains:For
IPv4configuration:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For
IPv6configuration:DEVICE=enp1s0 BOOTPROTO=none ONBOOT=yes IPV6INIT=yes IPV6ADDR=2001:db8:1::2/64
DEVICE=enp1s0 BOOTPROTO=none ONBOOT=yes IPV6INIT=yes IPV6ADDR=2001:db8:1::2/64Copy to Clipboard Copied! Toggle word wrap Toggle overflow
20.2. Configuring an interface with dynamic network settings using ifcfg files Link kopierenLink in die Zwischenablage kopiert!
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
ifcfgfiles, create a file with the nameifcfg-em1in the/etc/sysconfig/network-scripts/directory that contains:DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yes
DEVICE=em1 BOOTPROTO=dhcp ONBOOT=yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow To configure an interface to send:
A different host name to the
DHCPserver, add the following line to theifcfgfile:DHCP_HOSTNAME=hostname
DHCP_HOSTNAME=hostnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow A different fully qualified domain name (FQDN) to the
DHCPserver, add the following line to theifcfgfile:DHCP_FQDN=fully.qualified.domain.name
DHCP_FQDN=fully.qualified.domain.nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow
NoteYou can use only one of these settings. If you specify both
DHCP_HOSTNAMEandDHCP_FQDN, onlyDHCP_FQDNis used.To configure an interface to use particular
DNSservers, add the following lines to theifcfgfile:PEERDNS=no DNS1=ip-address DNS2=ip-address
PEERDNS=no DNS1=ip-address DNS2=ip-addressCopy to Clipboard Copied! Toggle word wrap Toggle overflow where ip-address is the address of a
DNSserver. This will cause the network service to update/etc/resolv.confwith the specifiedDNSservers specified. Only oneDNSserver address is necessary, the other is optional.
20.3. Managing system-wide and private connection profiles with ifcfg files Link kopierenLink in die Zwischenablage kopiert!
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.
Prerequisites
-
The
ifcfgfile already exists.
Procedure
Edit the
ifcfgfile in the/etc/sysconfig/network-scripts/directory that you want to limit to certain users, and add:USERS="username1 username2 ..."
USERS="username1 username2 ..."Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reactive the connection:
nmcli connection up connection_name
# nmcli connection up connection_nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow