# /etc/sysconfig/network-scripts/ifcfg-eth# The system reads the network interface files during the boot process to determine which interfaces to bring up and how to configure them. The file name format of the network interface configuration file is /etc/sysconfig/network-scripts/ifcfg-eth#. So if you want to configure the interface eth0, the file to be edited is /etc/sysconfig/network-scripts/ifcfg-eth0.
Below is a sample eth0 interface configuration file.
# cat /etc/sysconfig/network-scripts/ifcfg-enp134s1f0 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=eth0 UUID=... ONBOOT=yes HWADDR=0e:a5:1a:b6:fc:86 IPADDR0=172.31.24.10 PREFIX0=23 GATEWAY0=172.31.24.1 DNS1=192.168.154.3 DNS2=10.216.106.3 DOMAIN=example.com IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
A description of some of these configuration parameters follows:
TYPE=device_type: The type of network interface device
BOOTPROTO=protocol: Where protocol is one of the following:
- none: No boot-time protocol is used.
- bootp: Use BOOTP (bootstrap protocol).
- dhcp: Use DHCP (Dynamic Host Configuration Protocol).
DEFROUTE|IPV6_DEFROUTE=answer: Where answer is one of the following:
- yes: This interface is set as the default route for IPv4|IPv6 traffic.
- no: This interface is not set as the default route.
IPV6INIT=answer: Where answer is one of the following:
- yes: Enable IPv6 on this interface. If IPV6INIT=yes, the following parameters could also be set in this file:
- IPV6ADDR=IPv6 address
- IPV6_DEFAULTGW=The default route through the specified gateway
- no: Disable IPv6 on this interface.
IPV4_FAILURE_FATAL|IPV6_FAILURE_FATAL=answer: Where answer is one of the following:
- yes: This interface is disabled if IPv4 or IPv6 configuration fails.
- no: This interface is not disabled if configuration fails.
ONBOOT=answer: Where answer is one of the following:
- yes: This interface is activated at boot time.
- <strong<no< strong=””>: This interface is not activated at boot time.</strong<no<>
HWADDR=MAC-address: The hardware address of the Ethernet device
IPADDRN=address: The IPv4 address assigned to the interface
PREFIXN=N: Length of the IPv4 netmask value
GATEWAYN=address: The IPv4 gateway address assigned to the interface. Because an interface can be associated with several combinations of IP address, network mask prefix length, and gateway address, these are numbered starting from 0.
DNSN=address: The address of the Domain Name Servers (DNS)
DOMAIN=DNS_search_domain: The DNS search domain
Additional Network Configuration Files
In addition to the individual network interface configuration files in the /etc/sysconfig/network-scripts directory, there are other, more global network configuration files. These files are:
This file associates host names with IP addresses. It resolves or looks up, an IP address when the hostname is known. Larger networks would use Domain Name Service (DNS) to perform this resolution. Even if using DNS, include in this file a line specifying the IP address of the loopback device (127.0.0.1) as localhost.localdomain. A sample /etc/hosts file follows. The first column contains the IP address. The second column is the fully qualified hostnames. Additional columns contain hostname aliases:
# cat /etc/hosts 127.0.0.1 localhost.localdomain localhost 192.0.2.101 host01.example.com. host01
The resolver configuration file provides access to DNS. This file usually has at least two lines, one line specifying the IP address of a DNS server (or name server) and the other specifying the search domain. The following example shows three name servers and the search domain:
# cat /etc/resolv.conf search example.com nameserver 192.168.154.2 nameserver 126.96.36.199 nameserver 188.8.131.52
This file specifies global network settings. For example, you can specify the default gateway in this file:
# cat /etc/sysconfig/network GATEWAY=192.168.2.1
This file is the system databases and name service switch configuration file. It provides sources for common configuration databases and name resolution mechanisms. Entries in this file identify the database name in the first field, then a colon, and then a list of possible resolution mechanisms in the second field. The order in which the mechanisms are listed determines the order in which queries on the specified database are resolved.
The following example indicates that host name resolution is attempted first by querying local files, that is, /etc/hosts, and then by querying the DNS server if the host name is not resolved:
# cat /etc/nsswitch.conf ... hosts: files dns ...
What’s inside this eBook?
This book contains 28 chapters with a total of 464 pages, which covers all official exam objectives for the RHCSA and RHCE exams based on Red Hat Enterprise Linux 7, including:
RHCSA Section (chapters 1 to 15)
- Chapter 1: Learn Essential Commands & System Documentation
- Chapter 2: How to Perform File and Directory Management
- Chapter 3: Manage Users and Groups
- Chapter 4: Text File Editing and Analyze
- Chapter 5: Learn Process Management
- Chapter 6: Configure and Encrypt System Storage
- Chapter 7: Learn Access Control Lists and Mount Network NFS Shares
- Chapter 8: Secure and Enable Network Services
- Chapter 9: Setting Up Web and FTP
- Chapter 10: Linux Package Management, Cron Scheduling and Monitoring Logs
- Chapter 11: Manage Firewall and Network Traffic
- Chapter 12: Automate Installations Using Kickstart
- Chapter 13: Learn Access Control Essentials with SELinux
- Chapter 14: Setting Up LDAP-based Authentication
- Chapter 15: Host Virtualization and Guest Administration
RHCE Section (chapters 1 to 13)
- Chapter 1: Setup Static Network Routing
- Chapter 2: Kernel and Network Management
- Chapter 3: Monitor and Generate System Activity Reports
- Chapter 4: Automate Tasks Using Shell Scripts
- Chapter 5: System Log Management
- Chapter 6: Setup Network File Sharing with Clients
- Chapter 7: Setup Network Sharing with Client Authentication
- Chapter 8: HTTPS and NSS Implementation on Web Servers
- Chapter 9: Simple Mail Transfer Protocol (SMTP)
- Chapter 10: Cofigure Cache-only DNS Server
- Chapter 11: Network Bonding or Teaming NIC
- Chapter 12: iSCSI Target Initiator Setup
- Chapter 13: MariaDB Installation, Configuration and Usage
Each chapter explains important topics and relevant exam objectives in the beginning and ends with a summary followed by questions and answers.
For that reason, we present you with the opportunity to buy this ebook for $39.99 as a limited offer. With your purchase, you will help support CompTIAbible.com so that we can continue bringing you high-quality articles for free on a daily basis as always.