![]() | Red Hat Certified System Administration 8 |
Chapter 08: Configuring NetworkingSommaireGoalTo configure basic IPv4 networking on Red Hat Enterprise Linux systems.InterfacesUsual Commands[root@lab ~]# ping IP address test connectivity with ICMP packets sending[root@lab ~]# ping -cn IP [root@lab ~]# ping -c5 host Interfaces NamingLe nom attribué aux interfaces réseaux par le système est constitué de 3 Parties- La première partie indique le type ou la technologie - La seconde partie indique le type d'adaptateur utilisé - La troisième partie est un ID pour identifier de facon unique la carte Network Technology
Network AdapterThe next character(s) represents the type of adapter with an
Interface IDNot used by default but also available to administrators, an x is used to incorporate a MAC address Finally, a number N is used to represent an index , ID, or port. NB
Network interface naming can be overridden. If the administrator has installed and enabled the biosdevname package or set customized udev device naming rules, those settings will override the default naming scheme. Depending on support for biosdevname in the system BIOS, names such as em1, em2, etc . may be used for on board network cards (corresponding to their names on the chassis). PCl (e) cards are represented with pYpX (e.g., p4p1), where Y is the PCIs lot number and X is the number for the port on that specific card Network InterfacesUsual CommandsStatic AddressingMethod 1 : nmstate (RHEL 9)Install nmsate package: ![]() Create YAML format of network cards profile file ![]() Edit YAML file ![]() Apply Profile ![]() NetworkManager Command Line Tool (nmcli)nmcli — command-line tool for controlling NetworkManager and reporting network status.Display Settings
Resolving NamesResolving NamesChanging System Host name[root@lab ~]# hostname Display System Host name[root@lab ~]# hostnamectl set-hostname hostname Change System Host name stored in /etc/hostname [root@lab ~]# hostnamectl status The static host name is stored in /etc/hostname. Previous of Red Hat Enterprise Linux stored the host name as a variable in the /etc/sysconfig/network file. Name ResolvingRed hat uses 2 ways to resolv addresses
1 - Configuration in /etc/hosts FileIP Address hostnameExample 10.0.0.11 redhat.lab.tg 2 - Using DNS serverWe must define DNS server address. We have 2 ways for that:2.1 - in /etc/resolv.conf nameserver DNS Server IP Address nameserver 8.8.8.8 nameserver 4.4.4.4 NB: /etc/resolv.conf editing is temporary. It may change when network service restart Au démarrage le service network configure /etc/resolv.conf avec les infos enregistrées /etc/sysconfig/network-scripts/interfacefile s’il y en a Sinon nous pouvons éditer /etc/resolv.conf mais la configuration se perd à l’arrêt du service network 2.2 - in /etc/sysconfig/network-scripts/interfacefile DNS1=IP DNS2=IP DOMAIN=domain_name DNS1=8.8.8.8 DNS2=4.4.4.4 DOMAIN=lab.bg Files/etc/nsswitch.conf DNS order file/etc/resolv.conf DNS client file We can define their priorities in /etc/nsswitch.conf
Commands[root@lab ~]# host Hostname Resolve name to IP[root@lab ~]# host IP Resolve IP to name Configuration FilesConfiguration Files/etc/services services and their ports /etc/sysconfig/network-scripts/ Network Cards Configuration files Directory /etc/sysconfig/network-scripts/ifcfg-interfacename [+] /etc/nsswitch DNS order file /etc/resolv.conf DNS client file [+] NB: Il est possible d'éditer le fichier /etc/resolv.conf pour indiquer les adresses des serveurs DNS. Mais la configuration sera temporaire car c'est un fichier qui est généré au démarrage du networking Pour configurer les adresses DNS de facon permanente il faur l'éditer dans le fichier de configuration de la carte réseau Ports and ServicesPorts and Servicesnetstat | ss[root@lab ~]# netstat network statistics [root@lab ~]# netstat -a all [root@lab ~]# netstat -t specify TCP connections [root@lab ~]# netstat -u specify UDP connections [root@lab ~]# netstat -r show routage table [root@lab ~]# netstat -c show in real time [root@lab ~]# ss Display Sockets Statistics Check opened port
[root@redhat ~]# nc -t -z 10.0.0.7 80 RoutingRoutingadd a routeactivate routage edit /etc/sysctl.conf net.ipv4.ip_forward = 0 change 0 to 1 tape command sysctl –p to activate settings and show settings Show Routing Table[root@lab ~]# ip route [root@lab ~]# netstat -r [root@lab ~]# tracepath host |