Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:centos:8:admin:l119 [2022/02/22 15:15] adminelearning:workbooks:centos:8:admin:l119 [2022/06/05 17:58] (Version actuelle) – created admin
Ligne 3: Ligne 3:
 Version : **2022.01** Version : **2022.01**
  
-Updated: ~~LASTMOD~~+Updated : ~~LASTMOD~~
  
-======LCE601 - Managing Integrated Peripherals======+======LCE513 - Managing the Network======
  
 =====Contents===== =====Contents=====
  
-  * **LCE601 - Managing Integrated Peripherals**+  * **LCE513 - Managing the Network**
     * Contents     * Contents
-    * Special Files  +    * Presentation 
-    * LAB #1 - Commands +      * The nmcli Command 
-      * 1.1 - The lspci Command +    * LAB #1 - Configuring the Network 
-      * 1.2 - The lsusb Command +      * 1.1 - Connections and Profils 
-      * 1.3 - The dmidecode Command +      * 1.2 - Name Resolution  
-    LAB #2 - The sysctl Command +      * 1.3 - Adding a Second IP Address to a Profile 
-      * 2.1 - The /proc Directory +      1.4 - The hostname Command 
-        Files +      * 1.5 - The ip Command 
-          /proc/cpuinfo +      1.6 - Manually Activating and Disactivating a Device 
-          /proc/interrupts +      1.7 - Static Routing 
-          * /proc/dma +        The ip Command 
-          * /proc/ioports +        * Disactivating/Activating Internal Routing on a Server 
-          * /proc/devices +    * LAB #Diagnostics 
-          * /proc/module +      * 2.1 - The ping Command 
-          * /proc/diskstats +      * 2.2 - The netstat Command 
-          * /proc/partitions +      * 2.3 - The traceroute Command 
-          * /proc/swaps +    LAB #3 - SSH 
-          * /proc/loadavg +      * 3.Presentation 
-          * /proc/meminfo +        SSH-1 
-          * /proc/version +        SSH-2 
-        * Directories +      * 3.2 Configuring the Server 
-          * ide/scsi +      * 3.Configuring the Client 
-          * acpi +      * 3.4 - SCP 
-          * bus +        * Presentation 
-          * net +        * Usage 
-          * sys +      3.5 - Authentication with Asymetric Keys
-      * 2.2 - Using the sysctl Command     +
-    * LAB #Interpreting Information in /proc +
-      * 3.1 - free +
-      * 3.2 - uptime ou w  +
-      * 3.3 - iostat +
-      * 3.4 hdparm +
-      * 3.vmstat +
-      3.6 mpstat +
-      3.7 sar +
-    * USB Modules +
-    * udev +
-      * The udevadm Command +
-    * The /sys Filesystem +
-    * LAB #4 Limiting Ressources +
-      * 4.ulimit +
-      * 4.2 CGroups +
-        * Limiting Memeory Usage +
-        * The cgcreate Command +
-        The cgdelete Command +
-        * The /etc/cgconfig.conf File +
-        * The cgconfigparser Command+
  
-=====Special Files=====+=====Presentation=====
  
-In a PC, peripherals are connected to a **controler** which communicates with the processor via a **bus**The controller and associated peripherals require specific drivers. Under Linux, these drivers are normally supplied as kernel **modules**. Each peripheral is represented by special file in the **/dev** directory. Each special file contains the information required by the system in order for it to use the driver.+RHEL/CentOS 8 uses **Network Manager** to manage the networkNetwork Manager is composed of two things: 
 + 
 +  * a service that manages the connections and reports on their status, 
 +  front-ends that use an API to configure the service.
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-Peripherals that require the system to be halted prior to plugging or unplugging them are refered to as **Cold Plug Devices**. Peripherals that can be plugged/unplugged whilst the system is running are refered to as **Hot Plug Devices**.+**Important** : Note that IPv6 is activated by default.
 </WRAP> </WRAP>
  
-The following output shows the typical content of the /dev directory:+Start by checking the status of the service:
  
 <code> <code>
-[root@centos8 ~]# ls -l /dev | more +[root@centos8 ~]# systemctl status NetworkManager.service 
-total 0 +● NetworkManager.service Network Manager 
-crw-r--r-- 1 root root     10, 235 Jun 28 02:04 autofs +   Loadedloaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor pr
-drwxr-xr-x 2 root root         180 Jun 28 02:04 block +   Activeactive (running) since Thu 2021-07-22 05:05:29 EDT; months 7 days ago 
-drwxr-xr-x.  2 root root         100 Jun 28 02:04 bsg +     Docsman:NetworkManager(8) 
-drwxr-xr-x.  3 root root          60 Jun 28 02:04 bus + Main PID1002 (NetworkManager) 
-lrwxrwxrwx 1 root root           3 Jun 28 02:04 cdrom -sr0 +    Tasks: 3 (limit23535) 
-drwxr-xr-x.  2 root root        2940 Jun 28 02:04 char +   Memory6.8M 
-drwxr-xr-x.  2 root root          80 Jun 28 02:04 cl_centos8 +   CGroup/system.slice/NetworkManager.service 
-crw-------.  1 root root      5,   1 Jun 28 02:04 console +           └─1002 /usr/sbin/NetworkManager --no-daemon
-lrwxrwxrwx.  root root          11 Jun 28 02:04 core -> /proc/kcore +
-drwxr-xr-x. 10 root root         200 Jun 28 02:04 cpu +
-crw-------.  1 root root     10,  62 Jun 28 02:04 cpu_dma_latency +
-drwxr-xr-x.  6 root root         120 Jun 28 02:04 disk +
-brw-rw----.  1 root disk    253,   0 Jun 28 02:04 dm-0 +
-brw-rw----.  1 root disk    253,   1 Jun 28 02:04 dm-1 +
-drwxr-xr-x.  root root          80 Jun 28 02:04 dri +
-crw-rw----.  1 root video    29,   0 Jun 28 02:04 fb0 +
-lrwxrwxrwx 1 root root          13 Jun 28 02:04 fd -> /proc/self/fd +
-crw-rw-rw-.  1 root root      1,   7 Jun 28 02:04 full +
-crw-rw-rw- 1 root root     10, 229 Jun 28 02:04 fuse +
-crw------- 1 root root    245,   0 Jun 28 02:04 hidraw0 +
-crw-------.  1 root root     10, 228 Jun 28 02:04 hpet +
-drwxr-xr-x.  3 root root           0 Jun 28 02:04 hugepages +
-crw-------.  1 root root     10, 183 Jun 28 02:04 hwrng +
-lrwxrwxrwx.  1 root root          12 Jun 28 02:04 initctl -> /run/initctl +
-drwxr-xr-x.  4 root root         280 Jun 28 02:04 input +
-crw-r--r--.  1 root root      1,  11 Jun 28 02:04 kmsg +
-lrwxrwxrwx.  1 root root          28 Jun 28 02:04 log -> /run/systemd/journal/dev-log +
-crw-rw----.  1 root disk     10, 237 Jun 28 02:04 loop-control +
-crw-rw----.  1 root lp        6,   0 Jun 28 02:04 lp0 +
-crw-rw----.  1 root lp        6,   1 Jun 28 02:04 lp1 +
-crw-rw----.  1 root lp        6,   2 Jun 28 02:04 lp2 +
-crw-rw----.  1 root lp        6,   3 Jun 28 02:04 lp3 +
-drwxr-xr-x.  2 root root         100 Jun 28 02:04 mapper +
-crw-------.  1 root root     10, 227 Jun 28 02:04 mcelog +
-crw-r-----.  1 root kmem      1,   1 Jun 28 02:04 mem +
-drwxrwxrwt.  2 root root          40 Jun 28 02:04 mqueue +
-drwxr-xr-x.  2 root root          60 Jun 28 02:04 net +
-crw-rw-rw-.  1 root root      1,   3 Jun 28 02:04 null +
---More-- +
-</code>+
  
-As you can see, certain files refer to **block** devices whilst others refer to **character** devices +WarningJournal has been rotated since unit was started. Log output is incomplete or
- +lines 1-11/11 (END) 
-<code+[^q] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Type CONTROL Q
-... +
-brw-rw----.  1 root disk      8,   Jun 28 02:04 sda1 +
-... +
-crw-rw-rw-.  1 root tty       5,   0 Jun 28 02:04 tty +
-...+
 </code> </code>
  
-The major difference between these two types lies in the way that the communication between the system and the peripheral takes place. In the case of a block file, that communication uses a buffer whilst in the case of a character file the communication takes place directly byte by byte.+===The nmcli Command===
  
-The figures that can be seen immediately before the date of the special file are called respectively the **major** and the **minor** :+The Network Manager Command Line Interface or **nmcli** is used to configure NetworkManager.
  
-  * the **major** identifies the peripheral's driver, +The command line switches of the nmcli command are:
-  * the **minor** identifies the peripheral. For instance 8,1 indicates the first partition of the **sda** disk. +
- +
-=====LAB #1 - Commands===== +
- +
-====1.1 - The lspci Command==== +
- +
-This command show a list of the peripherals connected to the PCI, AGP and PCI express buses:+
  
 <code> <code>
-[root@centos8 ~]# lspci +[root@centos8 ~]# nmcli help 
-00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma(rev 02) +Usagenmcli [OPTIONSOBJECT { COMMAND | help }
-00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] +
-00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] +
-00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) +
-00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) +
-00:02.0 VGA compatible controller: Device 1234:1111 (rev 02) +
-00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon +
-00:07.0 SATA controller: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] (rev 02) +
-00:12.0 Ethernet controller: Red Hat, Inc. Virtio network device +
-00:1e.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge +
-00:1f.0 PCI bridge: Red Hat, Inc. QEMU PCI-PCI bridge +
-</code>+
  
-To obtain peripheral specific information, use the **-v** or **-vv** switches whilst specifying the peripheral ID:+OPTIONS 
 +  -a--ask                                ask for missing parameters 
 +  -c, --colors auto|yes|no                 whether to use colors in output 
 +  -e, --escape yes|no                      escape columns separators in values 
 +  -f, --fields <field,...>|all|common      specify fields to output 
 +  -g, --get-values <field,...>|all|common  shortcut for -m tabular -t -f 
 +  -h, --help                               print this help 
 +  -m, --mode tabular|multiline             output mode 
 +  -o, --overview                           overview mode 
 +  -p, --pretty                             pretty output 
 +  -s, --show-secrets                       allow displaying passwords 
 +  -t, --terse                              terse output 
 +  -v, --version                            show program version 
 +  -w, --wait <seconds>                     set timeout waiting for finishing operations
  
-<code> +OBJECT 
-[root@centos8 ~]# lspci -v -00:03.0 +  g[eneral      NetworkManager'general status and operations 
-00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon +  n[etworking   overall networking control 
-        Subsystem: Red Hat, Inc. Device 0005 +  r[adio        NetworkManager radio switches 
-        Physical Slot: 3 +  c[onnection   NetworkManager's connections 
-        Flags: bus master, fast devsel, latency 0, IRQ 10 +  d[evice]        devices managed by NetworkManager 
-        I/O ports at e000 [size=64+  a[gent        NetworkManager secret agent or polkit agent 
-        Memory at fe400000 (64-bit, prefetchable) [size=16K+  m[onitor      monitor NetworkManager changes
-        Capabilities: [84Vendor Specific Information: VirtIO: <unknown> +
-        Capabilities: [70] Vendor Specific Information: VirtIO: Notify +
-        Capabilities: [60Vendor Specific Information: VirtIO: DeviceCfg +
-        Capabilities: [50Vendor Specific Information: VirtIO: ISR +
-        Capabilities: [40] Vendor Specific Information: VirtIO: CommonCfg +
-        Kernel driver in use: virtio-pci+
 </code> </code>
  
-<code> +=====LAB #1 - Configuring the Network=====
-[root@centos8 ~]# lspci -vv -s 00:03.0 +
-00:03.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon +
-        Subsystem: Red Hat, Inc. Device 0005 +
-        Physical Slot: 3 +
-        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- +
-        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- +
-        Latency: 0 +
-        Interrupt: pin A routed to IRQ 10 +
-        Region 0: I/O ports at e000 [size=64] +
-        Region 4: Memory at fe400000 (64-bit, prefetchable) [size=16K] +
-        Capabilities: [84] Vendor Specific Information: VirtIO: <unknown> +
-                BAR=0 offset=00000000 size=00000000 +
-        Capabilities: [70] Vendor Specific Information: VirtIO: Notify +
-                BAR=4 offset=00003000 size=00001000 multiplier=00000004 +
-        Capabilities: [60] Vendor Specific Information: VirtIO: DeviceCfg +
-                BAR=4 offset=00002000 size=00001000 +
-        Capabilities: [50] Vendor Specific Information: VirtIO: ISR +
-                BAR=4 offset=00001000 size=00001000 +
-        Capabilities: [40] Vendor Specific Information: VirtIO: CommonCfg +
-                BAR=4 offset=00000000 size=00001000 +
-        Kernel driver in use: virtio-pci +
-</code>+
  
-===Command Line Switches===+====1.1 - Connections and Profiles====
  
-The command line switches of this command are:+NetworkManager uses **connections** and **profiles** that allow for different configurations of the same interface or **device**. To see the current connections, use the following command:
  
 <code> <code>
-[root@centos8 ~]# lspci --help +[root@centos8 ~]# nmcli c show 
-lspci: invalid option -- '-' +NAME    UUID                                  TYPE      DEVICE  
-Usage: lspci [<switches>+ens18   fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  ens18   
- +virbr0  03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0 
-Basic display modes: +
--mm             Produce machine-readable output (single -m for an obsolete format) +
--t              Show bus tree +
- +
-Display options: +
--v              Be verbose (-vv or -vvv for higher verbosity) +
--k              Show kernel drivers handling each device +
--x              Show hex-dump of the standard part of the config space +
--xxx            Show hex-dump of the whole config space (dangerous; root only) +
--xxxx           Show hex-dump of the 4096-byte extended config space (root only) +
--b              Bus-centric view (addresses and IRQ's as seen by the bus) +
--D              Always show domain numbers +
--P              Display bridge path in addition to bus and device number +
--PP             Display bus path in addition to bus and device number +
- +
-Resolving of device ID's to names: +
--n              Show numeric ID's +
--nn             Show both textual and numeric ID's (names & numbers) +
--q              Query the PCI ID database for unknown ID's via DNS +
--qq             As above, but re-query locally cached entries +
--Q              Query the PCI ID database for all ID's via DNS +
- +
-Selection of devices: +
--s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]   Show only devices in selected slots +
--d [<vendor>]:[<device>][:<class>             Show only devices with specified ID's +
- +
-Other options: +
--i <file>       Use specified ID database instead of /usr/share/hwdata/pci.ids +
--p <file>       Look up kernel modules in a given file instead of default modules.pcimap +
--M              Enable `bus +
 </code> </code>
  
-====1.2 - The lsusb Command==== +Now create another profile attached to **ens18** :
- +
-This command show a list of the peripherals connected to the USB bus:+
  
 <code> <code>
-[root@centos8 ~]# lsusb +[root@centos8 ~]# nmcli connection add con-name ip_fixed ifname ens18 type ethernet ip4 10.0.2.46/24 gw4 10.0.2.1 
-Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd  +Connection 'ip_fixed' (0f48c74d-5d16-4c37-8220-24644507b589) successfully added.
-Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub +
- +
-[root@centos8 ~]# lsusb -vt +
-/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M +
-    |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M+
 </code> </code>
  
-===Command Line Switches=== +Check that it is visible:
- +
-The command line switches of this command are:+
  
 <code> <code>
-[root@centos8 ~]# lsusb --help +[root@centos8 ~]# nmcli c show 
-Usage: lsusb [options]... +NAME     UUID                                  TYPE      DEVICE  
-List USB devices +ens18    fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  ens18   
-  -v, --verbose +virbr0   03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0  
-      Increase verbosity (show descriptors) +ip_fixed 0f48c74d-5d16-4c37-8220-24644507b589  ethernet  --   
-  -s [[bus]:][devnum] +
-      Show only devices with specified device and/or +
-      bus numbers (in decimal) +
-  -d vendor:[product] +
-      Show only devices with the specified vendor and +
-      product ID numbers (in hexadecimal) +
- .LAB#1 +
-  -D device +
-      Selects which device lsusb will examine +
-  -t, --tree +
-      Dump the physical USB device hierarchy as a tree +
-  -V, --version +
-      Show version of program +
-  -h, --help +
-      Show usage and help+
 </code> </code>
  
-====1.3 - The dmidecode Command==== +Note that the output does not show that the **ip_fixed** profile is associated with **ens18** device because it has not yet been activated:
- +
-The **dmidecode** Command reads the **DMI** (//Desktop Management Interface//) table, also called the **SMBIOS** (//System Management BIOS//) and provides information on: +
- +
-  * the current status of each peripheral, +
-  * possible extensions.+
  
 <code> <code>
-[root@centos8 ~]# dmidecode +[root@centos8 ~]# nmcli d show 
-# dmidecode 3.2 +GENERAL.DEVICE:                         ens18 
-Getting SMBIOS data from sysfs+GENERAL.TYPE:                           ethernet 
-SMBIOS 2.8 present+GENERAL.HWADDR:                         4E:B1:31:BD:5D:B2 
-11 structures occupying 511 bytes+GENERAL.MTU:                            1500 
-Table at 0x000F5870.+GENERAL.STATE:                          100 (connected) 
 +GENERAL.CONNECTION:                     ens18 
 +GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> 
 +WIRED-PROPERTIES.CARRIER:               on 
 +IP4.ADDRESS[1]:                         10.0.2.45/24 
 +IP4.GATEWAY:                            10.0.2.1 
 +IP4.ROUTE[1]:                           dst = 10.0.2.0/24, nh = 0.0.0.0, mt = 100 
 +IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 
 +IP4.DNS[1]:                             8.8.8.8 
 +IP6.ADDRESS[1]:                         fe80::86b6:8d39:cab2:d84d/64 
 +IP6.GATEWAY:                            -- 
 +IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 
 +IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
  
-Handle 0x0000, DMI type 0, 24 bytes +GENERAL.DEVICE:                         virbr0 
-BIOS Information +GENERAL.TYPE:                           bridge 
-        VendorSeaBIOS +GENERAL.HWADDR                        52:54:00:79:02:66 
-        Versionrel-1.14.0-0-g155821a1990b-prebuilt.qemu.org +GENERAL.MTU                           1500 
-        Release Date04/01/2014 +GENERAL.STATE:                          100 (connected (externally)) 
-        Address0xE8000 +GENERAL.CONNECTION:                     virbr0 
-        Runtime Size96 kB +GENERAL.CON-PATH                      /org/freedesktop/NetworkManager/ActiveConnect> 
-        ROM Size: 64 kB +IP4.ADDRESS[1]                        192.168.122.1/24 
-        Characteristics: +IP4.GATEWAY                           -- 
-                BIOS characteristics not supported +IP4.ROUTE[1]                          dst = 192.168.122.0/24, nh = 0.0.0.0, mt = 0 
-                Targeted content distribution is supported +IP6.GATEWAY:                            --
-        BIOS Revision: 0.0+
  
-Handle 0x0100, DMI type 1, 27 bytes +GENERAL.DEVICE:                         lo 
-System Information +GENERAL.TYPE:                           loopback 
-        ManufacturerQEMU +GENERAL.HWADDR                        00:00:00:00:00:00 
-        Product NameStandard PC (i440FX + PIIX, 1996+GENERAL.MTU                           65536 
-        Versionpc-i440fx-5.2 +GENERAL.STATE:                          10 (unmanaged
-        Serial NumberNot Specified +GENERAL.CONNECTION                    -- 
-        UUID95bd69e3-4a74-44a7-b58c-b74fbfb86df2 +GENERAL.CON-PATH:                       -- 
-        Wake-up TypePower Switch +IP4.ADDRESS[1]                        127.0.0.1/8 
-        SKU NumberNot Specified +IP4.GATEWAY                           -- 
-        FamilyNot Specified+IP6.ADDRESS[1]                        ::1/128 
 +IP6.GATEWAY                           -- 
 +IP6.ROUTE[1]                          dst = ::1/128, nh = ::, mt = 256
  
-Handle 0x0300, DMI type 3, 22 bytes +GENERAL.DEVICE                        virbr0-nic 
-Chassis Information +GENERAL.TYPE                          tun 
-        ManufacturerQEMU +GENERAL.HWADDR                        52:54:00:79:02:66 
-        TypeOther +GENERAL.MTU                           1500 
-        LockNot Present +GENERAL.STATE                         10 (unmanaged) 
-        Versionpc-i440fx-5.2 +GENERAL.CONNECTION                    -- 
-        Serial NumberNot Specified +GENERAL.CON-PATH                      -- 
-        Asset TagNot Specified +lines 28-50/50 (END) 
-        Boot-up StateSafe +[q] 
-        Power Supply StateSafe +</code>
-        Thermal StateSafe +
-        Security StatusUnknown +
-        OEM Information0x00000000 +
-        HeightUnspecified +
-        Number Of Power Cords: Unspecified +
-        Contained Elements: 0 +
-        SKU Number: Not Specified+
  
-Handle 0x0400DMI type 4, 42 bytes +To activate the ip_fixed profileuse the following command:
-Processor Information +
-        Socket Designation: CPU 0 +
-        Type: Central Processor +
-        Family: Other +
-        Manufacturer: QEMU +
-        ID: 61 0F 00 00 FF FB 8B 07 +
-        Version: pc-i440fx-5.2 +
-        Voltage: Unknown +
-        External Clock: Unknown +
-        Max Speed: 2000 MHz +
-        Current Speed: 2000 MHz +
-        Status: Populated, Enabled +
-        Upgrade: Other +
-        L1 Cache Handle: Not Provided +
-        L2 Cache Handle: Not Provided +
-        L3 Cache Handle: Not Provided +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Core Count: 4 +
-        Core Enabled: 4 +
-        Thread Count: 1 +
-        CharacteristicsNone+
  
-Handle 0x0401, DMI type 4, 42 bytes +<code> 
-Processor Information +[root@centos8 ~]# nmcli connection up ip_fixed
-        Socket Designation: CPU 1 +
-        Type: Central Processor +
-        Family: Other +
-        Manufacturer: QEMU +
-        ID: 61 0F 00 00 FF FB 8B 07 +
-        Version: pc-i440fx-5.2 +
-        Voltage: Unknown +
-        External Clock: Unknown +
-        Max Speed: 2000 MHz +
-        Current Speed: 2000 MHz +
-        Status: Populated, Enabled +
-        Upgrade: Other +
-        L1 Cache Handle: Not Provided +
-        L2 Cache Handle: Not Provided +
-        L3 Cache Handle: Not Provided +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Core Count: 4 +
-        Core Enabled: 4 +
-        Thread Count: 1 +
-        Characteristics: None+
  
-Handle 0x1000, DMI type 16, 23 bytes +</code>
-Physical Memory Array +
-        Location: Other +
-        Use: System Memory +
-        Error Correction Type: Multi-bit ECC +
-        Maximum Capacity: 4 GB +
-        Error Information Handle: Not Provided +
-        Number Of Devices: 1+
  
-Handle 0x1100DMI type 17, 40 bytes +Note that because of the IP address changeyour terminal is now blocked. 
-Memory Device +
-        Array Handle: 0x1000 +
-        Error Information Handle: Not Provided +
-        Total Width: Unknown +
-        Data Width: Unknown +
-        Size: 4 GB +
-        Form Factor: DIMM +
-        Set: None +
-        Locator: DIMM 0 +
-        Bank Locator: Not Specified +
-        Type: RAM +
-        Type Detail: Other +
-        Speed: Unknown +
-        Manufacturer: QEMU +
-        Serial Number: Not Specified +
-        Asset Tag: Not Specified +
-        Part Number: Not Specified +
-        Rank: Unknown +
-        Configured Memory Speed: Unknown +
-        Minimum Voltage: Unknown +
-        Maximum Voltage: Unknown +
-        Configured Voltage: Unknown+
  
-Handle 0x1300, DMI type 19, 31 bytes +<WRAP center round todo 60%> 
-Memory Array Mapped Address +**To do** - Reconnect to the VM using the **CentOS8_SSH_10.0.2.46** connection. 
-        Starting Address: 0x00000000000 +</WRAP>
-        Ending Address: 0x000BFFFFFFF +
-        Range Size: 3 GB +
-        Physical Array Handle: 0x1000 +
-        Partition Width: 1+
  
-Handle 0x1301, DMI type 19, 31 bytes +The ip_fixed is now activated and the enp0s3 has been disactivated:
-Memory Array Mapped Address +
-        Starting Address: 0x00100000000 +
-        Ending Address: 0x0013FFFFFFF +
-        Range Size: 1 GB +
-        Physical Array Handle: 0x1000 +
-        Partition Width: 1 +
- +
-Handle 0x2000, DMI type 32, 11 bytes +
-System Boot Information +
-        Status: No errors detected +
- +
-Handle 0x7F00, DMI type 127, 4 bytes +
-End Of Table +
-</code> +
- +
-===Command Line Switches=== +
- +
-The command line switches of this command are:+
  
 <code> <code>
-[root@centos7 ~]# dmidecode --help +[root@centos8 ~]# nmcli c show 
-Usage: dmidecode [OPTIONS] +NAME     UUID                                  TYPE      DEVICE  
-Options are: +ip_fixed 0f48c74d-5d16-4c37-8220-24644507b589  ethernet  ens18   
- -d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem) +virbr0   03f6c432-2a09-47e7-9693-208431a572ee  bridge    virbr0  
- -h, --help             Display this help text and exit +ens18    fc4a4d23-b15e-47a7-bcfa-b2e08f49553e  ethernet  --   
- -q, --quiet            Less verbose output +    
- -s, --string KEYWORD   Only display the value of the given DMI string +[root@centos8 ~]# nmcli d show 
- -t, --type TYPE        Only display the entries of given type +GENERAL.DEVICE:                         ens18 
- -u, --dump             Do not decode the entries +GENERAL.TYPE:                           ethernet 
-     --dump-bin FILE    Dump the DMI data to a binary file +GENERAL.HWADDR:                         4E:B1:31:BD:5D:B2 
-     --from-dump FILE   Read the DMI data from a binary file +GENERAL.MTU:                            1500 
- -V, --version          Display the version and exit +GENERAL.STATE:                          100 (connected) 
-</code>+GENERAL.CONNECTION:                     ip_fixed 
 +GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> 
 +WIRED-PROPERTIES.CARRIER:               on 
 +IP4.ADDRESS[1]:                         10.0.2.46/24 
 +IP4.GATEWAY:                            10.0.2.1 
 +IP4.ROUTE[1]:                           dst = 10.0.2.0/24nh = 0.0.0.0, mt = 100 
 +IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 
 +IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 
 +IP6.GATEWAY:                            -- 
 +IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 
 +IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
  
-=====LAB #2 The sysctl Command=====+GENERAL.DEVICE:                         virbr0 
 +GENERAL.TYPE:                           bridge 
 +GENERAL.HWADDR:                         52:54:00:79:02:66 
 +GENERAL.MTU:                            1500 
 +GENERAL.STATE:                          100 (connected (externally)) 
 +GENERAL.CONNECTION:                     virbr0 
 +GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnect> 
 +IP4.ADDRESS[1]:                         192.168.122.1/24 
 +IP4.GATEWAY:                            -- 
 +IP4.ROUTE[1]:                           dst 192.168.122.0/24, nh 0.0.0.0, mt 
 +IP6.GATEWAY:                            --
  
-====2.1 - The /proc Directory====+GENERAL.DEVICE:                         lo 
 +GENERAL.TYPE:                           loopback 
 +GENERAL.HWADDR:                         00:00:00:00:00:00 
 +GENERAL.MTU:                            65536 
 +GENERAL.STATE:                          10 (unmanaged) 
 +GENERAL.CONNECTION:                     -- 
 +GENERAL.CON-PATH:                       -- 
 +IP4.ADDRESS[1]:                         127.0.0.1/
 +IP4.GATEWAY:                            -
 +IP6.ADDRESS[1]:                         ::1/128 
 +IP6.GATEWAY:                            -- 
 +IP6.ROUTE[1]:                           dst ::1/128, nh ::, mt 256
  
-The /proc directory contains virtual files and directories wich are created dynamically when consultedOnly root can consult all of the information in /proc+GENERAL.DEVICE:                         virbr0-nic 
- +GENERAL.TYPE:                           tun 
-<code> +GENERAL.HWADDR:                         52:54:00:79:02:66 
-[root@centos8 ~]# ls /proc +GENERAL.MTU:                            1500 
-1      16391  19    2212  2427  2622  431   59    84    999          mdstat +GENERAL.STATE:                          10 (unmanaged) 
-10     16476  1931  2215  2428  2659  432       842   acpi         meminfo +GENERAL.CONNECTION:                     -
-1007   16534  1956  2222  2431  2667  433   60    8465  buddyinfo    misc +GENERAL.CON-PATH:                       -
-11     16576  1960  2226  2432  2686  434   61    866   bus          modules +lines 27-49/49 (END) 
-11805  16593  2     2230  2435  27    435   63    867   cgroups      mounts +[q]
-12     16598  20    2237  2439  28    436   64    868   cmdline      mtrr +
-1219   16600  2007  2238  244   29    437   65    869   consoles     net +
-1228   16613  2029  2241  2443  3     44    6568  87    cpuinfo      pagetypeinfo +
-1232   16646  203   2244  2445  31    446   66    870   crypto       partitions +
-1234   16673  2034  2247  2449  32    45    67    871   devices      sched_debug +
-1235   16677  2037  2260  2451  33    46    674   872   diskstats    schedstat +
-1247   16711  2054  2262  2465  34    47    68    874   dma          scsi +
-13     16712  2062  2267  2472  35    4790  69    875   driver       self +
-1307   16729  21    2268  2473  37    49    70    878   execdomains  slabinfo +
-1339   16742  210   2274  2474  38    50    701   879   fb           softirqs +
-1356   17     2118  2275  2475  39    5076  71    880   filesystems  stat +
-14     1764   2121  2280  2476  4     51    714   884   fs           swaps +
-1441   180    2124  2287  2478  40    52    72    887   interrupts   sys +
-1443   181    2126  2292  2481  402   53    73    9     iomem        sysrq-trigger +
-1444   1817   2156  23    2484  41    532   74    901   ioports      sysvipc +
-1446   182    2160  2302  25    419   539   75    903   irq          thread-self +
-14977  1828   2164  2307  2536  420   55    76    9144  kallsyms     timer_list +
-15     1829   2165  2310  2539  421   568       916   kcore        tty +
-15067  183    2167  2330  2571  422   569   808   918   keys         uptime +
-1536   1845   2169  2332  2578  423   570   809   919   key-users    version +
-1553   185    2177  2349  2579  425   571   81    921   kmsg         vmallocinfo +
-15594  186    2187  2358  259   426   572   833   969   kpagecgroup  vmstat +
-15735  187    2190  2373  2593  427   573   835   986   kpagecount   zoneinfo +
-16     1880   2194  2384  26    428   574   837   989   kpageflags +
-16165  1883   22    239   2602  43    575   838   990   loadavg +
-16167  1888   2204  241   2608  430   576   839   993   locks+
 </code> </code>
  
-===Files=== +To see the characteristics of **ens18** connection, use the following command:
- +
-==/proc/cpuinfo==+
  
 <code> <code>
-[root@centos8 ~]# cat /proc/cpuinfo +[root@centos8 ~]# nmcli -p connection show ens18 
-processor       : 0 +=============================================================================== 
-vendor_id       : GenuineIntel +                      Connection profile details (ens18) 
-cpu family      : 15 +=============================================================================== 
-model           : 6 +connection.id:                          ens18 
-model name      : Common KVM processor +connection.uuid                       fc4a4d23-b15e-47a7-bcfa-b2e08f49553e 
-stepping        : 1 +connection.stable-id:                   -- 
-microcode       : 0x1 +connection.type                       802-3-ethernet 
-cpu MHz         : 1999.987 +connection.interface-name             ens18 
-cache size      : 16384 KB +connection.autoconnect                yes 
-physical id     0 +connection.autoconnect-priority       0 
-siblings        4 +connection.autoconnect-retries        -1 (default) 
-core id         0 +connection.multi-connect              0 (default) 
-cpu cores       4 +connection.auth-retries               -1 
-apicid          0 +connection.timestamp                  1630224060 
-initial apicid  : 0 +connection.read-only                  no 
-fpu             : yes +connection.permissions                -- 
-fpu_exception   yes +connection.zone                       -- 
-cpuid level     13 +connection.master                     -- 
-wp              yes +connection.slave-type                 -- 
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +connection.autoconnect-slaves         -(default) 
-bugs            cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +connection.secondaries                -- 
-bogomips        : 3999.97 +connection.gateway-ping-timeout       
-clflush size    64 +connection.metered                    unknown 
-cache_alignment 128 +connection.lldp                       default 
-address sizes   40 bits physical, 48 bits virtual +connection.mdns                       -(default) 
-power management+connection.llmnr                      -(default) 
- +connection.wait-device-timeout        -
-processor       1 +------------------------------------------------------------------------------- 
-vendor_id       : GenuineIntel +802-3-ethernet.port                   -- 
-cpu family      : 15 +802-3-ethernet.speed                  
-model           : 6 +802-3-ethernet.duplex                 -- 
-model name      : Common KVM processor +802-3-ethernet.auto-negotiate:          no 
-stepping        : 1 +802-3-ethernet.mac-address:             -- 
-microcode       0x1 +802-3-ethernet.cloned-mac-address     -- 
-cpu MHz         : 1999.987 +802-3-ethernet.generate-mac-address-mask:-- 
-cache size      : 16384 KB +802-3-ethernet.mac-address-blacklist:   -- 
-physical id     : 0 +802-3-ethernet.mtu                    auto 
-siblings        4 +802-3-ethernet.s390-subchannels:        -- 
-core id         1 +802-3-ethernet.s390-nettype           -- 
-cpu cores       : 4 +802-3-ethernet.s390-options           -- 
-apicid          : 1 +802-3-ethernet.wake-on-lan:             default 
-initial apicid  : 1 +802-3-ethernet.wake-on-lan-password   -- 
-fpu             : yes +------------------------------------------------------------------------------- 
-fpu_exception   : yes +ipv4.method                           manual 
-cpuid level     : 13 +ipv4.dns                              8.8.8.8 
-wp              : yes +ipv4.dns-search                       ittraining.loc 
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +ipv4.dns-options                      -- 
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +ipv4.dns-priority                     0 
-bogomips        : 3999.97 +ipv4.addresses                        10.0.2.45/24 
-clflush size    : 64 +ipv4.gateway                          10.0.2.1 
-cache_alignment : 128 +ipv4.routes                           -- 
-address sizes   : 40 bits physical, 48 bits virtual +ipv4.route-metric                     -1 
-power management: +ipv4.route-table                      0 (unspec) 
- +ipv4.routing-rules                    -- 
-processor       : 2 +ipv4.ignore-auto-routes               no 
-vendor_id       : GenuineIntel +ipv4.ignore-auto-dns                  no 
-cpu family      : 15 +ipv4.dhcp-client-id:                    -- 
-model           : 6 +ipv4.dhcp-iaid                        -- 
-model name      : Common KVM processor +ipv4.dhcp-timeout                     (default) 
-stepping        : 1 +ipv4.dhcp-send-hostname               yes 
-microcode       : 0x1 +ipv4.dhcp-hostname                    -- 
-cpu MHz         : 1999.987 +ipv4.dhcp-fqdn                        -- 
-cache size      16384 KB +ipv4.dhcp-hostname-flags:               0x0 (none) 
-physical id     : 0 +ipv4.never-default                    no 
-siblings        4 +ipv4.may-fail                         yes 
-core id         +ipv4.dad-timeout                      -1 (default) 
-cpu cores       : 4 +ipv4.dhcp-vendor-class-identifier     -- 
-apicid          : 2 +ipv4.dhcp-reject-servers              -- 
-initial apicid  +------------------------------------------------------------------------------- 
-fpu             : yes +ipv6.method                           auto 
-fpu_exception   yes +ipv6.dns                              -- 
-cpuid level     13 +ipv6.dns-search                       -- 
-wp              : yes +ipv6.dns-options                      -- 
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +ipv6.dns-priority                     0 
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +ipv6.addresses                        -- 
-bogomips        : 3999.97 +ipv6.gateway                          -- 
-clflush size    64 +ipv6.routes                           -- 
-cache_alignment : 128 +ipv6.route-metric                     -
-address sizes   : 40 bits physical, 48 bits virtual +ipv6.route-table                      0 (unspec) 
-power management+ipv6.routing-rules                    -- 
- +ipv6.ignore-auto-routes               no 
-processor       : 3 +ipv6.ignore-auto-dns                  no 
-vendor_id       GenuineIntel +ipv6.never-default                    no 
-cpu family      : 15 +ipv6.may-fail                         yes 
-model           : 6 +ipv6.ip6-privacy                      0 (disabled) 
-model name      : Common KVM processor +ipv6.addr-gen-mode                    stable-privacy 
-stepping        : 1 +ipv6.ra-timeout                       0 (default) 
-microcode       : 0x1 +ipv6.dhcp-duid                        -- 
-cpu MHz         : 1999.987 +ipv6.dhcp-iaid                        -- 
-cache size      16384 KB +ipv6.dhcp-timeout                     0 (default) 
-physical id     : 0 +ipv6.dhcp-send-hostname               yes 
-siblings        : 4 +ipv6.dhcp-hostname                    -- 
-core id         : 3 +ipv6.dhcp-hostname-flags:               0x0 (none) 
-cpu cores       4 +ipv6.token                            -- 
-apicid          : 3 +------------------------------------------------------------------------------- 
-initial apicid  +proxy.method                          none 
-fpu             : yes +proxy.browser-only                    no 
-fpu_exception   yes +proxy.pac-url                         -- 
-cpuid level     : 13 +proxy.pac-script                      -- 
-wp              yes +------------------------------------------------------------------------------- 
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +lines 56-100/100 (END) 
-bugs            cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +[q]
-bogomips        : 3999.97 +
-clflush size    64 +
-cache_alignment 128 +
-address sizes   40 bits physical, 48 bits virtual +
-power management+
- +
-processor       4 +
-vendor_id       GenuineIntel +
-cpu family      15 +
-model           6 +
-model name      Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      16384 KB +
-physical id     1 +
-siblings        4 +
-core id         : 0 +
-cpu cores       : 4 +
-apicid          : 4 +
-initial apicid  : 4 +
-fpu             : yes +
-fpu_exception   yes +
-cpuid level     13 +
-wp              : yes +
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    64 +
-cache_alignment 128 +
-address sizes   40 bits physical, 48 bits virtual +
-power management+
- +
-processor       5 +
-vendor_id       GenuineIntel +
-cpu family      15 +
-model           6 +
-model name      Common KVM processor +
-stepping        1 +
-microcode       0x1 +
-cpu MHz         : 1999.987 +
-cache size      16384 KB +
-physical id     : 1 +
-siblings        4 +
-core id         1 +
-cpu cores       4 +
-apicid          5 +
-initial apicid  5 +
-fpu             : yes +
-fpu_exception   yes +
-cpuid level     13 +
-wp              yes +
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management: +
- +
-processor       : 6 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      : 16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 2 +
-cpu cores       : 4 +
-apicid          : 6 +
-initial apicid  : 6 +
-fpu             : yes +
-fpu_exception   yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    64 +
-cache_alignment : 128 +
-address sizes   40 bits physical, 48 bits virtual +
-power management+
- +
-processor       : 7 +
-vendor_id       : GenuineIntel +
-cpu family      : 15 +
-model           : 6 +
-model name      : Common KVM processor +
-stepping        : 1 +
-microcode       : 0x1 +
-cpu MHz         : 1999.987 +
-cache size      16384 KB +
-physical id     : 1 +
-siblings        : 4 +
-core id         : 3 +
-cpu cores       : 4 +
-apicid          : 7 +
-initial apicid  : 7 +
-fpu             : yes +
-fpu_exception   : yes +
-cpuid level     : 13 +
-wp              : yes +
-flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti +
-bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit +
-bogomips        : 3999.97 +
-clflush size    64 +
-cache_alignment : 128 +
-address sizes   : 40 bits physical, 48 bits virtual +
-power management:+
 </code> </code>
  
-==/proc/interrupts==+To see the characteristics of the **ip_fixed** profile, use the following command:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/interrupts +[root@centos8 ~]# nmcli -p connection show ip_fixed 
-           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7        +=============================================================================== 
-  0:        109                            0          0          0          0          0   IO-APIC   2-edge      timer +                     Connection profile details (ip_fixed) 
-  1:                            0          0          9          0          0          0   IO-APIC   1-edge      i8042 +=============================================================================== 
-  8:          0          0          0          0          0                            0   IO-APIC   8-edge      rtc0 +connection.id:                          ip_fixed 
-  9                           0          0          0          0          0          0   IO-APIC   9-fasteoi   acpi +connection.uuid:                        0f48c74d-5d16-4c37-8220-24644507b589 
- 10                  0          0          0      47098          0          0          0   IO-APIC  10-fasteoi   virtio0 +connection.stable-id:                   -- 
- 11                          31          0          0          0          0          0   IO-APIC  11-fasteoi   uhci_hcd:usb1 +connection.type:                        802-3-ethernet 
- 12:          0          0          0         15          0          0          0          0   IO-APIC  12-edge      i8042 +connection.interface-name:              ens18 
- 14                  0          0          0          0          0          0          0   IO-APIC  14-edge      ata_piix +connection.autoconnect:                 yes 
- 15      7376          0        144          0          0          0          0      84588   IO-APIC  15-edge      ata_piix +connection.autoconnect-priority:        0 
- 24                  0          0          0          0          0          0          0   PCI-MSI 294912-edge      virtio1-config +connection.autoconnect-retries:         -1 (default) 
- 25                  0          0          0          0       5640          0         16   PCI-MSI 294913-edge      virtio1-input.0 +connection.multi-connect              (default) 
- 26        36                         5058          0          0          0          0   PCI-MSI 294914-edge      virtio1-output.0 +connection.auth-retries:                -1 
- 27              16008          0       9431          0          0          0          0   PCI-MSI 114688-edge      ahci[0000:00:07.0] +connection.timestamp:                   1630224329 
-NMI                  0          0          0          0          0          0          0   Non-maskable interrupts +connection.read-only:                   no 
-LOC    870537     771900    1117711     288839     833717     502365     758229     405110   Local timer interrupts +connection.permissions:                 -- 
-SPU                                    0          0          0          0          0   Spurious interrupts +connection.zone:                        -- 
-PMI                           0          0          0          0          0          0   Performance monitoring interrupts +connection.master:                      -- 
-IWI                  0                            2          0          0          0   IRQ work interrupts +connection.slave-type:                  -- 
-RTR                           0          0          0          0          0          0   APIC ICR read retries +connection.autoconnect-slaves:          -(default) 
-RES    178171      67749      43116      65994      71361     118585      54139      53452   Rescheduling interrupts +connection.secondaries:                 -- 
-CAL:      11095      11007      10841      10343      14679       9998      12165      12443   Function call interrupts +connection.gateway-ping-timeout       0 
-TLB      2295       2297       2000       1728       2330       2338       1991       1861   TLB shootdowns +connection.metered:                     unknown 
-TRM                  0          0          0          0          0          0          0   Thermal event interrupts +connection.lldp:                        default 
-THR                  0          0          0          0          0          0          0   Threshold APIC interrupts +connection.mdns:                        -1 (default) 
-DFR                  0          0          0          0          0          0          0   Deferred Error APIC interrupts +connection.llmnr:                       -1 (default) 
-MCE                  0          0          0          0          0          0          0   Machine check exceptions +connection.wait-device-timeout        -1 
-MCP       288        288        288        288        288        288        288        288   Machine check polls +------------------------------------------------------------------------------- 
-HYP                  0          0          0          0          0          0          0   Hypervisor callback interrupts +802-3-ethernet.port                   -- 
-HRE                  0          0          0          0          0          0          0   Hyper-V reenlightenment interrupts +802-3-ethernet.speed:                   0 
-HVS                  0          0          0          0          0          0          0   Hyper-V stimer0 interrupts +802-3-ethernet.duplex                 -- 
-ERR         0 +802-3-ethernet.auto-negotiate:          no 
-MIS         0 +802-3-ethernet.mac-address:             -- 
-PIN                  0          0          0          0          0          0          0   Posted-interrupt notification event +802-3-ethernet.cloned-mac-address:      -- 
-NPI                                                                          Nested posted-interrupt event +802-3-ethernet.generate-mac-address-mask:-- 
-PIW                                                                        0   Posted-interrupt wakeup event+802-3-ethernet.mac-address-blacklist:   -- 
 +802-3-ethernet.mtu:                     auto 
 +802-3-ethernet.s390-subchannels:        -- 
 +802-3-ethernet.s390-nettype           -- 
 +802-3-ethernet.s390-options:            -
 +802-3-ethernet.wake-on-lan            default 
 +802-3-ethernet.wake-on-lan-password:    -- 
 +------------------------------------------------------------------------------- 
 +ipv4.method:                            manual 
 +ipv4.dns:                               -- 
 +ipv4.dns-search:                        -- 
 +ipv4.dns-options:                       -- 
 +ipv4.dns-priority:                      
 +ipv4.addresses                        10.0.2.46/24 
 +ipv4.gateway:                           10.0.2.1 
 +ipv4.routes:                            -- 
 +ipv4.route-metric:                      -1 
 +ipv4.route-table:                       (unspec) 
 +ipv4.routing-rules                    -- 
 +ipv4.ignore-auto-routes:                no 
 +ipv4.ignore-auto-dns:                   no 
 +ipv4.dhcp-client-id:                    -- 
 +ipv4.dhcp-iaid:                         -- 
 +ipv4.dhcp-timeout:                      (default) 
 +ipv4.dhcp-send-hostname:                yes 
 +ipv4.dhcp-hostname:                     -- 
 +ipv4.dhcp-fqdn:                         -- 
 +ipv4.dhcp-hostname-flags:               0x0 (none) 
 +ipv4.never-default:                     no 
 +ipv4.may-fail:                          yes 
 +ipv4.dad-timeout:                       -1 (default) 
 +ipv4.dhcp-vendor-class-identifier:      -- 
 +ipv4.dhcp-reject-servers              -- 
 +------------------------------------------------------------------------------- 
 +ipv6.method                           auto 
 +ipv6.dns:                               -- 
 +ipv6.dns-search                       -
 +ipv6.dns-options                      -- 
 +ipv6.dns-priority                     
 +ipv6.addresses                        -- 
 +ipv6.gateway:                           -- 
 +ipv6.routes:                            -- 
 +ipv6.route-metric:                      -1 
 +ipv6.route-table:                       (unspec) 
 +ipv6.routing-rules                    -- 
 +ipv6.ignore-auto-routes:                no 
 +ipv6.ignore-auto-dns:                   no 
 +ipv6.never-default:                     no 
 +ipv6.may-fail:                          yes 
 +ipv6.ip6-privacy:                       -1 (unknown) 
 +ipv6.addr-gen-mode:                     stable-privacy 
 +ipv6.ra-timeout:                        (default) 
 +ipv6.dhcp-duid                        -- 
 +ipv6.dhcp-iaid:                         -- 
 +ipv6.dhcp-timeout:                      (default) 
 +ipv6.dhcp-send-hostname               yes 
 +ipv6.dhcp-hostname                    -- 
 +ipv6.dhcp-hostname-flags:               0x0 (none) 
 +ipv6.token:                             -- 
 +------------------------------------------------------------------------------- 
 +proxy.method:                           none 
 +proxy.browser-only:                     no 
 +proxy.pac-url:                          -- 
 +proxy.pac-script:                       -- 
 +------------------------------------------------------------------------------- 
 +=============================================================================== 
 +      Activate connection details (0f48c74d-5d16-4c37-8220-24644507b589) 
 +=============================================================================== 
 +GENERAL.NAME                          ip_fixed 
 +GENERAL.UUID                          0f48c74d-5d16-4c37-8220-24644507b589 
 +GENERAL.DEVICES                       ens18 
 +GENERAL.IP-IFACE                      ens18 
 +GENERAL.STATE                         activated 
 +GENERAL.DEFAULT                       yes 
 +GENERAL.DEFAULT6                      no 
 +GENERAL.SPEC-OBJECT                   -
 +GENERAL.VPN                           no 
 +GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/4 
 +GENERAL.CON-PATH                      /org/freedesktop/NetworkManager/Settings/4 
 +GENERAL.ZONE                          -- 
 +GENERAL.MASTER-PATH                   -
 +------------------------------------------------------------------------------- 
 +IP4.ADDRESS[1]                        10.0.2.46/24 
 +IP4.GATEWAY:                            10.0.2.1 
 +IP4.ROUTE[1]:                           dst = 10.0.2.0/24, nh = 0.0.0.0, mt = 100 
 +IP4.ROUTE[2]                          dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 
 +------------------------------------------------------------------------------- 
 +IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 
 +IP6.GATEWAY:                            -- 
 +IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 
 +IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 
 +------------------------------------------------------------------------------- 
 +lines 83-127/127 (END) 
 +[q]
 </code> </code>
  
-<WRAP center round important 60%> +To see a list of the profiles associated with device, use the following command:
-**Important** : The use of an IRQ by peripheral is exclusive. +
-</WRAP>  +
- +
-==/proc/dma==+
  
 <code> <code>
-[root@centos8 ~]# cat /proc/dma +[root@centos8 ~]# nmcli -f CONNECTIONS device show ens18 
- 4: cascade+CONNECTIONS.AVAILABLE-CONNECTION-PATHS: /org/freedesktop/NetworkManager/Settings/1,/org/freedesktop/NetworkManager/Settings/4 
 +CONNECTIONS.AVAILABLE-CONNECTIONS[1]:   fc4a4d23-b15e-47a7-bcfa-b2e08f49553e | ens18 
 +CONNECTIONS.AVAILABLE-CONNECTIONS[2]  0f48c74d-5d16-4c37-8220-24644507b589 | ip_fixed
 </code> </code>
  
-==/proc/ioports==+The configuration files for the **ens18** device can be found in the **/etc/sysconfig/network-scripts/** directory:
  
 <code> <code>
-root@centos8 ~]# cat /proc/ioports more +[root@centos8 ~]# ls -l /etc/sysconfig/network-scripts/ | grep ifcfg 
-0000-0cf7 : PCI Bus 0000:00 +-rw-r--r--. 1 root root 417 Jun 16 06:39 ifcfg-ens18 
-  0000-001f : dma1 +-rw-r--r--. 1 root root 326 Aug 29 03:58 ifcfg-ip_fixed
-  0020-0021 : pic1 +
-  0040-0043 : timer0 +
-  0050-0053 : timer1 +
-  0060-0060 : keyboard +
-  0064-0064 : keyboard +
-  0070-0077 : rtc0 +
-  0080-008f : dma page reg +
-  00a0-00a1 : pic2 +
-  00c0-00df : dma2 +
-  00f0-00ff : fpu +
-  0170-0177 : 0000:00:01.1 +
-    0170-0177 ata_piix +
-  01f0-01f7 : 0000:00:01.1 +
-    01f0-01f7 : ata_piix +
-  0376-0376 : 0000:00:01.1 +
-    0376-0376 : ata_piix +
-  03c0-03df : vga+ +
-  03f6-03f6 : 0000:00:01.1 +
-    03f6-03f6 ata_piix +
---More--+
 </code> </code>
  
-<WRAP center round alert 60%> +====1.2 - Name Resolution====
-**Important** - If two peripherals use the same IO Port, both become unusable. +
-</WRAP>+
  
-==/proc/devices==+Looking at the **/etc/sysconfig/network-scripts/ifcfg-ip_fixed** file reveals that their is currently no DNS entry:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/devices +[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixed 
-Character devices: +TYPE=Ethernet 
-  1 mem +PROXY_METHOD=none 
-  4 /dev/vc/0 +BROWSER_ONLY=no 
-  4 tty +BOOTPROTO=none 
-  4 ttyS +IPADDR=10.0.2.46 
-  5 /dev/tty +PREFIX=24 
-  5 /dev/console +GATEWAY=10.0.2.1 
-  5 /dev/ptmx +DEFROUTE=yes 
-  7 vcs +IPV4_FAILURE_FATAL=no 
- 10 misc +IPV6INIT=yes 
- 13 input +IPV6_AUTOCONF=yes 
- 21 sg +IPV6_DEFROUTE=yes 
- 29 fb +IPV6_FAILURE_FATAL=no 
-128 ptm +IPV6_ADDR_GEN_MODE=stable-privacy 
-136 pts +NAME=ip_fixed 
-162 raw +UUID=0f48c74d-5d16-4c37-8220-24644507b589 
-180 usb +DEVICE=ens18 
-188 ttyUSB +ONBOOT=yes
-189 usb_device +
-202 cpu/msr +
-203 cpu/cpuid +
-226 drm +
-244 aux +
-245 hidraw +
-246 usbmon +
-247 bsg +
-248 watchdog +
-249 ptp +
-250 pps +
-251 rtc +
-252 dax +
-253 tpm +
-254 gpiochip +
- +
-Block devices: +
-  8 sd +
-  9 md +
- 11 sr +
- 65 sd +
- 66 sd +
- 67 sd +
- 68 sd +
- 69 sd +
- 70 sd +
- 71 sd +
-128 sd +
-129 sd +
-130 sd +
-131 sd +
-132 sd +
-133 sd +
-134 sd +
-135 sd +
-253 device-mapper +
-254 mdp +
-259 blkext+
 </code> </code>
  
-==/proc/modules==+As a result there is currently no name resolution :
  
 <code> <code>
-[root@centos8 ~]# cat /proc/modules | more +[root@centos8 ~]# ping www.free.fr 
-xt_CHECKSUM 16384 1 - Live 0xffffffffc09a8000 +ping: www.free.fr: Name or service not known
-ipt_MASQUERADE 16384 3 - Live 0xffffffffc09a3000 +
-xt_conntrack 16384 1 - Live 0xffffffffc099e000 +
-ipt_REJECT 16384 2 - Live 0xffffffffc0999000 +
-nft_compat 20480 16 - Live 0xffffffffc0993000 +
-nf_nat_tftp 16384 0 - Live 0xffffffffc098b000 +
-nft_objref 16384 1 - Live 0xffffffffc0986000 +
-nf_conntrack_tftp 16384 3 nf_nat_tftp, Live 0xffffffffc0981000 +
-nft_counter 16384 33 - Live 0xffffffffc097c000 +
-tun 53248 1 - Live 0xffffffffc096e000 +
-bridge 192512 0 - Live 0xffffffffc093e000 +
-stp 16384 1 bridge, Live 0xffffffffc0939000 +
-llc 16384 2 bridge,stp, Live 0xffffffffc0930000 +
-nft_fib_inet 16384 1 - Live 0xffffffffc08f5000 +
-nft_fib_ipv4 16384 1 nft_fib_inet, Live 0xffffffffc08ed000 +
-nft_fib_ipv6 16384 1 nft_fib_inet, Live 0xffffffffc08e8000 +
-nft_fib 16384 3 nft_fib_inet,nft_fib_ipv4,nft_fib_ipv6, Live 0xffffffffc08e3000 +
-nft_reject_inet 16384 5 - Live 0xffffffffc08de000 +
-nf_reject_ipv4 16384 2 ipt_REJECT,nft_reject_inet, Live 0xffffffffc08d9000 +
-nf_reject_ipv6 16384 1 nft_reject_inet, Live 0xffffffffc08d4000 +
-nft_reject 16384 1 nft_reject_inet, Live 0xffffffffc08cf000 +
---More--+
 </code> </code>
  
-==/proc/diskstats==+Modify the **ip_fixed** profile to rectify this:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/diskstats +[root@centos8 ~]# nmcli connection mod ip_fixed ipv4.dns 8.8.8.8
-         0 sda 15481 112 1445637 154103 10272 2377 277530 890611 0 237219 1044714 0 0 0 0 +
-         1 sda1 402 3 66754 13349 31 18 392 4632 0 2824 17981 0 0 0 0 +
-         2 sda2 14915 109 1375516 140528 8450 2359 277138 869788 0 225416 1010316 0 0 0 0 +
-        16 sdb 230 0 5991 36 0 0 0 0 0 110 36 0 0 0 0 +
-  11       0 sr0 10 0 4 2 0 0 0 0 0 9 2 0 0 0 0 +
- 253       0 dm-0 11651 0 1364532 72138 12121 0 288727 1208138 0 227630 1280276 0 0 0 0 +
- 253       1 dm-1 104 0 4440 79 0 0 0 0 0 71 79 0 0 0 0+
 </code> </code>
  
-==/proc/partitions==+Consulting the **/etc/sysconfig/network-scripts/ifcfg-ip_fixed** file shows that a DNS server has been added:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/partitions +[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixed 
-major minor  #blocks  name +TYPE=Ethernet 
- +PROXY_METHOD=none 
-   8        0   33554432 sda +BROWSER_ONLY=no 
-   8        1    1048576 sda1 +BOOTPROTO=none 
-   8          32504832 sda2 +IPADDR=10.0.2.46 
-   8       16    4194304 sdb +PREFIX=24 
-  11           1048575 sr0 +GATEWAY=10.0.2.1 
- 253        0   29143040 dm-0 +DEFROUTE=yes 
- 253        1    3358720 dm-1+IPV4_FAILURE_FATAL=no 
 +IPV6INIT=yes 
 +IPV6_AUTOCONF=yes 
 +IPV6_DEFROUTE=yes 
 +IPV6_FAILURE_FATAL=no 
 +IPV6_ADDR_GEN_MODE=stable-privacy 
 +NAME=ip_fixed 
 +UUID=0f48c74d-5d16-4c37-8220-24644507b589 
 +DEVICE=ens18 
 +ONBOOT=yes 
 +DNS1=8.8.8.8
 </code> </code>
  
-==/proc/swaps==+Restart the NetworkManager service to apply this change:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/swaps +root@centos8 ~]# systemctl restart NetworkManager.service 
-Filename                                Type            Size    Used    Priority +[root@centos8 ~]# systemctl status NetworkManager.service 
-/dev/dm-1                               partition       3358716 0       -2 +● NetworkManager.service - Network Manager 
-</code>+   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) 
 +   Active: active (running) since Sun 2021-08-29 04:15:11 EDT; 8s ago 
 +     Docs: man:NetworkManager(8) 
 + Main PID: 973390 (NetworkManager) 
 +    Tasks: 4 (limit: 23535) 
 +   Memory: 4.6M 
 +   CGroup: /system.slice/NetworkManager.service 
 +           └─973390 /usr/sbin/NetworkManager --no-daemon
  
-==/proc/loadavg== +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.2235] device (ens18): state change: ip-check -> secondaries (reas> 
- +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.2237] device (virbr0): state change: secondaries -> activated (re> 
-<code+Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info [1630224912.2241] manager: NetworkManager state is now CONNECTED_LOCAL 
-[root@centos8 ~]# cat /proc/loadavg +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.2251] policy: set 'ip_fixed' (ens18) as default for IPv4 routing a> 
-0.00 0.00 0.00 1/697 16936+Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3090] device (virbr0): Activation: successful, device activated. 
 +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3098] device (ens18): state change: secondaries -> activated (rea> 
 +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3102] manager: NetworkManager state is now CONNECTED_SITE 
 +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3111] device (ens18): Activation: successful, device activated. 
 +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3116] manager: NetworkManager state is now CONNECTED_GLOBAL 
 +Aug 29 04:15:12 centos8.ittraining.loc NetworkManager[973390]: <info>  [1630224912.3121] manager: startup complete 
 +lines 1-20/20 (END) 
 +[q]
 </code> </code>
  
-==/proc/meminfo==+Now check that the **/etc/resolv.conf** file has been modified to check the change made:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/meminfo +[root@centos8 ~]# cat /etc/resolv.conf 
-MemTotal:        3825032 kB +# Generated by NetworkManager 
-MemFree:         1862116 kB +search ittraining.loc 
-MemAvailable:    2420560 kB +nameserver 8.8.8.8
-Buffers:            3300 kB +
-Cached:           750496 kB +
-SwapCached:            0 kB +
-Active:           315572 kB +
-Inactive:        1400260 kB +
-Active(anon):       1856 kB +
-Inactive(anon):   974728 kB +
-Active(file):     313716 kB +
-Inactive(file):   425532 kB +
-Unevictable:           0 kB +
-Mlocked:               0 kB +
-SwapTotal:       3358716 kB +
-SwapFree:        3358716 kB +
-Dirty:                 0 kB +
-Writeback:             0 kB +
-AnonPages:        962004 kB +
-Mapped:           261084 kB +
-Shmem:             14552 kB +
-KReclaimable:      46980 kB +
-Slab:             118396 kB +
-SReclaimable:      46980 kB +
-SUnreclaim:        71416 kB +
-KernelStack:       11280 kB +
-PageTables:        46532 kB +
-NFS_Unstable:          0 kB +
-Bounce:                0 kB +
-WritebackTmp:          0 kB +
-CommitLimit:     5271232 kB +
-Committed_AS:    5072744 kB +
-VmallocTotal:   34359738367 kB +
-VmallocUsed:           0 kB +
-VmallocChunk:          0 kB +
-Percpu:             5920 kB +
-HardwareCorrupted:     0 kB +
-AnonHugePages:    546816 kB +
-ShmemHugePages:        0 kB +
-ShmemPmdMapped:        0 kB +
-FileHugePages:         0 kB +
-FilePmdMapped:         0 kB +
-HugePages_Total:       0 +
-HugePages_Free:        0 +
-HugePages_Rsvd:        0 +
-HugePages_Surp:        0 +
-Hugepagesize:       2048 kB +
-Hugetlb:               0 kB +
-DirectMap4k:      173944 kB +
-DirectMap2M:     4020224 kB+
 </code> </code>
  
-==/proc/version==+Lastly, check the name resolution:
  
 <code> <code>
-[root@centos8 ~]# cat /proc/version +[root@centos8 ~]# ping www.free.fr 
-Linux version 4.18.0-305.3.1.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)#1 SMP Tue Jun 1 16:14:33 UTC 2021+PING www.free.fr (212.27.48.10) 56(84) bytes of data. 
 +64 bytes from www.free.fr (212.27.48.10): icmp_seq=1 ttl=47 time=29.3 ms 
 +64 bytes from www.free.fr (212.27.48.10): icmp_seq=2 ttl=47 time=29.4 ms 
 +64 bytes from www.free.fr (212.27.48.10): icmp_seq=3 ttl=47 time=29.4 ms 
 +64 bytes from www.free.fr (212.27.48.10): icmp_seq=4 ttl=47 time=29.4 ms 
 +^C 
 +--- www.free.fr ping statistics --- 
 +4 packets transmitted, 4 received, 0% packet loss, time 3005ms 
 +rtt min/avg/max/mdev = 29.266/29.377/29.428/0.183 ms
 </code> </code>
  
-===Répertoires===+<WRAP center round important 60%> 
 +**Important** : Notez qu'il existe un front-end graphique en mode texte, **nmtui**, pour configurer NetworkManager. 
 +</WRAP>
  
-==ide/scsi==+====1.3 - Adding a Second IP Addresse to a Profile====
  
-This sub-directory contains disk capacity, disk type and disk geometry information. +To add second IP addressuse the following command:
- +
-==acpi== +
- +
-This sub-directory contains information on energy management, temperatures, fan speeds and battery levels. +
- +
-==bus== +
- +
-This sub-directory contains sub-directory for each bus. +
- +
-==net== +
- +
-This sub-directory contains information concerning the network. +
- +
-==sys== +
- +
-This sub-directory contains files used by root to configure the kernel. For instance, the following command configiresthe kernel to ignore incoming pings: +
- +
-  # echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all [Enter] +
- +
-====2.2 - Using the sysctl Command==== +
- +
-Files in the **/proc/sys** can be administered by using the **sysctl** command.  +
- +
-The **sysctl** command applies rules at system boot that are defined in the **/etc/sysctl.conf** file:+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/sysctl.conf +[root@centos8 ~]# nmcli connection mod ip_fixed +ipv4.addresses 192.168.1.2/24
-# sysctl settings are defined through files in +
-# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/+
-+
-# Vendors settings live in /usr/lib/sysctl.d/+
-# To override a whole file, create a new file with the same in +
-# /etc/sysctl.d/ and put new settings there. To override +
-# only specific settings, add a file with a lexically later +
-# name in /etc/sysctl.d/ and put new settings there. +
-+
-# For more information, see sysctl.conf(5) and sysctl.d(5). +
- +
-[root@centos8 ~]# ls -l /etc/sysctl.d/ +
-total 0 +
-lrwxrwxrwx. 1 root root 14 Mar 16 15:42 99-sysctl.conf -> ../sysctl.conf +
-[root@centos8 ~]# ls -l /usr/lib/sysctl.d/ +
-total 24 +
--rw-r--r--. 1 root root 1810 Dec 22  2020 10-default-yama-scope.conf +
--rw-r--r--. 1 root root  524 Mar 16 15:42 50-coredump.conf +
--rw-r--r--. 1 root root 1270 Mar 16 15:42 50-default.conf +
--rw-r--r--. 1 root root  246 Jun 15  2020 50-libkcapi-optmem_max.conf +
--rw-r--r--. 1 root root  636 Mar 16 15:42 50-pid-max.conf +
--rw-r--r--. 1 root root  499 Nov 26  2019 60-libvirtd.conf +
- +
-[root@centos8 ~]# cat /usr/lib/sysctl.d/50-default.conf  +
-#  This file is part of systemd. +
-+
-#  systemd is free software; you can redistribute it and/or modify it +
-#  under the terms of the GNU Lesser General Public License as published by +
-#  the Free Software Foundation; either version 2.1 of the License, or +
-#  (at your option) any later version. +
- +
-# See sysctl.d(5) and core(5) for documentation. +
- +
-# To override settings in this file, create a local file in /etc +
-# (e.g. /etc/sysctl.d/90-override.conf), and put any assignments +
-# there. +
- +
-# System Request functionality of the kernel (SYNC) +
-+
-# Use kernel.sysrq = 1 to allow all keys. +
-# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html for a list +
-# of values and keys. +
-kernel.sysrq = 16 +
- +
-# Append the PID to the core filename +
-kernel.core_uses_pid = 1 +
- +
-# https://bugzilla.redhat.com/show_bug.cgi?id=1689346 +
-kernel.kptr_restrict = 1 +
- +
-# Source route verification +
-net.ipv4.conf.all.rp_filter = 1 +
- +
-# Do not accept source routing +
-net.ipv4.conf.all.accept_source_route = 0 +
- +
-# Promote secondary addresses when the primary address is removed +
-net.ipv4.conf.all.promote_secondaries = 1 +
- +
-# Fair Queue CoDel packet scheduler to fight bufferbloat +
-net.core.default_qdisc = fq_codel +
- +
-# Enable hard and soft link protection +
-fs.protected_hardlinks = 1 +
-fs.protected_symlinks = 1+
 </code> </code>
  
-The command line switches of this command are:+Reload the profile:
  
 <code> <code>
-Usage: +[root@centos8 ~]# nmcli con up ip_fixed
- sysctl [options[variable[=value] ...] +
- +
-Options: +
-  -a, --all            display all variables +
-  -A                   alias of -a +
-  -X                   alias of -a +
-      --deprecated     include deprecated parameters to listing +
-  -b, --binary         print value without new line +
-  -e, --ignore         ignore unknown variables errors +
-  -N, --names          print variable names without values +
-  -n, --values         print only values of the given variable(s) +
-  -p, --load[=<file> read values from file +
-  -f                   alias of -p +
-      --system         read values from all system directories +
-  -r, --pattern <expression> +
-                       select setting that match expression +
-  -q, --quiet          do not echo variable set +
-  -w, --write          enable writing a value to variable +
-  -o                   does nothing +
-  -x                   does nothing +
-  -d                   alias of -h +
- +
- -h, --help     display this help and exit +
- -V, --version  output version information and exit +
- +
-For more details see sysctl(8).+
 </code> </code>
  
-=====LAB#3 - Interpreting Information in /proc===== +Check that the new IP address is visible:
- +
-The information found in files in the /proc filesystem can be interpreted using the following commands: +
- +
-  * free, +
-  * uptime et w, +
-  * iostat, +
-  * hdparm +
-  * vmstat, +
-  * mpstat, +
-  * sar.  +
- +
-====3.1 - The free Command==== +
- +
-The **free** command shows total, used, free, shared, buffered, cached and swapped memory:+
  
 <code> <code>
-[root@centos8 ~]# free -m +[root@centos8 ~]# nmcli connection show ip_fixed 
-              total        used        free      shared  buff/cache   available +connection.id:                          ip_fixed 
-Mem          3735        1135        1818          14         782        2363 +connection.uuid:                        0f48c74d-5d16-4c37-8220-24644507b589 
-Swap         3279                  3279+connection.stable-id:                   -- 
 +connection.type:                        802-3-ethernet 
 +connection.interface-name:              ens18 
 +connection.autoconnect:                 yes 
 +connection.autoconnect-priority:        
 +connection.autoconnect-retries:         -1 (default) 
 +connection.multi-connect:               0 (default) 
 +connection.auth-retries:                -1 
 +connection.timestamp:                   1630225792 
 +connection.read-only:                   no 
 +connection.permissions:                 -- 
 +connection.zone:                        -- 
 +connection.master:                      -- 
 +connection.slave-type:                  -- 
 +connection.autoconnect-slaves:          -1 (default) 
 +connection.secondaries:                 -- 
 +connection.gateway-ping-timeout:        
 +connection.metered:                     unknown 
 +connection.lldp:                        default 
 +connection.mdns:                        -1 (default) 
 +connection.llmnr:                       -1 (default) 
 +connection.wait-device-timeout:         -1 
 +802-3-ethernet.port:                    -- 
 +802-3-ethernet.speed:                   0 
 +802-3-ethernet.duplex:                  -- 
 +802-3-ethernet.auto-negotiate:          no 
 +802-3-ethernet.mac-address:             -- 
 +802-3-ethernet.cloned-mac-address:      -- 
 +802-3-ethernet.generate-mac-address-mask:-- 
 +802-3-ethernet.mac-address-blacklist:   -- 
 +802-3-ethernet.mtu:                     auto 
 +802-3-ethernet.s390-subchannels:        -- 
 +802-3-ethernet.s390-nettype           -- 
 +802-3-ethernet.s390-options:            -- 
 +802-3-ethernet.wake-on-lan:             default 
 +802-3-ethernet.wake-on-lan-password:    -- 
 +ipv4.method:                            manual 
 +ipv4.dns:                               8.8.8.8 
 +ipv4.dns-search:                        -- 
 +ipv4.dns-options:                       -- 
 +ipv4.dns-priority:                      0 
 +ipv4.addresses:                         10.0.2.46/24, 192.168.1.2/24 
 +ipv4.gateway:                           10.0.2.1 
 +ipv4.routes:                            -- 
 +ipv4.route-metric:                      -1 
 +ipv4.route-table:                       0 (unspec) 
 +ipv4.routing-rules:                     -- 
 +ipv4.ignore-auto-routes:                no 
 +ipv4.ignore-auto-dns:                   no 
 +ipv4.dhcp-client-id:                    -- 
 +ipv4.dhcp-iaid:                         -- 
 +ipv4.dhcp-timeout:                      0 (default) 
 +ipv4.dhcp-send-hostname:                yes 
 +ipv4.dhcp-hostname:                     -- 
 +ipv4.dhcp-fqdn:                         -- 
 +ipv4.dhcp-hostname-flags:               0x0 (none) 
 +ipv4.never-default:                     no 
 +ipv4.may-fail:                          yes 
 +ipv4.dad-timeout:                       -1 (default) 
 +ipv4.dhcp-vendor-class-identifier:      -- 
 +ipv4.dhcp-reject-servers:               -- 
 +ipv6.method:                            auto 
 +ipv6.dns:                               -- 
 +ipv6.dns-search:                        -- 
 +ipv6.dns-options:                       -- 
 +ipv6.dns-priority:                      0 
 +ipv6.addresses:                         -- 
 +ipv6.gateway:                           -- 
 +ipv6.routes:                            -- 
 +ipv6.route-metric:                      -1 
 +ipv6.route-table:                       0 (unspec) 
 +ipv6.routing-rules:                     -- 
 +ipv6.ignore-auto-routes:                no 
 +ipv6.ignore-auto-dns:                   no 
 +ipv6.never-default:                     no 
 +ipv6.may-fail:                          yes 
 +ipv6.ip6-privacy:                       -1 (unknown) 
 +ipv6.addr-gen-mode:                     stable-privacy 
 +ipv6.ra-timeout:                        0 (default) 
 +ipv6.dhcp-duid:                         -- 
 +ipv6.dhcp-iaid:                         -- 
 +ipv6.dhcp-timeout:                      0 (default) 
 +ipv6.dhcp-send-hostname:                yes 
 +ipv6.dhcp-hostname:                     -- 
 +ipv6.dhcp-hostname-flags:               0x0 (none) 
 +ipv6.token:                             -- 
 +proxy.method:                           none 
 +proxy.browser-only:                     no 
 +proxy.pac-url:                          -- 
 +proxy.pac-script:                       -- 
 +GENERAL.NAME:                           ip_fixed 
 +GENERAL.UUID:                           0f48c74d-5d16-4c37-8220-24644507b589 
 +GENERAL.DEVICES:                        ens18 
 +GENERAL.IP-IFACE:                       ens18 
 +GENERAL.STATE:                          activated 
 +GENERAL.DEFAULT:                        yes 
 +GENERAL.DEFAULT6:                       no 
 +GENERAL.SPEC-OBJECT:                    -- 
 +GENERAL.VPN:                            no 
 +GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/
 +GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/
 +GENERAL.ZONE:                           -- 
 +GENERAL.MASTER-PATH:                    -- 
 +IP4.ADDRESS[1]:                         10.0.2.46/24 
 +IP4.ADDRESS[2]:                         192.168.1.2/24 
 +IP4.GATEWAY:                            10.0.2.1 
 +IP4.ROUTE[1]:                           dst = 10.0.2.0/24, nh = 0.0.0.0, mt = 100 
 +IP4.ROUTE[2]:                           dst = 192.168.1.0/24, nh = 0.0.0.0, mt = 100 
 +IP4.ROUTE[3]:                           dst = 0.0.0.0/0, nh = 10.0.2.1, mt = 100 
 +IP4.DNS[1]:                             8.8.8.8 
 +IP6.ADDRESS[1]:                         fe80::5223:aee1:998e:9f27/64 
 +IP6.GATEWAY:                            -- 
 +IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 100 
 +IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 
 +lines 72-116/116 (END) 
 +[q]
 </code> </code>
  
-In the above example, you can see:+<WRAP center round important 60%> 
 +**Important** : Note the second address on the **ipv4.addresses: ** line and the addition of the **IP4.ADDRESS[2]:** line. 
 +</WRAP>
  
-  3735 MB of total physical memory, +Now check the **/etc/sysconfig/network-scripts/ifcfg-ip_fixed** file:
-  1135 MB of used physical memory and 1818 MB of free physical memory, +
-  3279 MB of swap space with 0MB being used. +
- +
-The command line switches of this command are:+
  
 <code> <code>
-[root@centos8 ~]# free --help +[root@centos8 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ip_fixed 
- +TYPE=Ethernet 
-Usage: +PROXY_METHOD=none 
- free [options] +BROWSER_ONLY=no 
- +BOOTPROTO=none 
-Options: +IPADDR=10.0.2.46 
- -b, --bytes         show output in bytes +PREFIX=24 
-     --kilo          show output in kilobytes +GATEWAY=10.0.2.1 
-     --mega          show output in megabytes +DEFROUTE=yes 
-     --giga          show output in gigabytes +IPV4_FAILURE_FATAL=no 
-     --tera          show output in terabytes +IPV6INIT=yes 
-     --peta          show output in petabytes +IPV6_AUTOCONF=yes 
- -k, --kibi          show output in kibibytes +IPV6_DEFROUTE=yes 
- -m, --mebi          show output in mebibytes +IPV6_FAILURE_FATAL=no 
- -g, --gibi          show output in gibibytes +IPV6_ADDR_GEN_MODE=stable-privacy 
-     --tebi          show output in tebibytes +NAME=ip_fixed 
-     --pebi          show output in pebibytes +UUID=0f48c74d-5d16-4c37-8220-24644507b589 
- -h, --human         show human-readable output +DEVICE=ens18 
-     --si            use powers of 1000 not 1024 +ONBOOT=yes 
- -l, --lohi          show detailed low and high memory statistics +DNS1=8.8.8.8 
- -t, --total         show total for RAM + swap +IPADDR1=192.168.1.
- -s N, --seconds N   repeat printing every N seconds +PREFIX1=24
- -c N, --count N     repeat printing N times, then exit +
- -w, --wide          wide output +
- +
-     --help     display this help and exit +
- -V, --version  output version information and exit +
- +
-For more details see free(1).+
 </code> </code>
  
-====3.2 - The uptime and w Commands==== +<WRAP center round important 60%
- +**Important** : Note the addition of the **IPADDR1=192.168.1.2** line. 
-Each of these commands show the load average over the past 1, 5 and 15 minutes: +</WRAP>
- +
-<code+
-[root@centos8 ~]# uptime +
- 04:39:03 up 1 day,  2:34,  1 user,  load average: 0.00, 0.00, 0.00 +
-  +
-[root@centos8 ~]# w +
- 04:39:04 up 1 day,  2:34,  1 user,  load average: 0.00, 0.00, 0.00 +
-USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT +
-trainee  pts/0    10.0.2.1         03:58    0.00s  0.11s  0.02s sshd: trainee [priv] +
-</code> +
- +
-The **load average** indicates the number of processes being executed and waiting to be executed for the period concerned. +
- +
-If the load average of a single-core system was **3.48  4.00  3.85** this would indicate a bottleneck since, on average:+
  
-  * 2.48 processes would have been waiting to be executed over the last minute, +====1.4 - The hostname Command====
-  * 3.00 processes would have been waiting to be executed over the last 5 minutes, +
-  * 2.85 processes would have been waiting to be executed over the last 15 minutes,+
  
-The command line switches of these commands are:+Any change to the hostname is immediate and permanent:
  
 <code> <code>
-[root@centos8 ~]# uptime --help+[root@centos8 ~]# hostname 
 +centos8.ittraining.loc
  
-Usage: +[root@centos8 ~]# nmcli general hostname centos.ittraining.loc
- uptime [options]+
  
-Options: +[root@centos8 ~]# cat /etc/hostname 
- -p, --pretty   show uptime in pretty format +centos.ittraining.loc
- -h, --help     display this help and exit +
- -s, --since    system up since +
- -V, --version  output version information and exit+
  
-For more details see uptime(1).+[root@centos8 ~]# hostname 
 +centos.ittraining.loc
  
-[root@centos8 ~]# w --help +[root@centos8 ~]# nmcli general hostname centos8.ittraining.loc
- +
-Usage: +
- w [options] +
- +
-Options: +
- -h, --no-header     do not print header +
- -u, --no-current    ignore current process username +
- -s, --short         short format +
- -f, --from          show remote hostname field +
- -o, --old-style     old style output +
- -i, --ip-addr       display IP address instead of hostname (if possible)+
  
-     --help     display this help and exit +[root@centos8 ~]# cat /etc/hostname 
- -V, --version  output version information and exit+centos8.ittraining.loc
  
-For more details see w(1).+[root@centos8 ~]# hostname 
 +centos8.ittraining.loc
 </code> </code>
  
-====3.- The iostat Command====+====1.- The ip Command====
  
-The **iostat** command show disk, terminal and streamer statistics:+Use of the **ip** command is now preferred over the use of the ifconfig command:
  
 <code> <code>
-[root@centos8 ~]# iostat +[root@centos8 ~]# ip address 
-bashiostatcommand not found... +1lo<LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 
-Install package 'sysstat' to provide command 'iostat'? [N/y] y +    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 
- +    inet 127.0.0.1/8 scope host lo 
- +       valid_lft forever preferred_lft forever 
- * Waiting in queue...  +    inet6 ::1/128 scope host  
-The following packages have to be installed+       valid_lft forever preferred_lft forever 
- lm_sensors-libs-3.4.0-22.20180522git70f7e08.el8.x86_64 Lm_sensors core libraries +2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 
- sysstat-11.7.3-5.el8.x86_64    Collection of performance monitoring tools for Linux +    link/ether 4e:b1:31:bd:5d:b2 brd ff:ff:ff:ff:ff:ff 
-Proceed with changes? [N/y] y +    inet 10.0.2.46/24 brd 10.0.2.255 scope global noprefixroute ens18 
- +       valid_lft forever preferred_lft forever 
- +    inet 192.168.1.2/24 brd 192.168.1.255 scope global noprefixroute ens18 
- * Waiting in queue...  +       valid_lft forever preferred_lft forever 
- * Waiting for authentication...  +    inet6 fe80::5223:aee1:998e:9f27/64 scope link noprefixroute  
- * Waiting in queue...  +       valid_lft forever preferred_lft forever 
- * Downloading packages...  +3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000 
- * Requesting data...  +    link/ether 52:54:00:79:02:66 brd ff:ff:ff:ff:ff:ff 
- * Testing changes...  +    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 
- * Installing packages...  +       valid_lft forever preferred_lft forever 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU) +4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000 
- +    link/ether 52:54:00:79:02:66 brd ff:ff:ff:ff:ff:ff
-avg-cpu:  %user   %nice %system %iowait  %steal   %idle +
-           0.03    0.00    0.03    0.01    0.00   99.93 +
- +
-Device             tps    kB_read/s    kB_wrtn/   kB_read    kB_wrtn +
-sda               0.28         7.67         1.49     735338     142510 +
-sdb               0.00         0.03         0.00       2995          0 +
-scd0              0.00         0.00         0.00          2          0 +
-dm-0              0.26         7.25         1.55     694786     148837 +
-dm-1              0.00         0.02         0.00       2220          0+
 </code> </code>
  
-<code> +===Command Line Switches===
-[root@centos8 ~]# iostat -d -x +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_        (8 CPU) +
- +
-Device            r/s     w/    rkB/    wkB/  rrqm/  wrqm/ %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util +
-sda              0.20    0.16     11.67      1.81     0.00     0.03   0.48  17.45    6.79   69.99   0.01    58.28    11.33   9.13   0.33 +
-sdb              0.00    0.00      0.02      0.00     0.00     0.00   0.00   0.00    0.13    0.00   0.00     8.81     0.00   0.51   0.00 +
-scd0             0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.20    0.00   0.00     0.20     0.00   0.90   0.00 +
-dm-0             0.12    0.19      3.98      1.90     0.00     0.00   0.00   0.00    4.18   79.07   0.02    32.88    10.07  10.34   0.32 +
-dm-1             0.00    0.00      0.01      0.00     0.00     0.00   0.00   0.00    0.76    0.00   0.00    21.35     0.00   0.68   0.00 +
-</code>+
  
 The command line switches of this command are: The command line switches of this command are:
  
 <code> <code>
-[root@centos8 ~]# iostat --help +[root@centos8 ~]# ip --help 
-Usage: iostat options ] [ <interval> [ <count>+Usage: ip OPTIONS OBJECT { COMMAND | help } 
-Options are+       ip -force -batch filename 
--] [ -d -h [ -k | -m ] -N -s ] [ --V ] [ -x ] -y -+where  OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | 
--ID LABEL PATH UUID ... ] [ --human ] [ -o JSON +                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | 
-[ [ -] -g <group_name> ] [ -<device> [,...] | ALL ] ] +                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila | 
-<device> [...] | ALL ] +                   vrf | sr | nexthop | mptcp } 
-</code> +       OPTIONS := { -V[ersion| -s[tatistics] | -d[etails] | -r[esolve
- +                    -h[uman-readable-iec | -j[son-p[retty| 
-====3.4 The hdparm Command==== +                    -f[amily] inet inet6 mpls bridge link 
- +                    -4 | -6 | -I | -D | -M | -B | -0 | 
-The hdparm command measures disk reads: +                    -l[oops] { maximum-addr-flush-attempts } | -br[ief| 
- +                    -o[neline] | -t[imestamp] | -ts[hort-b[atch] [filename] | 
-<code> +                    -rc[vbuf] [size] | -n[etnsname | -N[umeric] | -a[ll] | 
-[root@centos8 ~]# hdparm -t /dev/sda+                    -c[olor]}
  
-/dev/sda: 
- Timing buffered disk reads: 1410 MB in  3.00 seconds = 469.98 MB/sec 
 </code> </code>
  
-====3.La Commande vmstat====+====1.Manually Activating and Disactivating a Device====
  
-The **vmstat** commands shows memory, pagination and processor statistics:+Two commands exist for this purpose:
  
 <code> <code>
-[root@centos8 ~]vmstat 1 10 +nmcli device disconnect enp0s3 
-procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- +nmcli device connect enp0s3
-  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st +
-  0      0 1765216   2256 866336    0    0            9   12  0  0 100  0  0 +
-  0      0 1765136   2256 866336    0    0           57   80  0  0 100  0  0 +
-  0      0 1765136   2256 866376    0    0           54   77  0  0 100  0  0 +
-  0      0 1765136   2256 866376    0    0           66  100  0  0 100  0  0 +
-  0      0 1765136   2256 866376    0    0          103  125  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           64   86  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           62   88  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           68   97  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0           60   88  0  0 100  0  0 +
-  0      0 1765108   2256 866376    0    0          177  251  0  0 100  0  0 +
-</code> +
- +
-The command line switches of this command are: +
- +
-<code> +
-[root@centos8 ~]vmstat --help +
- +
-Usage: +
- vmstat [options] [delay [count]] +
- +
-Options: +
- -a, --active           active/inactive memory +
- -f, --forks            number of forks since boot +
- -m, --slabs            slabinfo +
- -n, --one-header       do not redisplay header +
- -s, --stats            event counter statistics +
- -d, --disk             disk statistics +
- -D, --disk-sum         summarize disk statistics +
- -p, --partition <dev>  partition specific statistics +
- -S, --unit <char>      define display unit +
- -w, --wide             wide output +
- -t, --timestamp        show timestamp +
- +
- -h, --help     display this help and exit +
- -V, --version  output version information and exit +
- +
-For more details see vmstat(8).+
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : By default vmstat shows statistics from boot until current time.+**Important** : Do **NOT** execute these two commands.
 </WRAP> </WRAP>
  
-====3.The mpstat Command====+====1.Static Routing====
  
-La commande **mpstat** affiche des statistiques détaillées sur le CPU :+===The ip Command===
  
-<code> +To delete the 192.168.1.0 route, use the following command:
-[root@centos8 ~]# mpstat +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU) +
- +
-04:53:22     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:53:22     all    0.03    0.00    0.01    0.02    0.01    0.01    0.00    0.00    0.00   99.92 +
-</code> +
- +
-If there are several CPU's in the system, statistics can be viewed by core and as an average:+
  
 <code> <code>
-[root@centos8 ~]# mpstat -P ALL +[root@centos8 ~]# ip route 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU)+default via 10.0.2.1 dev ens18 proto static metric 100  
 +10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  
 +192.168.1.0/24 dev ens18 proto kernel scope link src 192.168.1.2 metric 100  
 +192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
  
-04:54:28     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +root@centos8 ~]# ip route del 192.168.1.0/24 via 0.0.0.0 
-04:54:28     all    0.03    0.00    0.01    0.02    0.01    0.01    0.00    0.00    0.00   99.92 +[root@centos8 ~]# ip route 
-04:54:28          0.03    0.00    0.01    0.00    0.01    0.00    0.00    0.00    0.00   99.94 +default via 10.0.2.1 dev ens18 proto static metric 100  
-04:54:28          0.02    0.00    0.02    0.03    0.02    0.00    0.00    0.00    0.00   99.91 +10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  
-04:54:28          0.02    0.00    0.01    0.01    0.01    0.04    0.00    0.00    0.00   99.90 +192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown 
-04:54:28          0.01    0.00    0.01    0.02    0.00    0.00    0.00    0.00    0.00   99.95 +
-04:54:28          0.05    0.00    0.02    0.03    0.01    0.00    0.00    0.00    0.00   99.88 +
-04:54:28          0.03    0.01    0.01    0.02    0.01    0.00    0.00    0.00    0.00   99.92 +
-04:54:28          0.02    0.00    0.02    0.01    0.01    0.00    0.00    0.00    0.00   99.95 +
-04:54:28          0.02    0.00    0.01    0.01    0.01    0.00    0.00    0.00    0.00   99.94+
 </code> </code>
  
-Finally, mpstat is capable of showing statistics over timeIn the following example you can see 5 data sets, one taken every 2 seconds:+To add a route for the 192.168.1.0 network, use the following command:
  
 <code> <code>
-[root@centos8 ~]# mpstat -P ALL 2 5 +[root@centos8 ~]# ip route add 192.168.1.0/24 via 10.0.2.1 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +[root@centos8 ~]# ip route 
- +default via 10.0.2.1 dev ens18 proto static metric 100  
-04:55:11     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +10.0.2.0/24 dev ens18 proto kernel scope link src 10.0.2.46 metric 100  
-04:55:13     all    0.00    0.00    0.00    0.00    0.00    0.00    0.06    0.00    0.00   99.94 +192.168.1.0/24 via 10.0.2.1 dev ens18  
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown 
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.50    0.00    0.00   99.50 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:13          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:13     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:15     all    0.00    0.00    0.00    0.00    0.06    0.00    0.00    0.00    0.00   99.94 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:15          0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50 +
- +
-04:55:15     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:17     all    0.00    0.00    0.00    0.00    0.06    0.00    0.00    0.00    0.00   99.94 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.50    0.00    0.00    0.00    0.00   99.50 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:17          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:17     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:19     all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:19          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
- +
-04:55:19     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-04:55:21     all    0.06    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.94 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-04:55:21          0.50    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.50 +
- +
-Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle +
-Average:     all    0.01    0.00    0.00    0.00    0.02    0.00    0.01    0.00    0.00   99.95 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.10    0.00    0.00    0.00    0.00   99.90 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.10    0.00    0.00   99.90 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00 +
-Average:          0.10    0.00    0.00    0.00    0.10    0.00    0.00    0.00    0.00   99.80+
 </code> </code>
  
-The command line switches of this command are: +<WRAP center round important 60%
- +**Important** - The command used to add a default gateway is **ip route add default via //ip_address//**. 
-<code+</WRAP>
-[root@centos8 ~]# mpstat --help +
-Usage: mpstat [ options ] [ <interval> [ <count> ] ] +
-Options are: +
-[ -A ] [ -n ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ] +
-[ -N { <node_list> | ALL } ] [ -o JSON ] [ -P { <cpu_list> | ALL } ] +
-</code> +
- +
-====3.7 - The sar Command==== +
- +
-The **sar** command can survey all system resources dependant upon the switch that is usedSeveral important switches are:+
  
-^ Switch ^ Description ^ +===Disactivating/Activating Internal Routing on a Server===
-| -u | CPU usage in % | +
-| -q | Number of processes in the process queue | +
-| -r | Memory usage | +
-| -w | Swap usage | +
-| -p | Pagination usage | +
-| -b | Buffer usage | +
-| -d | Disk usage |+
  
-The **/usr/lib64/sa/sadc** command is used to collect data:+To disactivate internal routing between interfaces, use the following command:
  
 <code> <code>
-[root@centos8 ~]# ls /usr/lib64/sa +[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward 
-sa1  sa2  sadc+
 +[root@centos8 ~]# echo 0 > /proc/sys/net/ipv4/ip_forward 
 +[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward 
 +0
 </code> </code>
  
-The **/usr/lib64/sa/sa1** script calls the **/usr/lib/sa/sadc** command and can use two switches: +To activate internal routing between interfaces, use the following command:
- +
-^ Switch ^ Description ^ +
-| -t | Interval | +
-| -n | Count | +
- +
-The **/usr/lib64/sa/sa2** script also creates a log at **/var/log/sa/sar<dd>**, where <dd> is the day of the month.+
  
 <code> <code>
-[root@centos8 ~]# ls /var/log/sa+[root@centos8 ~]# echo 1 > /proc/sys/net/ipv4/ip_forward 
-sa29  s +[root@centos8 ~]# cat /proc/sys/net/ipv4/ip_forward 
- +1
- +
-ar29+
 </code> </code>
  
-Using CentOS / RHEL 8, the interval between collects is configured using systemd **timers** de systemd and not cron as was previously the case:+=====LAB #2 - Diagnostics=====
  
-<code> +====2.ping====
-[root@centos8 ~]# cat /usr/lib/systemd/system/sysstat-collect.timer +
-# /usr/lib/systemd/system/sysstat-collect.timer +
-# (C) 2014 Tomasz Torcz <tomek@pipebreaker.pl> +
-+
-# sysstat-11.7.3 systemd unit file: +
-#        Activates activity collector every 10 minutes +
- +
-[Unit] +
-Description=Run system activity accounting tool every 10 minutes +
- +
-[Timer] +
-OnCalendar=*:00/10 +
- +
-[Install] +
-WantedBy=sysstat.service +
-</code> +
- +
-The **OnCalendar** value indicates a collect every 10 minutes.+
  
-To change this valueyou need to create an **override** file in **/etc/systemd/system/** by using the **systemctl edit** command. You should never edit directly files in **/usr/lib/systemd/system** :+To test whether a destination can be reacheduse the **ping** command:
  
 <code> <code>
-[root@centos8 ~]# systemctl edit sysstat-collect.timer +[root@centos8 ~]# ping -c4 10.0.2.1 
-[root@centos8 ~]# cat /etc/systemd/system/sysstat-collect.timer.d/override.conf  +PING 10.0.2.1 (10.0.2.1) 56(84) bytes of data
-[Unit] +64 bytes from 10.0.2.1: icmp_seq=1 ttl=64 time=0.104 ms 
-Description=Run system activity accounting tool every minutes+64 bytes from 10.0.2.1: icmp_seq=2 ttl=64 time=0.325 ms 
 +64 bytes from 10.0.2.1: icmp_seq=3 ttl=64 time=0.250 ms 
 +64 bytes from 10.0.2.1: icmp_seq=4 ttl=64 time=0.123 ms
  
-[Timer] +--- 10.0.2.1 ping statistics --- 
-OnCalendar= +4 packets transmitted, 4 received, 0% packet loss, time 3083ms 
-OnCalendar=*:00/+rtt min/avg/max/mdev = 0.104/0.200/0.325/0.092 ms
-AccuracySec=0+
 </code> </code>
  
-<WRAP center round important 60%> +===Command Line Switches===
-**Important** : Note the line **OnCalendar=** which is required to override the default value. +
-</WRAP>+
  
-Now check if the configuration has been applied:+The command line switches of this command are:
  
 <code> <code>
-[root@centos8 ~]# systemctl status sysstat-collect.timer +[root@centos8 ~]# ping --help 
-● sysstat-collect.timer Run system activity accounting tool every 2 minutes +ping: invalid option -- '-' 
-   Loadedloaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; vendor preset: disabled) +Usageping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface] 
-  Drop-In: /etc/systemd/system/sysstat-collect.timer.+            [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] 
-           └─override.conf +            [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] 
-   Activeactive (waiting) since Tue 2021-06-29 06:16:04 EDT; 3h 2min ago +            [-w deadline] [-W timeout] [hop1 ...] destination 
-  Trigger: Tue 2021-06-29 09:20:00 EDT; 1min 19s left +Usageping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] 
- +             [-l preload] [-m mark] [-M pmtudisc_option] 
-Jun 29 06:16:04 centos8.ittraining.loc systemd[1]: Started Run system activity accounting tool every 10 minutes.+             [-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize] 
 +             [-S sndbuf[-t ttl] [-T timestamp_option] [-w deadline] 
 +             [-W timeout] destination
 </code> </code>
  
-<code> +====2.netstat -i====
-[root@centos8 ~]# journalctl -g sysstat-collect.service +
--- Logs begin at Mon 2021-06-28 02:04:10 EDT, end at Tue 2021-06-29 09:18:00 EDT. -- +
-Jun 29 06:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:26:29 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 06:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:00:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:10:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:20:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:30:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:40:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:50:33 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:53:56 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:54:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:56:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 07:58:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-Jun 29 08:00:00 centos8.ittraining.loc systemd[1]: sysstat-collect.service: Succeeded. +
-... +
-</code>+
  
-Execute the sar command:+To see networking statistics, use the **netstat** command:
  
 <code> <code>
-[root@centos8 ~]# sar +[root@centos8 ~]# netstat -i 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +Kernel Interface table 
- +Iface             MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg 
-06:16:04     LINUX RESTART      (8 CPU) +ens18            1500   476056           0 0        363562           0      0 BMRU 
- +lo              65536    10936           0 0         10936           0      0 LRU 
-06:20:33        CPU     %user     %nice   %system   %iowait    %steal     %idle +virbr0           1500             0      0 0             0      0      0      0 BMU
-06:26:29        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-06:30:33        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-06:40:33        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-06:50:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-07:00:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-07:10:33        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-07:20:33        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-07:30:33        all      0.02      0.01      0.03      0.00      0.00     99.94 +
-07:40:33        all      0.03      0.00      0.04      0.00      0.00     99.93 +
-07:50:33        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-07:53:56        all      0.08      0.00      0.06      0.00      0.00     99.86 +
-07:54:00        all      0.09      0.00      0.06      0.00      0.00     99.85 +
-Average:        all      0.03      0.00      0.03      0.00      0.00     99.94 +
- +
-07:55:44     LINUX RESTART      (8 CPU) +
- +
-07:56:00        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-07:58:00        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-08:00:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:02:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:04:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:06:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:08:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:10:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:12:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-08:14:00        all      0.02      0.00      0.03      0.01      0.00     99.94 +
-08:16:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:18:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:20:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:22:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:24:00        all      0.02      0.00      0.02      0.00      0.00     99.95 +
-08:26:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:28:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:30:00        all      0.02      0.05      0.05      0.00      0.00     99.87 +
-08:32:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:34:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:36:00        all      0.03      0.00      0.04      0.00      0.00     99.94 +
-08:38:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:40:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:42:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:44:00        all      0.03      0.00      0.03      0.00      0.00     99.94 +
-08:46:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-08:48:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-08:50:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:52:00        all      0.02      0.00      0.06      0.00      0.00     99.92 +
-08:54:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-08:56:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-08:58:00        all      0.02      0.00      0.02      0.00      0.00     99.96 +
-09:00:00        all      0.07      0.00      0.05      0.00      0.00     99.88 +
-09:02:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:04:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-09:06:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:08:00        all      0.02      0.00      0.04      0.00      0.00     99.94 +
-09:10:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-09:12:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
- +
-09:12:00        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-09:14:00        all      0.02      0.00      0.03      0.00      0.00     99.95 +
-09:16:00        all      0.02      0.00      0.06      0.00      0.00     99.92 +
-09:18:00        all      0.03      0.00      0.03      0.00      0.00     99.95 +
-09:20:00        all      0.02      0.00      0.03      0.00      0.00     99.94 +
-Average:        all      0.02      0.00      0.03      0.00      0.00     99.94+
 </code> </code>
  
-===CPU Stats===+===Command Line Switches===
  
-Use the -u switch+The command line switches of this command are:
  
 <code> <code>
-[root@centos8 ~]# sar -u 5 3 +[root@centos8 ~]# netstat --help 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help} 
 +       netstat [-vWnNcaeol] [<Socket> ...
 +       netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]
  
-09:22:52        CPU     %user     %nice   %system   %iowait    %steal     %idle +        -r, --route              display routing table 
-09:22:57        all      0.03      0.00      0.03      0.00      0.00     99.95 +        -I, --interfaces=<Iface> display interface table for <Iface> 
-09:23:02        all      0.03      0.00      0.03      0.00      0.00     99.95 +        -i, --interfaces         display interface table 
-09:23:07        all      0.00      0.00      0.03      0.00      0.00     99.97 +        -g, --groups             display multicast group memberships 
-Average:        all      0.02      0.00      0.03      0.00      0.00     99.96 +        -s, --statistics         display networking statistics (like SNMP) 
-</code>+        -M, --masquerade         display masqueraded connections
  
-More information can be shown by using the **ALL** argument:+        -v, --verbose            be verbose 
 +        -W, --wide               don't truncate IP addresses 
 +        -n, --numeric            don't resolve names 
 +        --numeric-hosts          don't resolve host names 
 +        --numeric-ports          don't resolve port names 
 +        --numeric-users          don't resolve user names 
 +        -N, --symbolic           resolve hardware names 
 +        -e, --extend             display other/more information 
 +        -p, --programs           display PID/Program name for sockets 
 +        -o, --timers             display timers 
 +        -c, --continuous         continuous listing
  
-<code> +        -l, --listening          display listening server sockets 
-[root@centos8 ~]# sar -u ALL 5 3 +        -a, --all                display all sockets (default: connected) 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_(8 CPU)+        -F, --fib                display Forwarding Information Base (default) 
 +        -C, --cache              display routing cache instead of FIB 
 +        -Z, --context            display SELinux security context for sockets
  
-01:49:14        CPU      %usr     %nice      %sys   %iowait    %steal      %irq     %soft    %guest    %gnice     %idle +  <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-S|--sctp} {-w|--raw} 
-01:49:19        all      0.03      0.00      0.00      0.00      0.00      0.03      0.00      0.00      0.00     99.95 +           {-x|--unix} --ax25 --ipx --netrom 
-01:49:24        all      0.03      0.00      0.03      0.00      0.00      0.10      0.05      0.00      0.00     99.80 +  <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; defaultinet 
-01:49:29        all      0.00      0.00      0.00      0.25      0.00      0.10      0.05      0.00      0.00     99.60 +  List of possible address families (which support routing)
-Average:        all      0.02      0.00      0.01      0.08      0.00      0.08      0.03      0.00      0.00     99.78+    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25 
 +    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)  
 +    x25 (CCITT X.25)
 </code> </code>
  
-To see the statistics from a specific core, use the **-P** switch:+====2.3 traceroute====
  
-<code> +This command is used to discover the route taken to reach a specified destination:
-[root@centos8 ~]# sar -u -P 1 5 3 +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +
- +
-01:51:52        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-01:51:57          1      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:02          1      0.20      0.00      0.00      0.00      0.00     99.80 +
-01:52:07          1      0.00      0.00      0.00      0.00      0.00    100.00 +
-Average:          1      0.07      0.00      0.00      0.00      0.00     99.93 +
-[root@centos8 ~]# sar -u -P 5 5 3 +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU) +
- +
-01:52:16        CPU     %user     %nice   %system   %iowait    %steal     %idle +
-01:52:21          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:26          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-01:52:31          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-Average:          5      0.00      0.00      0.00      0.00      0.00    100.00 +
-</code> +
- +
-===Memory and Swap Statistics=== +
- +
-Use the **-r** switch to see memory statistics:+
  
 <code> <code>
-[root@centos8 ~]# sar -r 5 3 +[root@centos8 ~]# traceroute www.ittraining.network 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_(8 CPU)+bash: traceroute: command not found... 
 +Install package 'traceroute' to provide command 'traceroute'? [N/y] y
  
-07:33:32    kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kbdirty 
-07:33:37      1647240   2297232   2177792     56.94      3356    827396   5096432     70.94    359072   1486368         0 
-07:33:42      1647232   2297224   2177800     56.94      3356    827396   5095788     70.93    359072   1486300         0 
-07:33:47      1647232   2297224   2177800     56.94      3356    827396   5095788     70.93    359072   1486376         0 
-Average:      1647235   2297227   2177797     56.94      3356    827396   5096003     70.94    359072   1486348         0 
-</code> 
  
-Use the **-S** switch to see swap statistics:+ Waiting in queue...  
 +The following packages have to be installed: 
 + traceroute-3:2.1.0-6.el8.x86_64        Traces the route taken by packets over an IPv4/IPv6 network 
 +Proceed with changes? [N/y] y
  
-<code> 
-[root@centos8 ~]# sar -S 5 3 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_(8 CPU) 
  
-07:31:58    kbswpfree kbswpused  %swpused  kbswpcad   %swpcad + * Waiting in queue...  
-07:32:03      3358716              0.00         0      0.00 + * Waiting for authentication...  
-07:32:08      3358716              0.00         0      0.00 + * Waiting in queue...  
-07:32:13      3358716              0.00         0      0.00 + * Downloading packages...  
-Average:      3358716              0.00         0      0.00+ * Requesting data...  
 + * Testing changes...  
 + * Installing packages...  
 +traceroute to www.ittraining.network (109.228.56.52), 30 hops max, 60 byte packets 
 +  _gateway (10.0.2.1)  0.132 ms  0.101 ms  0.078 ms 
 + 2  79.137.68.252 (79.137.68.252)  0.542 ms  0.656 ms  0.809 ms 
 +  10.50.24.61 (10.50.24.61)  0.238 ms  0.219 ms 10.50.24.60 (10.50.24.60)  0.239 ms 
 + 4  10.50.0.16 (10.50.0.16)  0.172 ms 10.50.0.22 (10.50.0.22)  0.194 ms  0.173 ms 
 + 5  10.73.248.192 (10.73.248.192)  0.766 ms 10.73.248.194 (10.73.248.194)  0.730 ms 10.73.248.192 (10.73.248.192)  0.757 ms 
 +  waw-wa2-sbb1-nc5.pl.eu (91.121.131.150)  1.102 ms  1.396 ms  1.099 ms 
 +  fra-fr5-sbb1-nc5.de.eu (213.251.128.113)  18.309 ms fra-fr5-sbb2-nc5.de.eu (54.36.50.116)  21.881 ms fra-fr5-sbb1-nc5.de.eu (213.251.128.113)  16.764 ms 
 +  10.200.0.6 (10.200.0.6)  20.922 ms 10.200.0.0 (10.200.0.0)  16.959 ms 10.200.0.4 (10.200.0.4)  21.143 ms 
 +  decix.bb-a.fra3.fra.de.oneandone.net (80.81.192.123)  18.789 ms decix.bb-c.act.fra.de.oneandone.net (80.81.193.123)  20.310 ms decix.bb-a.fra3.fra.de.oneandone.net (80.81.192.123)  18.693 ms 
 +10  ae-14.bb-b.fr7.fra.de.oneandone.net (212.227.120.149)  22.222 ms  22.206 ms  22.257 ms 
 +11  port-channel-3.gw-ngcs-1.dc1.con.glo.gb.oneandone.net (88.208.255.131)  39.660 ms  39.679 ms ae-19.bb-b.thn.lon.gb.oneandone.net (212.227.120.33)  33.973 ms 
 +12  109.228.63.209 (109.228.63.209)  37.363 ms port-channel-3.gw-ngcs-1.dc1.con.glo.gb.oneandone.net (88.208.255.131)  39.534 ms 109.228.63.209 (109.228.63.209)  37.901 ms 
 +13  * 109.228.63.209 (109.228.63.209)  38.014 ms  37.991 ms 
 +14  * * * 
 +15  * * * 
 +16  * * * 
 +17  * * * 
 +18  * * * 
 +19  * * * 
 +20  * * * 
 +21  * * * 
 +22  * * * 
 +23  * * * 
 +24  * * * 
 +25  * * * 
 +26  * * * 
 +27  * * * 
 +28  * * * 
 +29  * * *^C
 </code> </code>
  
-===I/O Statistics===+===Command Line Switches===
  
-Use the **-b** switch:+The command line switches of this command are:
  
 <code> <code>
-[root@centos8 ~]# sar -b 5 3 +[root@centos8 ~]# traceroute --help 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc       29/06/21        _x86_64_        (8 CPU)+Usage: 
 +  traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w MAX,HERE,NEAR ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ] 
 +Options: 
 +  -                         Use IPv4 
 +  -6                          Use IPv6 
 +  -d  --debug                 Enable socket level debugging 
 +  -F  --dont-fragment         Do not fragment packets 
 +  -f first_ttl  --first=first_ttl 
 +                              Start from the first_ttl hop (instead from 1) 
 +  -g gate,...  --gateway=gate,..
 +                              Route packets through the specified gateway 
 +                              (maximum 8 for IPv4 and 127 for IPv6) 
 +  -I  --icmp                  Use ICMP ECHO for tracerouting 
 +  -T  --tcp                   Use TCP SYN for tracerouting (default port is 80) 
 +  -i device  --interface=device 
 +                              Specify a network interface to operate with 
 +  -m max_ttl  --max-hops=max_ttl 
 +                              Set the max number of hops (max TTL to be 
 +                              reached). Default is 30 
 +  -N squeries  --sim-queries=squeries 
 +                              Set the number of probes to be tried 
 +                              simultaneously (default is 16) 
 +  -n                          Do not resolve IP addresses to their domain names 
 +  -p port  --port=port        Set the destination port to use. It is either 
 +                              initial udp port value for "default" method 
 +                              (incremented by each probe, default is 33434), or 
 +                              initial seq for "icmp" (incremented as well, 
 +                              default from 1), or some constant destination 
 +                              port for other methods (with default of 80 for 
 +                              "tcp", 53 for "udp", etc.
 +  -t tos  --tos=tos           Set the TOS (IPv4 type of service) or TC (IPv6 
 +                              traffic class) value for outgoing packets 
 +  -l flow_label  --flowlabel=flow_label 
 +                              Use specified flow_label for IPv6 packets 
 +  -w MAX,HERE,NEAR  --wait=MAX,HERE,NEAR 
 +                              Wait for a probe no more than HERE (default 3) 
 +                              times longer than a response from the same hop, 
 +                              or no more than NEAR (default 10) times than some 
 +                              next hop, or MAX (default 5.0) seconds (float 
 +                              point values allowed too) 
 +  -q nqueries  --queries=nqueries 
 +                              Set the number of probes per each hopDefault is 
 +                              3 
 +  -r                          Bypass the normal routing and send directly to a 
 +                              host on an attached network 
 +  -s src_addr  --source=src_addr 
 +                              Use source src_addr for outgoing packets 
 +  -z sendwait  --sendwait=sendwait 
 +                              Minimal time interval between probes (default 0). 
 +                              If the value is more than 10, then it specifies a 
 +                              number in milliseconds, else it is a number of 
 +                              seconds (float point values allowed too) 
 +  -e  --extensions            Show ICMP extensions (if present), including MPLS 
 +  -A  --as-path-lookups       Perform AS path lookups in routing registries and 
 +                              print results directly after the corresponding 
 +                              addresses 
 +  -M name  --module=name      Use specified module (either builtin or external) 
 +                              for traceroute operations. Most methods have 
 +                              their shortcuts (`-I' means `-M icmp' etc.) 
 +  -O OPTS,...  --options=OPTS,... 
 +                              Use module-specific option OPTS for the 
 +                              traceroute module. Several OPTS allowed, 
 +                              separated by comma. If OPTS is "help", print info 
 +                              about available options 
 +  --sport=num                 Use source port num for outgoing packets. Implies 
 +                              `-N 1' 
 +  --fwmark=num                Set firewall mark for outgoing packets 
 +  -U  --udp                   Use UDP to particular port for tracerouting 
 +                              (instead of increasing the port per each probe), 
 +                              default port is 53 
 +  -UL                         Use UDPLITE for tracerouting (default dest port 
 +                              is 53) 
 +  -D  --dccp                  Use DCCP Request for tracerouting (default port 
 +                              is 33434) 
 +  -P prot  --protocol=prot    Use raw packet of protocol prot for tracerouting 
 +  --mtu                       Discover MTU along the path being traced. Implies 
 +                              `-F -N 1' 
 +  --back                      Guess the number of hops in the backward path and 
 +                              print if it differs 
 +  -V  --version               Print version info and exit 
 +  --help                      Read this help and exit
  
-09:24:49          tps      rtps      wtps   bread/  bwrtn/s +Arguments: 
-09:24:54         0.00      0.00      0.00      0.00      0.00 ++     host          The host to traceroute to 
-09:24:59         1.20      0.00      1.20      0.00     20.20 +      packetlen     The full packet length (default is the length of an IP 
-09:25:04         0.00      0.00      0.00      0.00      0.00 +                    header plus 40)Can be ignored or increased to a minimal 
-Average:         0.40      0.00      0.40      0.00      6.73+                    allowed value
 </code> </code>
  
-===Disk I/O Statistics===+===== LAB #3 - SSH====
  
-Use the **-d** switch:+====3.1 Presentation====
  
-<code> +There are two types of SSH.
-[root@centos8 ~]# sar -d 5 3 +
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        29/06/21        _x86_64_        (8 CPU)+
  
-09:25:45          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +===SSH-1===
-09:25:50       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50     dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:50     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-09:25:50          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +To authenticate there are six possible methods:
-09:25:55       dev8-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:55      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:55      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:55     dev253-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-09:25:55     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+
  
-09:25:55          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +  * **Kerberos**, 
-09:26:00       dev8-0      0.60      0.00      0.30      0.50      0.01     13.00     13.00      0.78 +  * **Rhosts**, 
-09:26:00      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * **%%RhostsRSA%%**, 
-09:26:00      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +  * **Asymetric Keys**, 
-09:26:00     dev253-0      0.60      0.00      0.50      0.83      0.01     12.67     13.00      0.78 +  * **TIS**, 
-09:26:00     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00+  * **Password**.
  
-Average:          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +==SSH-2==
-Average:       dev8-0      0.20      0.00      0.10      0.50      0.00     13.00     13.00      0.26 +
-Average:      dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:      dev11-0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:     dev253-0      0.20      0.00      0.17      0.83      0.00     12.67     13.00      0.26 +
-Average:     dev253-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-</code>+
  
-The **DEV** column identifies the disks by their major/minor numbers. To see the names of the disks add the, **-p** switch:+To authenticate there are three possible methods:
  
-<code> +  * **Asymetric Keys**, 
-[root@centos8 ~]# sar -p -d 5 3 +  * **%%RhostsRSA%%**, 
-Linux 4.18.0-305.3.1.el8.x86_64 (centos8.ittraining.loc)        30/06/21        _x86_64_        (8 CPU)+  * **Password**
  
-07:48:32          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +===Command Line Switches===
-07:48:37          sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37    cl_centos8-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:37    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
- +
-07:48:37          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +
-07:48:42          sda      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42    cl_centos8-root      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:42    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
- +
-07:48:42          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +
-07:48:47          sda      0.40      0.00      0.40      1.00      0.02     56.00     56.50      2.26 +
-07:48:47          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:47          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-07:48:47    cl_centos8-root      0.40      0.00      0.80      2.00      0.02     56.00     56.50      2.26 +
-07:48:47    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
- +
-Average:          DEV       tps     rkB/    wkB/  areq-sz    aqu-sz     await     svctm     %util +
-Average:          sda      0.13      0.00      0.13      1.00      0.01     56.00     56.50      0.75 +
-Average:          sdb      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-Average:    cl_centos8-root      0.13      0.00      0.27      2.00      0.01     56.00     56.50      0.75 +
-Average:    cl_centos8-swap      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00 +
-</code>+
  
 The command line switches of this command are: The command line switches of this command are:
  
 <code> <code>
-[root@centos8 ~]# sar --help +[root@centos8 ~]# ssh --help 
-Usagesar options ] [ <interval> [ <count> ] ] +unknown option -- - 
-Main options and reports (report name between square brackets): +usagessh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface
-        -B      Paging statistics [A_PAGE+           [-b bind_address] [-c cipher_spec[-[bind_address:]port
-        -b      I/O and transfer rate statistics [A_IO] +           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] 
-        -d      Block devices statistics [A_DISK+           [-i identity_file[-[user@]host[:port]] [-L address
-        -MOUNT ] +           [-l login_name[-m mac_spec] [-O ctl_cmd[-o option] [-p port
-                Filesystems statistics [A_FS] +           [-Q query_option] [-R address] [-S ctl_path] [-W host:port
-        -H      Hugepages utilization statistics [A_HUGE] +           [-w local_tun[:remote_tun]] destination [command]
-        -I { <int_list> | SUM | ALL } +
-                Interrupts statistics [A_IRQ] +
-        -m { <keyword> [,...| ALL } +
-                Power management statistics [A_PWR_...] +
-                Keywords are: +
-                CPU     CPU instantaneous clock frequency +
-                FAN     Fans speed +
-                FREQ    CPU average clock frequency +
-                IN      Voltage inputs +
-                TEMP    Devices temperature +
-                USB     USB devices plugged into the system +
-        -n { <keyword> [,...| ALL } +
-                Network statistics [A_NET_...] +
-                Keywords are: +
-                DEV     Network interfaces +
-                EDEV    Network interfaces (errors) +
-                NFS     NFS client +
-                NFSD    NFS server +
-                SOCK    Sockets (v4) +
-                IP      IP traffic      (v4) +
-                EIP     IP traffic      (v4) (errors) +
-                ICMP    ICMP traffic    (v4) +
-                EICMP   ICMP traffic    (v4) (errors) +
-                TCP     TCP traffic     (v4) +
-                ETCP    TCP traffic     (v4) (errors) +
-                UDP     UDP traffic     (v4) +
-                SOCK6   Sockets (v6) +
-                IP6     IP traffic      (v6) +
-                EIP6    IP traffic      (v6) (errors) +
-                ICMP6   ICMP traffic    (v6) +
-                EICMP6  ICMP traffic    (v6) (errors) +
-                UDP6    UDP traffic     (v6) +
-                FC      Fibre channel HBAs +
-                SOFT    Software-based network processing +
-        -q      Queue length and load average statistics [A_QUEUE] +
-        -ALL +
-                Memory utilization statistics [A_MEMORY] +
-        -S      Swap space utilization statistics [A_MEMORY] +
-        -u [ ALL ] +
-                CPU utilization statistics [A_CPU] +
-        -v      Kernel tables statistics [A_KTABLES] +
-        -W      Swapping statistics [A_SWAP+
-        -w      Task creation and system switching statistics [A_PCSW] +
-        -y      TTY devices statistics [A_SERIAL]+
 </code> </code>
  
-=====USB Modules=====+====3.2 - Configuring the Server====
  
-The Universal Serial Bus can offer data transfer speeds of upto 480Mb/s for version 2.0 and upto 4.8 Gb/s for version 3.0. Under Linux the USB modules are:+The server is configured by editing the **/etc/ssh/sshd_config** file:
  
-^ USB Version ^ Module ^ Name ^ +<code> 
-|  1.0\1.1  | **UHCI** | //Universal Controller Host Interface// | +[root@centos8 ~]# cat /etc/ssh/sshd_config 
-|  :::  | **OHCI** | //Open Controller Host Interface// | +#       $OpenBSDsshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
-|  2.0  | **EHCI** | //Enhanced Host Controller Interface// | +
-|  3.0  | **XHCI** | //Extensible Host Controller Interface// |+
  
-The following table shows a list of commonly used USB modules:+# This is the sshd server system-wide configuration file.  See 
 +# sshd_config(5) for more information.
  
-^ Module ^ Peripheral ^  +# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
-|  **usb_storage**  | Block devices | +
-|  **usbhid**  | Human Interface Device | +
-|  **snd-usb-audio**  | Sound cards | +
-|  **usbvidéo**  | Video acquisition cards | +
-|  **irda-usb**  | IR peripherals | +
-|  **usbnet**  | NICs |+
  
-These modules can be loaded by any one of the following:+# The strategy used for options in the default sshd_config shipped with 
 +# OpenSSH is to specify options with their default value where 
 +# possible, but leave them commented.  Uncommented options override the 
 +# default value.
  
-  * Initramfs, +# If you want to change the port on SELinux system, you have to tell 
-  * The init process, +# SELinux about this change. 
-  * kmod by using the **/lib/modules/2.6.32-358.23.2.el6.i686/modules.usbmap** file, +# semanage port --t ssh_port_t -p tcp #PORTNUMBER
-  * udev, +
-  * manually. +
- +
-=====udev===== +
- +
-Since the 2.6 Kernel series, Linux capable of **hotplugging**. Linux uses three componants to manage hotplugging: +
- +
-  * Udev, +
-  * HAL, +
-  * Dbus. +
- +
-The roles of each componant are as follows: +
- +
-  * Udev dynamically creates/deletes nodes in the **/dev** directory, +
-  * HAL obtains information from udev, creates a files in XML format representing the peripheral and then informs Nautilus by using Dbus, +
-  * Dbus acts as a system bus and is used for inter-process communication. +
- +
-When Linux is bootedudev plays an important role: +
- +
-  * at boot **tmpfs** is mounted on /dev, +
-  * udev copies any statically configured nodes from **/lib/udev/devices** to /dev, +
-  * the **udevd** daemon collects **uevents** from the kernel and looks for anappropriate rule in the **/lib/udev/rules.d/** directory, +
-  * udev creates the nodes and any required symbolic links specified in the rule previously identified, +
-  * udev stores in RAM the rules from **/lib/udev/rules.d/*.rules**, +
-  * when a change occurs udev updates the the rules in the RAM+
- +
-udev uses the **sysfs** filesystem mounted on /sys which renders the peripherals visible to udev in user space. For example when USB stick is inserted, udev creates **/dev/sdb1** automatically +
- +
-The main configuration file for udev is **/etc/udev/udev.conf** : +
- +
-<code> +
-[root@centos8 ~]cat /etc/udev/udev.conf +
-# see udev.conf(5) for details+
 # #
-udevd is also started in the initrd.  When this file is modified you might +#Port 22 
-also want to rebuild the initrd, so that it will include the modified configuration.+#AddressFamily any 
 +#ListenAddress 0.0.0.0 
 +#ListenAddress ::
  
-#udev_log="info" +HostKey /etc/ssh/ssh_host_rsa_key 
-</code>+HostKey /etc/ssh/ssh_host_ecdsa_key 
 +HostKey /etc/ssh/ssh_host_ed25519_key
  
-Rules files can be foud in **/lib/udev/rules.d/** :+# Ciphers and keying 
 +#RekeyLimit default none
  
-<code> +This system is following system-wide crypto policyThe changes to 
-[root@centos8 ~]ls /lib/udev/rules.d/ +# crypto properties (Ciphers, MACs, ...) will not have any effect here
-01-md-raid-creating.rules              70-uaccess.rules +# They will be overridden by command-line options passed to the server 
-10-dm.rules                            70-wacom.rules +# on command line
-11-dm-lvm.rules                        71-biosdevname.rules +# Please, check manual pages for update-crypto-policies(8) and sshd_config(5).
-11-dm-mpath.rules                      71-nvmf-iopolicy-netapp.rules +
-11-dm-parts.rules                      71-prefixdevname.rules +
-13-dm-disk.rules                       71-seat.rules +
-39-usbmuxd.rules                       73-idrac.rules +
-40-elevator.rules                      73-seat-late.rules +
-40-libgphoto2.rules                    75-net-description.rules +
-40-redhat.rules                        75-probe_mtd.rules +
-40-usb-blacklist.rules                 75-rdma-description.rules +
-40-usb_modeswitch.rules                77-mm-cinterion-port-types.rules +
-50-udev-default.rules                  77-mm-dell-port-types.rules +
-60-alias-kmsg.rules                    77-mm-ericsson-mbm.rules +
-60-block.rules                         77-mm-fibocom-port-types.rules +
-60-cdrom_id.rules                      77-mm-haier-port-types.rules +
-60-drm.rules                           77-mm-huawei-net-port-types.rules +
-60-evdev.rules                         77-mm-longcheer-port-types.rules +
-60-fido-id.rules                       77-mm-mtk-port-types.rules +
-60-input-id.rules                      77-mm-nokia-port-types.rules +
-60-libfprint-2-autosuspend.rules       77-mm-pcmcia-device-blacklist.rules +
-60-net.rules                           77-mm-quectel-port-types.rules +
-60-persistent-alsa.rules               77-mm-sierra.rules +
-60-persistent-input.rules              77-mm-simtech-port-types.rules +
-60-persistent-storage.rules            77-mm-telit-port-types.rules +
-60-persistent-storage-tape.rules       77-mm-ublox-port-types.rules +
-60-persistent-v4l.rules                77-mm-usb-device-blacklist.rules +
-60-raw.rules                           77-mm-usb-serial-adapters-greylist.rules +
-60-rdma-ndd.rules                      77-mm-x22x-port-types.rules +
-60-rdma-persistent-naming.rules        77-mm-zte-port-types.rules +
-60-sensor.rules                        78-sound-card.rules +
-60-serial.rules                        80-drivers.rules +
-60-tpm-udev.rules                      80-iio-sensor-proxy.rules +
-61-gdm.rules                           80-libinput-device-groups.rules +
-61-gnome-bluetooth-rfkill.rules        80-mm-candidate.rules +
-61-gnome-settings-daemon-rfkill.rules  80-net-setup-link.rules +
-61-scsi-sg3_id.rules                   80-udisks2.rules +
-62-multipath.rules                     81-kvm-rhel.rules +
-63-fc-wwpn-id.rules                    84-nm-drivers.rules +
-63-md-raid-arrays.rules                85-nm-unmanaged.rules +
-63-scsi-sg3_symlink.rules              85-regulatory.rules +
-64-btrfs.rules                         90-alsa-restore.rules +
-64-md-raid-assembly.rules              90-bolt.rules +
-65-libwacom.rules                      90-fwupd-devices.rules +
-65-md-incremental.rules              Limiter les Ressources  90-iprutils.rules +
-65-sane-backends.rules                 90-libinput-fuzz-override.rules +
-66-kpartx.rules                        90-nm-thunderbolt.rules +
-68-del-part-nodes.rules                90-pulseaudio.rules +
-69-btattach-bcm.rules                  90-rdma-hw-modules.rules +
-69-cd-sensors.rules                    90-rdma-ulp-modules.rules +
-69-dm-lvm-metad.rules                  90-rdma-umad.rules +
-69-libmtp.rules                        90-vconsole.rules +
-69-md-clustered-confirm-device.rules   91-drm-modeset.rules +
-70-hypervfcopy.rules                   95-cd-devices.rules +
-70-hypervkvp.rules                     95-dm-notify.rules +
-70-hypervvss.rules                     95-upower-csr.rules +
-70-joystick.rules                      95-upower-hid.rules +
-70-mouse.rules                         95-upower-wup.rules +
-70-nvmf-autoconnect.rules              98-kexec.rules +
-70-power-switch.rules                  99-qemu-guest-agent.rules +
-70-printers.rules                      99-systemd.rules +
-70-spice-vdagentd.rules                99-vmware-scsi-udev.rules +
-70-touchpad.rules +
-</code>+
  
-<WRAP center round important 60%> +# Logging 
-**Important** : You can create your own rules by putting them in the **99-local.rules** file. +#SyslogFacility AUTH 
-</WRAP>+SyslogFacility AUTHPRIV 
 +#LogLevel INFO
  
-The default udev rule file is **50-udev-default.rules**:+# Authentication:
  
-<code> +#LoginGraceTime 2m 
-[root@centos8 ~]cat /lib/udev/rules.d/50-udev-default.rules | more +PermitRootLogin yes 
-do not edit this file, it will be overwritten on update+#StrictModes yes 
 +#MaxAuthTries 6 
 +#MaxSessions 10
  
-run a command on remove events +#PubkeyAuthentication yes
-ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" +
-ACTION=="remove", GOTO="default_end"+
  
-SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"+# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 
 +# but this is overridden so installations will only check .ssh/authorized_keys 
 +AuthorizedKeysFile      .ssh/authorized_keys
  
-select "system RTC" or just use the first one +#AuthorizedPrincipalsFile none
-SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" +
-SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100"+
  
-SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb" +#AuthorizedKeysCommand none 
-ENV{MODALIAS}!="", IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}"+#AuthorizedKeysCommandUser nobody
  
-ACTION!="add", GOTO="default_end"+# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts 
 +#HostbasedAuthentication no 
 +# Change to yes if you don't trust ~/.ssh/known_hosts for 
 +# HostbasedAuthentication 
 +#IgnoreUserKnownHosts no 
 +# Don't read the user's ~/.rhosts and ~/.shosts files 
 +#IgnoreRhosts yes
  
-SUBSYSTEM=="tty"KERNEL=="ptmx", GROUP="tty", MODE="0666" +# To disable tunneled clear text passwordschange to no here! 
-SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666" +#PasswordAuthentication yes 
-SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" +#PermitEmptyPasswords no 
-SUBSYSTEM=="tty", KERNEL=="sclp_line[0-9]*", GROUP="tty", MODE="0620" +PasswordAuthentication yes
-SUBSYSTEM=="tty", KERNEL=="ttysclp[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="tty", KERNEL=="3270/tty[0-9]*", GROUP="tty", MODE="0620" +
-SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty" +
-KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"+
  
-SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"+# Change to no to disable s/key passwords 
 +#ChallengeResponseAuthentication yes 
 +ChallengeResponseAuthentication no
  
-SUBSYSTEM=="input", GROUP="input" +# Kerberos options 
-SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"+#KerberosAuthentication no 
 +#KerberosOrLocalPasswd yes 
 +#KerberosTicketCleanup yes 
 +#KerberosGetAFSToken no 
 +#KerberosUseKuserok yes
  
-SUBSYSTEM=="video4linux", GROUP="video" +# GSSAPI options 
-SUBSYSTEM=="graphics", GROUP="video" +GSSAPIAuthentication yes 
-SUBSYSTEM=="drm", KERNEL!="renderD*", GROUP="video" +GSSAPICleanupCredentials no 
-SUBSYSTEM=="dvb", GROUP="video" +#GSSAPIStrictAcceptorCheck yes 
-SUBSYSTEM=="media", GROUP="video" +#GSSAPIKeyExchange no 
-SUBSYSTEM=="cec", GROUP="video"+#GSSAPIEnablek5users no
  
-SUBSYSTEM=="drm"KERNEL=="renderD*"GROUP="render"MODE="0666" +# Set this to 'yes' to enable PAM authenticationaccount processing, 
-SUBSYSTEM=="kfd"GROUP="render", MODE="0666"+# and session processing. If this is enabledPAM authentication will 
 +# be allowed through the ChallengeResponseAuthentication and 
 +# PasswordAuthentication.  Depending on your PAM configuration, 
 +# PAM authentication via ChallengeResponseAuthentication may bypass 
 +# the setting of "PermitRootLogin without-password"
 +# If you just want the PAM account and session checks to run without 
 +# PAM authenticationthen enable this but set PasswordAuthentication 
 +# and ChallengeResponseAuthentication to 'no'
 +# WARNING: 'UsePAM no' is not supported in Fedora and may cause several 
 +# problems. 
 +UsePAM yes
  
-SUBSYSTEM=="sound", GROUP="audio", \ +#AllowAgentForwarding yes 
-  OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" +#AllowTcpForwarding yes 
---More-- +#GatewayPorts no 
-</code>+X11Forwarding yes 
 +#X11DisplayOffset 10 
 +#X11UseLocalhost yes 
 +#PermitTTY yes
  
-Each rule has the following format:+# It is recommended to use pam_motd in /etc/pam.d/sshd instead of PrintMotd, 
 +# as it is more configurable and versatile than the built-in version. 
 +PrintMotd no
  
-KEY, [KEY, ...] NAME [, SYMLINK]+#PrintLastLog yes 
 +#TCPKeepAlive yes 
 +#PermitUserEnvironment no 
 +#Compression delayed 
 +#ClientAliveInterval 0 
 +#ClientAliveCountMax 3 
 +#UseDNS no 
 +#PidFile /var/run/sshd.pid 
 +#MaxStartups 10:30:100 
 +#PermitTunnel no 
 +#ChrootDirectory none 
 +#VersionAddendum none
  
-The Key is a **type=value** pair which uniquely identifies a peripheral. The **type** can be one of the following:+# no default banner path 
 +#Banner none
  
-^ Type ^ Description ^ Examples ^ +# Accept locale-related environment variables 
-| BUS | Bus type | usb, scsi, ide | +AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
-| KERNEL | The default name given to the peripheral by the kernel | hda, ttyUSB0, lp0 | +AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
-| SUBSYSTEM | The default sub-system name given by the Kernel, generally identical to the BUS value | usb, scsi | +AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE 
-| DRIVER | The name of the module used by the peripheral | usb-storage | +AcceptEnv XMODIFIERS
-| ID | The position of the peripheral on its bus | PCI bus id, USB id | +
-| PLACE | The topological position of a USB oeripheral on its bus. | S/O | +
-| SYSFS{filename} | The name of the peripheral file in /sys. This file contains the manufacturer's name, the label, the serial number and the UUID of the peripheral. Each rule can contains upto five references to files. | S/O | +
-| PROGRAM | An eventual external program to be called in order to identify the peripheral | S/O | +
-| RESULT | Value expected from PROGRAM | S/O |+
  
-NAME and SYMLINK are used to tell udev what to do with the peripheral:+# override default of no subsystems 
 +Subsystem       sftp    /usr/libexec/openssh/sftp-server
  
-^ Type ^ Description ^  +# Example of overriding settings on a per-user basis 
-| NAME | The name of the peripheral in /dev | +#Match User anoncvs 
-| SYMLINK | The eventual symbolic links that point to NAME | +#       X11Forwarding no 
- +      AllowTcpForwarding no 
-====The udevadm Command==== +#       PermitTTY no 
- +#       ForceCommand cvs server
-To obtain information from udev on a particular peripheral, you can use the **udevadm** command which has replaced the **udevinfo** command available in Red Hat/CentOS 5: +
- +
-<code> +
-[root@centos8 ~]udevadm info --query=all -n /dev/sda +
-P: /devices/pci0000:00/0000:00:07.0/ata3/host2/target2:0:0/2:0:0:0/block/sda +
-N: sda +
-S: disk/by-id/ata-QEMU_HARDDISK_QM00005 +
-S: disk/by-id/scsi-0ATA_QEMU_HARDDISK_QM00005 +
-S: disk/by-id/scsi-1ATA_QEMU_HARDDISK_QM00005 +
-S: disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00005 +
-S: disk/by-path/pci-0000:00:07.0-ata-1 +
-E: DEVLINKS=/dev/disk/by-path/pci-0000:00:07.0-ata-1 /dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00005 /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005 /dev/disk/by-id/scsi-0ATA_QEMU_HARDDISK_QM00005 /dev/disk/by-id/scsi-1ATA_QEMU_HARDDISK_QM00005 +
-E: DEVNAME=/dev/sda +
-E: DEVPATH=/devices/pci0000:00/0000:00:07.0/ata3/host2/target2:0:0/2:0:0:0/block/sda +
-E: DEVTYPE=disk +
-E: ID_ATA=1 +
-E: ID_ATA_FEATURE_SET_SMART=1 +
-E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 +
-E: ID_ATA_SATA=1 +
-E: ID_ATA_WRITE_CACHE=1 +
-E: ID_ATA_WRITE_CACHE_ENABLED=1 +
-E: ID_BUS=ata +
-E: ID_MODEL=QEMU_HARDDISK +
-E: ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 +
-E: ID_PART_TABLE_TYPE=dos +
-E: ID_PART_TABLE_UUID=b39ec5c8 +
-E: ID_PATH=pci-0000:00:07.0-ata-1 +
-E: ID_PATH_TAG=pci-0000_00_07_0-ata-1 +
-E: ID_REVISION=2.5+ +
-E: ID_SCSI=1 +
-E: ID_SCSI_INQUIRY=1 +
-E: ID_SERIAL=QEMU_HARDDISK_QM00005 +
-E: ID_SERIAL_SHORT=QM00005 +
-E: ID_TYPE=disk +
-E: ID_VENDOR=ATA +
-E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 +
-E: MAJOR=8 +
-E: MINOR=0 +
-E: SCSI_IDENT_LUN_ATA=QEMU_HARDDISK_QM00005 +
-E: SCSI_IDENT_LUN_T10=ATA_QEMU_HARDDISK_QM00005 +
-E: SCSI_IDENT_LUN_VENDOR=QM00005 +
-E: SCSI_IDENT_SERIAL=QM00005 +
-E: SCSI_MODEL=QEMU_HARDDISK +
-E: SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20 +
-E: SCSI_REVISION=2.5+ +
-E: SCSI_TPGS=0 +
-E: SCSI_TYPE=disk +
-E: SCSI_VENDOR=ATA +
-E: SCSI_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 +
-E: SUBSYSTEM=block +
-E: TAGS=:systemd: +
-E: USEC_INITIALIZED=8735808+
 </code> </code>
  
-The command line switches of this command are:+To remove all empty and comment lines, use the following command:
  
 <code> <code>
-[root@centos8 ~]# udevadm --help +[root@centos8 ~]# cd /tmp ; grep --v '^(#|$)'  /etc/ssh/sshd_config > sshd_config 
-udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS] +[root@centos8 tmp]# cat sshd_config  
- +HostKey /etc/ssh/ssh_host_rsa_key 
-Send control commands or test the device manager. +HostKey /etc/ssh/ssh_host_ecdsa_key 
- +HostKey /etc/ssh/ssh_host_ed25519_key 
-Commands: +SyslogFacility AUTHPRIV 
-  info          Query sysfs or the udev database +PermitRootLogin yes 
-  trigger       Request events from the kernel +AuthorizedKeysFile      .ssh/authorized_keys 
-  settle        Wait for pending udev events +PasswordAuthentication yes 
-  control       Control the udev daemon +ChallengeResponseAuthentication no 
-  monitor       Listen to kernel and udev events +GSSAPIAuthentication yes 
-  test          Test an event run +GSSAPICleanupCredentials no 
-  test-builtin  Test a built-in command +UsePAM yes 
- +X11Forwarding yes 
-[root@centos8 ~]# udevadm info --help +PrintMotd no 
-udevadm info [OPTIONS] [DEVPATH|FILE] +AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
- +AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
-Query sysfs or the udev database. +AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE 
- +AcceptEnv XMODIFIERS 
-  -h --help                   Print this message +Subsystem       sftp    /usr/libexec/openssh/sftp-server
-  -V --version                Print version of the program +
-  -q --query=TYPE             Query device information: +
-       name                     Name of device node +
-       symlink                  Pointing to node +
-       path                     sysfs device path +
-       property                 The device properties +
-       all                      All values +
-  -p --path=SYSPATH           sysfs device path used for query or attribute walk +
-  -n --name=NAME              Node or symlink name used for query or attribute walk +
-  -r --root                   Prepend dev directory to path names +
-  -a --attribute-walk         Print all key matches walking along the chain +
-                              of parent devices +
-  -d --device-id-of-file=FILE Print major:minor of device containing this file +
-  -x --export                 Export key/value pairs +
-  -P --export-prefix          Export the key name with a prefix +
-  -e --export-db              Export the content of the udev database +
-  -c --cleanup-db             Clean up the udev database+
 </code> </code>
  
-=====The /sys Filesystem===== +This file now has to be hardened by adding/editing the following directives:
- +
-The virtual filesystem **/sys** was introduced with the 2.6 Kernel. Its role is to identify and describe peripherals for udev: +
- +
-<code> +
-[root@centos8 ~]# ls -l /sys +
-total 0 +
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 block +
-drwxr-xr-x.  33 root root 0 Jul 12 08:15 bus +
-drwxr-xr-x.  57 root root 0 Jul 12 08:15 class +
-drwxr-xr-x.   4 root root 0 Jul 12 08:15 dev +
-drwxr-xr-x.  14 root root 0 Jul 12 08:15 devices +
-drwxr-xr-x.   6 root root 0 Jul 12 08:15 firmware +
-drwxr-xr-x.   9 root root 0 Jul 12 08:15 fs +
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 hypervisor +
-drwxr-xr-x.  15 root root 0 Jul 12 08:15 kernel +
-drwxr-xr-x. 153 root root 0 Jul 12 08:15 module +
-drwxr-xr-x.   2 root root 0 Jul 12 08:15 power +
-</code> +
- +
-Each directory contains specific information: +
- +
-  * **block** +
-    * information concerning block devices +
-  * **bus** +
-    * information concerning buses +
-  * **class** +
-    * information concerning classes +
-  * **devices** +
-    * information concerning the posiion of devices on their bus +
-  * **firmware** +
-    * information concerning APCI +
-  * **module** +
-    * information concerning kernel modules +
-  * **power** +
-    * information concerning power management +
-  * **fs** +
-    * information concerning file systems +
- +
-For example: +
- +
-<code> +
-[root@centos ~]# cat /sys/block/sda/sda1/size +
-2097152 +
-</code> +
- +
-The figure returned is in sectors. +
- +
-=====LAB #4 - Limiting Ressources===== +
- +
-====4.1 - ulimit==== +
- +
-Resources available to users can be limited by using the **ulimit** command.  +
- +
-The **ulimit** command manages two limits: +
- +
-  * a //hard// hard limit by specifying the **-H** switch, +
-  * a //soft// soft limit by specifying the **-S** switch. +
- +
-The soft limit is the limit imposed on the user whilst the hard limit is the limit that a user can obtain once he has gone over the soft limit. +
- +
-Only root can position a hard limit and only if the limit does not exceed real resource levels. +
- +
-Root can define limits by editing the **/etc/security/limits.conf** file: +
- +
-<code> +
-[root@centos8 ~]# cat /etc/security/limits.conf +
-# /etc/security/limits.conf +
-+
-#This file sets the resource limits for the users logged in via PAM. +
-#It does not affect resource limits of the system services. +
-+
-#Also note that configuration files in /etc/security/limits.d directory, +
-#which are read in alphabetical order, override the settings in this +
-#file in case the domain is the same or more specific. +
-#That means for example that setting a limit for wildcard domain here +
-#can be overriden with a wildcard setting in a config file in the +
-#subdirectory, but a user specific setting here can be overriden only +
-#with a user specific setting in the subdirectory. +
-+
-#Each line describes a limit for a user in the form: +
-+
-#<domain>        <type>  <item>  <value> +
-+
-#Where: +
-#<domain> can be: +
-#        - a user name +
-#        - a group name, with @group syntax +
-#        - the wildcard *, for default entry +
-#        - the wildcard %, can be also used with %group syntax, +
-#                 for maxlogin limit +
-+
-#<type> can have the two values: +
-#        - "soft" for enforcing the soft limits +
-#        - "hard" for enforcing hard limits +
-+
-#<item> can be one of the following+
-#        - core - limits the core file size (KB) +
-#        - data - max data size (KB) +
-#        - fsize - maximum filesize (KB) +
-#        - memlock - max locked-in-memory address space (KB) +
-#        - nofile - max number of open file descriptors +
-#        - rss - max resident set size (KB) +
-#        - stack - max stack size (KB) +
-#        - cpu - max CPU time (MIN) +
-#        - nproc - max number of processes +
-#        - as - address space limit (KB) +
-#        - maxlogins - max number of logins for this user +
-#        - maxsyslogins - max number of logins on the system +
-#        - priority - the priority to run user process with +
-#        - locks - max number of file locks the user can hold +
-#        - sigpending - max number of pending signals +
-#        - msgqueue - max memory used by POSIX message queues (bytes) +
-#        - nice - max nice priority allowed to raise to values: [-20, 19] +
-#        - rtprio - max realtime priority +
-+
-#<domain>      <type>  <item>         <value> +
-+
- +
-#*               soft    core            0 +
-#*               hard    rss             10000 +
-#@student        hard    nproc           20 +
-#@faculty        soft    nproc           20 +
-#@faculty        hard    nproc           50 +
-#ftp             hard    nproc           0 +
-#@student        -       maxlogins       4 +
- +
-# End of file +
-</code>  +
- +
-<WRAP center round important 60%> +
-**Important** : The limit can be a number or the word **unlimited**. +
-</WRAP> +
- +
-For example if root adds the two following lines to /etc/security/limits.conf:+
  
 <file> <file>
-... +AllowGroups adm 
-trainee                soft        nofile          1024 +Banner /etc/issue.net 
-trainee                hard        nofile          4096 +HostbasedAuthentication no 
-...+IgnoreRhosts yes 
 +LoginGraceTime 60 
 +LogLevel INFO 
 +PermitEmptyPasswords no 
 +PermitRootLogin no 
 +PrintLastLog yes 
 +Protocol 2 
 +StrictModes yes 
 +X11Forwarding no
 </file> </file>
  
-the number of open files for trainee is limited to 1024. However trainee can increase this limit to 4 096 by using the following command:+The file should look like this:
  
 <code> <code>
-$ ulimit -n 4096+[root@centos8 tmp]# vi sshd_config  
 +[root@centos8 tmp]# cat sshd_config  
 +AllowGroups adm 
 +Banner /etc/issue.net 
 +HostbasedAuthentication no 
 +IgnoreRhosts yes 
 +LoginGraceTime 60 
 +LogLevel INFO 
 +PermitEmptyPasswords no 
 +PermitRootLogin no 
 +PrintLastLog yes 
 +Protocol 2 
 +StrictModes yes 
 +X11Forwarding no 
 +HostKey /etc/ssh/ssh_host_rsa_key 
 +HostKey /etc/ssh/ssh_host_ecdsa_key 
 +HostKey /etc/ssh/ssh_host_ed25519_key 
 +SyslogFacility AUTHPRIV 
 +PermitRootLogin yes 
 +AuthorizedKeysFile      .ssh/authorized_keys 
 +PasswordAuthentication yes 
 +ChallengeResponseAuthentication no 
 +GSSAPIAuthentication yes 
 +GSSAPICleanupCredentials no 
 +UsePAM yes 
 +PrintMotd no 
 +AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
 +AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
 +AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE 
 +AcceptEnv XMODIFIERS 
 +Subsystem       sftp    /usr/libexec/openssh/sftp-server
 </code> </code>
  
-To see the list of the current limits use the **-a** switch:+Rename the current **/etc/ssh/sshd_config** file as **/etc/ssh/sshd_config.old** :
  
 <code> <code>
-[root@centos8 ~]# ulimit -a +[root@centos8 tmp]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.old
-core file size          (blocks, -c) unlimited +
-data seg size           (kbytes, -d) unlimited +
-scheduling priority             (-e) 0 +
-file size               (blocks, -f) unlimited +
-pending signals                 (-i) 14702 +
-max locked memory       (kbytes, -l) 64 +
-max memory size         (kbytes, -m) unlimited +
-open files                      (-n) 1024 +
-pipe size            (512 bytes, -p) 8 +
-POSIX message queues     (bytes, -q) 819200 +
-real-time priority              (-r) 0 +
-stack size              (kbytes, -s) 8192 +
-cpu time               (seconds, -t) unlimited +
-max user processes              (-u) 14702 +
-virtual memory          (kbytes, -v) unlimited +
-file locks                      (-x) unlimited+
 </code> </code>
  
-The command line switches of this command are:+Copy the **/tmp/sshd_config** file to **/etc/ssh/** :
  
 <code> <code>
-[root@centos8 ~]# help ulimit +[root@centos8 tmp]# cp /tmp/sshd_config /etc/ssh 
-ulimitulimit [-SHabcdefiklmnpqrstuvxPT] [limit] +cpoverwrite '/etc/ssh/sshd_config'? y
-    Modify shell resource limits. +
-     +
-    Provides control over the resources available to the shell and processes +
-    it creates, on systems that allow such control. +
-     +
-    Options: +
-      -S        use the `softresource limit +
-      -H        use the `hardresource limit +
-      -a        all current limits are reported +
-      -b        the socket buffer size +
-      -c        the maximum size of core files created +
-      -d        the maximum size of a process's data segment +
-      -e        the maximum scheduling priority (`nice'+
-      -f        the maximum size of files written by the shell and its children +
-      -i        the maximum number of pending signals +
-      -k        the maximum number of kqueues allocated for this process +
-      -l        the maximum size a process may lock into memory +
-      -m        the maximum resident set size +
-      -n        the maximum number of open file descriptors +
-      -p        the pipe buffer size +
-      -q        the maximum number of bytes in POSIX message queues +
-      -r        the maximum real-time scheduling priority +
-      -s        the maximum stack size +
-      -t        the maximum amount of cpu time in seconds +
-      -u        the maximum number of user processes +
-      -v        the size of virtual memory +
-      -x        the maximum number of file locks +
-      -P        the maximum number of pseudoterminals +
-      -T        the maximum number of threads +
-     +
-    Not all options are available on all platforms. +
-     +
-    If LIMIT is given, it is the new value of the specified resource; the +
-    special LIMIT values `soft', `hard', and `unlimited' stand for the +
-    current soft limit, the current hard limit, and no limit, respectively. +
-    Otherwise, the current value of the specified resource is printed.  If +
-    no option is given, then -f is assumed. +
-     +
-    Values are in 1024-byte increments, except for -t, which is in seconds, +
-    -p, which is in increments of 512 bytes, and -u, which is an unscaled +
-    number of processes. +
-     +
-    Exit Status: +
-    Returns success unless an invalid option is supplied or an error occurs.+
 </code> </code>
  
-====4.2 - CGroups==== +Restart the sshd service:
- +
-Control Groups, also called **CGroups** are another, more modern way, of limiting resources. +
- +
-CGroups are organised hierarchially just like processes. However as opposed to processes, CGroups are organised into **multiples** hierarchies called **Resource Controllers** or simply **Controllers**. +
- +
-To consult the cgroup hierarchies, use the **lssubsys** command:+
  
 <code> <code>
-[root@centos8 ~]# lssubsys -am +[root@centos8 tmp]# systemctl restart sshd 
-bashlssubsyscommand not found... +[root@centos8 tmp]# systemctl status sshd 
-Install package 'libcgroup-tools' to provide command 'lssubsys'? [N/y] y+● sshd.service OpenSSH server daemon 
 +   Loadedloaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) 
 +   Active: active (running) since Mon 2021-08-30 02:17:00 EDT; 11s ago 
 +     Docs: man:sshd(8) 
 +           man:sshd_config(5) 
 + Main PID: 1042039 (sshd) 
 +    Tasks: 1 (limit: 23535) 
 +   Memory1.1M 
 +   CGroup: /system.slice/sshd.service 
 +           └─1042039 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,a>
  
- +Aug 30 02:17:00 centos8.ittraining.loc systemd[1]Starting OpenSSH server daemon... 
- * Waiting in queue...  +Aug 30 02:17:00 centos8.ittraining.loc sshd[1042039]: Server listening on 0.0.0.0 port 22
-The following packages have to be installed: +Aug 30 02:17:00 centos8.ittraining.loc sshd[1042039]: Server listening on :: port 22
- libcgroup-0.41-19.el8.x86_64   Library to control and monitor control groups +Aug 30 02:17:00 centos8.ittraining.loc systemd[1]: Started OpenSSH server daemon
- libcgroup-tools-0.41-19.el8.x86_64     Command-line utility programs, services and daemons for libcgroup +[q]
-Proceed with changes? [N/y+
- +
- +
- * Waiting in queue...  +
- * Waiting for authentication...  +
- * Waiting in queue...  +
- * Downloading packages...  +
- * Requesting data...  +
- * Testing changes...  +
- * Installing packages...  +
-cpuset /sys/fs/cgroup/cpuset +
-cpu,cpuacct /sys/fs/cgroup/cpu,cpuacct +
-blkio /sys/fs/cgroup/blkio +
-memory /sys/fs/cgroup/memory +
-devices /sys/fs/cgroup/devices +
-freezer /sys/fs/cgroup/freezer +
-net_cls,net_prio /sys/fs/cgroup/net_cls,net_prio +
-perf_event /sys/fs/cgroup/perf_event +
-hugetlb /sys/fs/cgroup/hugetlb +
-pids /sys/fs/cgroup/pids +
-rdma /sys/fs/cgroup/rdma+
 </code> </code>
  
-<code> +Put **trainee** in the **adm** group:
-[root@centos8 ~]# lssubsys -am +
-cpuset /sys/fs/cgroup/cpuset +
-cpu,cpuacct /sys/fs/cgroup/cpu,cpuacct +
-blkio /sys/fs/cgroup/blkio +
-memory /sys/fs/cgroup/memory +
-devices /sys/fs/cgroup/devices +
-freezer /sys/fs/cgroup/freezer +
-net_cls,net_prio /sys/fs/cgroup/net_cls,net_prio +
-perf_event /sys/fs/cgroup/perf_event +
-hugetlb /sys/fs/cgroup/hugetlb +
-pids /sys/fs/cgroup/pids +
-rdma /sys/fs/cgroup/rdma +
-</code>  +
- +
-**Systemd** organises the processes in each cgroup. As a result, the CGroup resource management is closely aligned to Systemd's units. +
- +
-At the top of the hierarchy we can see the root slice -**-.slice**, under which we can find: +
- +
-  * **system.slice** - system services, +
-  * **user.slice** - user sessions, +
-  * **machine.slice** - virtiual machines and containers. +
- +
-Under these slices can be found: +
- +
-  * **scopes** -processes created by a **Fork**, +
-  * **services** - processes created by a **Unit**. +
- +
-Slices can be consulted with the following command:+
  
 <code> <code>
-[root@centos8 ~]# systemctl list-units --type=slice +[root@centos8 tmp]# groups trainee 
-UNIT                                        LOAD   ACTIVE SUB    DESCRIPTION                                 +trainee : trainee 
--.slice                                     loaded active active Root Slice                                  +[root@centos8 tmp]# usermod -aG adm trainee 
-machine.slice                               loaded active active Virtual Machine and Container Slice         +[root@centos8 tmp]# groups trainee 
-system-getty.slice                          loaded active active system-getty.slice                          +trainee : trainee adm
-system-lvm2\x2dpvscan.slice                 loaded active active system-lvm2\x2dpvscan.slice                 +
-system-sshd\x2dkeygen.slice                 loaded active active system-sshd\x2dkeygen.slice                 +
-system-systemd\x2dfsck.slice                loaded active active system-systemd\x2dfsck.slice                +
-system-systemd\x2dhibernate\x2dresume.slice loaded active active system-systemd\x2dhibernate\x2dresume.slice +
-system-user\x2druntime\x2ddir.slice         loaded active active system-user\x2druntime\x2ddir.slice         +
-system-vncserver.slice                      loaded active active system-vncserver.slice                      +
-system.slice                                loaded active active System Slice                                +
-user-1000.slice                             loaded active active User Slice of UID 1000                      +
-user-42.slice                               loaded active active User Slice of UID 42                        +
-user.slice                                  loaded active active User and Session Slice                      +
- +
-LOAD   = Reflects whether the unit definition was properly loaded. +
-ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +
-SUB    = The low-level unit activation state, values depend on unit type. +
- +
-13 loaded units listed. Pass --all to see loaded but inactive units, too. +
-To show all installed unit files use 'systemctl list-unit-files'.+
 </code> </code>
  
-CGroup hierarchies can be seen by using the **systemd-cgls** command:+To generate the server keys, execute the following commands as **root**. Note that the passphrase must be **empty**:
  
 <code> <code>
-[root@centos8 ~]# systemd-cgls +[root@centos8 tmp]# ssh-keygen -t dsa 
-Control group /: +Generating public/private dsa key pair
--.slice +Enter file in which to save the key (/root/.ssh/id_dsa): /etc/ssh/ssh_host_dsa_key 
-├─user.slice +Enter passphrase (empty for no passphrase) 
-│ ├─user-42.slice +Enter same passphrase again:  
-│ │ ├─session-c1.scope +Your identification has been saved in /etc/ssh/ssh_host_dsa_key
-│ │ │ ├─1317 gdm-session-worker [pam/gdm-launch-environment] +Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub
-│ │ │ ├─1459 /usr/libexec/gdm-wayland-session --register-session gnome-session --autostart /usr/share/gdm/greeter/autostart +The key fingerprint is
-│ │ │ ├─1856 /usr/libexec/gnome-session-binary --autostart /usr/share/gdm/greeter/autostart +SHA256:dywC6jKyIMaTxsaEamz1kmthEmuG18HxmS22qRICOYk root@centos8.ittraining.loc 
-│ │ │ ├─1882 /usr/bin/gnome-shell +The key's randomart image is: 
-│ │ │ ├─2059 /usr/bin/Xwayland :1024 -rootless -terminate -accessx -core -listen 4 -listen 5 -displayfd 6 ++---[DSA 1024]----+ 
-│ │ │ ├─2132 ibus-daemon --xim --panel disable +|                 | 
-│ │ │ ├─2135 /usr/libexec/ibus-dconf +|               | 
-│ │ │ ├─2138 /usr/libexec/ibus-x11 --kill-daemon +|.o.+         | 
-│ │ │ ├─2251 /usr/libexec/gsd-xsettings +|E o.*..      | 
-│ │ │ ├─2261 /usr/libexec/gsd-a11y-settings +|+ooo.o +S o o    | 
-│ │ │ ├─2268 /usr/libexec/gsd-clipboard +|X==++ o  o o     | 
-│ │ │ ├─2271 /usr/libexec/gsd-color +|B/=+oo           | 
-│ │ │ ├─2272 /usr/libexec/gsd-datetime +|Ooo++            | 
-│ │ │ ├─2273 /usr/libexec/gsd-housekeeping +|.o             | 
-│ │ │ ├─2274 /usr/libexec/gsd-keyboard ++----[SHA256]-----+ 
-│ │ │ ├─2275 /usr/libexec/gsd-media-keys +</code> 
-│ │ │ ├─2280 /usr/libexec/gsd-mouse +
-│ │ │ ├─2281 /usr/libexec/gsd-power +
-│ │ │ ├─2283 /usr/libexec/gsd-print-notifications +
-│ │ │ ├─2284 /usr/libexec/gsd-rfkill +
-│ │ │ ├─2285 /usr/libexec/gsd-screensaver-proxy +
-│ │ │ ├─2290 /usr/libexec/gsd-sharing +
-│ │ │ ├─2321 /usr/libexec/gsd-smartcard +
-│ │ │ ├─2328 /usr/libexec/gsd-sound +
-│ │ │ ├─2333 /usr/libexec/gsd-wacom +
-│ │ │ └─2432 /usr/libexec/ibus-engine-simple +
-│ │ └─user@42.service +
-│ │   ├─xdg-permission-store.service +
-│ │   │ └─2170 /usr/libexec/xdg-permission-store +
-│ │   ├─pulseaudio.service +
-│ │   │ └─1455 /usr/bin/pulseaudio --daemonize=no --log-target=journal +
-│ │   ├─init.scope +
-│ │   │ ├─1357 /usr/lib/systemd/systemd --user +
-│ │   │ └─1377 (sd-pam+
-│ │   ├─at-spi-dbus-bus.service +
-│ │   │ ├─2090 /usr/libexec/at-spi-bus-launcher +
-│ │   │ ├─2095 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3 +
-│ │   │ └─2098 /usr/libexec/at-spi2-registryd --use-gnome-session +
-│ │   └─dbus.service +
-│ │     ├─1755 /usr/bin/dbus-daemon --session --address=systemd--nofork --nopidfile --systemd-activation --syslog-only +
-│ │     └─2143 /usr/libexec/ibus-portal +
-│ └─user-1000.slice +
-│   ├─user@1000.service +
-│   │ ├─gvfs-goa-volume-monitor.service +
-│   │ │ └─2369 /usr/libexec/gvfs-goa-volume-monitor +
-│   │ ├─xdg-permission-store.service +
-│   │ │ └─2191 /usr/libexec/xdg-permission-store +
-│   │ ├─tracker-store.service +
-│   │ │ └─2653 /usr/libexec/tracker-store +
-│   │ ├─evolution-calendar-factory.service +
-│   │ │ ├─2605 /usr/libexec/evolution-calendar-factory +
-│   │ │ └─2706 /usr/libexec/evolution-calendar-factory-subprocess --factory all --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.Calendarx2605x2 --own-path /org/gnome/evolution> +
-│   │ ├─pulseaudio.service +
-│   │ │ └─1456 /usr/bin/pulseaudio --daemonize=no --log-target=journal +
-│   │ ├─gvfs-daemon.service +
-│   │ │ ├─1896 /usr/libexec/gvfsd +
-│   │ │ └─1901 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -big_writes +
-│   │ ├─evolution-source-registry.service +
-│   │ │ └─2206 /usr/libexec/evolution-source-registry +
-│   │ ├─gvfs-udisks2-volume-monitor.service +
-│   │ │ └─2243 /usr/libexec/gvfs-udisks2-volume-monitor +
-│   │ ├─init.scope +
-│   │ │ ├─1239 /usr/lib/systemd/systemd --user +
-│   │ │ └─1318 (sd-pam) +
-│   │ ├─gvfs-gphoto2-volume-monitor.service +
-│   │ │ └─2269 /usr/libexec/gvfs-gphoto2-volume-monitor +
-│   │ ├─at-spi-dbus-bus.service +
-│   │ │ ├─1964 /usr/libexec/at-spi-bus-launcher +
-│   │ │ ├─1969 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3 +
-│   │ │ └─1972 /usr/libexec/at-spi2-registryd --use-gnome-session +
-│   │ ├─dbus.service +
-│   │ │ ├─1786 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only +
-│   │ │ ├─2183 /usr/libexec/ibus-portal +
-│   │ │ ├─2201 /usr/libexec/gnome-shell-calendar-server +
-│   │ │ ├─2225 /usr/libexec/goa-daemon +
-│   │ │ ├─2397 /usr/libexec/goa-identity-service +
-│   │ │ └─2721 /usr/libexec/dconf-service +
-│   │ ├─evolution-addressbook-factory.service +
-│   │ │ ├─2727 /usr/libexec/evolution-addressbook-factory +
-│   │ │ └─2771 /usr/libexec/evolution-addressbook-factory-subprocess --factory all --bus-name org.gnome.evolution.dataserver.Subprocess.Backend.AddressBookx2727x2 --own-path /org/gnome/evo> +
-│   │ ├─gvfs-mtp-volume-monitor.service +
-lines 44-86 +
-</code> +
- +
-Using Systemd, several resources can be limited: +
- +
-  * **CPUShares** - default value = 1024, +
-  * **MemoryLimit** - expressed in MB or GB, there is no default value, +
-  * **BlockIOWeight** - expressed as a value between 10 and 1000, there is no default value, +
-  * **StartupCPUShares** - the same as CPUShares but only used during startup, +
-  * **StartupBlockIOWeight** - the same as BlockIOWeight but only used during startup, +
-  * **CPUQuota** - used to limit CPU usage even when the system is doing nothing. +
- +
-<WRAP center round important 60%> +
-**Important** : You can check the systemd.resource-control(5) manual to see which CGroup parameters can be passed to systemctl. +
-</WRAP> +
- +
-===Limiting Memory Usage=== +
- +
-Start by creating the **hello-world.sh** script that will be used to work with CGroups :+
  
 <code> <code>
-[root@centos8 ~]# vi hello-world.sh +[root@centos8 tmp]# ssh-keygen -t rsa 
-[root@centos8 ~]# cat hello-world.sh +Generating public/private rsa key pair. 
-#!/bin/bash +Enter file in which to save the key (/root/.ssh/id_rsa): /etc/ssh/ssh_host_rsa_key 
-while ]; do +Enter passphrase (empty for no passphrase):  
-        echo "hello world" +Enter same passphrase again:  
-        sleep 360 +Your identification has been saved in /etc/ssh/ssh_host_rsa_key. 
-done+Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub. 
 +The key fingerprint is: 
 +SHA256:8jXFK50NnoJCz9E7aPKpFYSYCstCPfRsdmlLBTNUnKg root@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++---[RSA 3072]----+ 
 +|    .==o.      | 
 +|  o oo o=+ .     | 
 +|.. oo=+=o . +    | 
 +|oo .+E++.+ = *   | 
 +|o..   +.S B * .  | 
 +|.      B + =     | 
 +|        =        | 
 +|               | 
 +|      .          | 
 ++----[SHA256]-----+ 
 +[root@centos8 tmp]# ssh-keygen -t ecdsa 
 +Generating public/private ecdsa key pair
 +Enter file in which to save the key (/root/.ssh/id_ecdsa): /etc/ssh/ssh_host_ecdsa_key 
 +Enter passphrase (empty for no passphrase):  
 +Enter same passphrase again:  
 +Your identification has been saved in /etc/ssh/ssh_host_ecdsa_key. 
 +Your public key has been saved in /etc/ssh/ssh_host_ecdsa_key.pub. 
 +The key fingerprint is: 
 +SHA256:AMqFUJKGqnUEPh/IYda0wnbW1kXK+lnprpHsOo4UMbI root@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++---[ECDSA 256]---+ 
 +|++*=+    .o      | 
 +|oX.=o+ o o       | 
 +|o %.B + +        | 
 +|...O.= o       | 
 +|..E.o . S o      | 
 +|.    . o =       | 
 +|    .   * .      | 
 +|   . ... o       | 
 +|    ..ooo..      | 
 ++----[SHA256]-----+ 
 +[root@centos8 tmp]# ssh-keygen -t ed25519 
 +Generating public/private ed25519 key pair. 
 +Enter file in which to save the key (/root/.ssh/id_ed25519): /etc/ssh/ssh_host_ed25519_key 
 +Enter passphrase (empty for no passphrase):  
 +Enter same passphrase again:  
 +Your identification has been saved in /etc/ssh/ssh_host_ed25519_key. 
 +Your public key has been saved in /etc/ssh/ssh_host_ed25519_key.pub. 
 +The key fingerprint is: 
 +SHA256:CtbcN9iXv00PfbHFGf2bEW7iRibOFwRctyqM5hmlhwE root@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++--[ED25519 256]--+ 
 +|        .... . | 
 +       .  .. . o| 
 +|         . . . +.| 
 +|     o . oB ..o.=| 
 +|    o o S*+=o* *+| 
 +|   . . .o.*o*.+.B| 
 +|      .  o o +o++| 
 +|            o  =o| 
 +|              . o| 
 ++----[SHA256]-----+
 </code> </code>
  
-Make the script runnable and test it:+Public keys have a **.pub** extension:
  
 <code> <code>
-[root@centos8 ~]# chmod u+x hello-world.sh +[root@centos8 tmp]# ls /etc/ssh 
-[root@centos8 ~]# ./hello-world.sh +moduli      ssh_config.d  sshd_config.old     ssh_host_ecdsa_key.pub  ssh_host_ed25519_key.pub  ssh_host_rsa_key.pub 
-hello world +ssh_config  sshd_config   ssh_host_ecdsa_key  ssh_host_ed25519_key    ssh_host_rsa_key
-^C+
 </code> </code>
  
-Now create a CGroup in the **memory** sub-system called **helloworld** :+Restart the sshd service:
  
 <code> <code>
-[root@centos8 ~]# mkdir /sys/fs/cgroup/memory/helloworld +[root@centos8 tmp]# systemctl restart sshd.service 
-</code>+[root@centos8 tmp]# systemctl status sshd.service 
 +● sshd.service - OpenSSH server daemon 
 +   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) 
 +   Active: active (running) since Mon 2021-08-30 02:24:57 EDT; 9s ago 
 +     Docs: man:sshd(8) 
 +           man:sshd_config(5) 
 + Main PID: 1042204 (sshd) 
 +    Tasks: 1 (limit: 23535) 
 +   Memory: 1.1M 
 +   CGroup: /system.slice/sshd.service 
 +           └─1042204 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cbc,aes128-gcm@openssh.com,a>
  
-By default, this CGroup inherits the use of the **all** of the available memoryTo avoid that, create a **40,000,000** Byte limit for this CGroup+Aug 30 02:24:57 centos8.ittraining.loc systemd[1]Starting OpenSSH server daemon... 
- +Aug 30 02:24:57 centos8.ittraining.loc sshd[1042204]: Server listening on 0.0.0.0 port 22
-<code> +Aug 30 02:24:57 centos8.ittraining.loc sshd[1042204]: Server listening on :: port 22. 
-[root@centos8 ~]# echo 40000000 > /sys/fs/cgroup/memory/helloworld/memory.limit_in_bytes +Aug 30 02:24:57 centos8.ittraining.loc systemd[1]: Started OpenSSH server daemon
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld/memory.limit_in_bytes +[q]
-39997440+
 </code> </code>
  
-<WRAP center round important 60%> +====3.3 Configuring the Client====
-**Important** Note that the 40,000,000 requested have become 39,997,440 which corresponds to a round number of Kernel Memory Pages, each of 4KB size ( 39,997,440 / 4,096 9,765 ). +
-</WRAP>+
  
-Now run the **helloworld.sh** script+To generate the client keys, execute the following commands as **trainee**. Note that the passphrase must be **empty**:
  
 <code> <code>
-[root@centos8 ~]# ./hello-world.sh +[root@centos8 tmp]# exit 
-[135148+logout 
 +[trainee@centos8 ~]$ ssh-keygen -t dsa 
 +Generating public/private dsa key pair. 
 +Enter file in which to save the key (/home/trainee/.ssh/id_dsa):  
 +Created directory '/home/trainee/.ssh'
 +Enter passphrase (empty for no passphrase):  
 +Enter same passphrase again:  
 +Your identification has been saved in /home/trainee/.ssh/id_dsa. 
 +Your public key has been saved in /home/trainee/.ssh/id_dsa.pub. 
 +The key fingerprint is: 
 +SHA256:Qd17X1iROjk5rLOQBbyVg1hNXkUdTeiFtEpn3rgPKc4 trainee@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++---[DSA 1024]----+ 
 +|        =o+o.o+OB| 
 +|       o +o=o oo=| 
 +|        . +.+oB+ | 
 +|         o o.&+o.| 
 +|        S o o.*.o| 
 +|         o o   o.| 
 +|          . + +  | 
 +|           + . o | 
 +|            E   .| 
 ++----[SHA256]-----+ 
 +[trainee@centos8 ~]$ ssh-keygen -t rsa 
 +Generating public/private rsa key pair.
  
-[root@centos8 ~]# hello world +Enter file in which to save the key (/home/trainee/.ssh/id_rsa): Enter passphrase (empty for no passphrase):  
-[Enter] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PUSH Enter Key +Enter same passphrase again:  
- +Your identification has been saved in /home/trainee/.ssh/id_rsa. 
-[root@centos8 ~]# ps aux | grep hello-world +Your public key has been saved in /home/trainee/.ssh/id_rsa.pub. 
-root       35148  0.0  0.0  12724  2980 pts/1    S    08:48   0:00 /bin/bash ./hello-world.sh +The key fingerprint is: 
-root       35151  0.0  0.0  12136  1044 pts/1    S+   08:48   0:00 grep --color=auto hello-world+SHA256:BgEjoWQrGCzdJfyZczVZYVoafiHsz9GK5PDWuywG/z0 trainee@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++---[RSA 3072]----+ 
 +|o+o++oo  .oo*.   | 
 +|=+o.oo . .=B .   | 
 +|=.   ..o o+...   | 
 +|.     =.o o.. .  | 
 +|       oS= = o   | 
 +|       .. = =    | 
 +|             | 
 +|          +...E  | 
 +|         . o+... | 
 ++----[SHA256]-----+ 
 +[trainee@centos8 ~]$ ssh-keygen -t ecdsa 
 +Generating public/private ecdsa key pair. 
 +Enter file in which to save the key (/home/trainee/.ssh/id_ecdsa):  
 +Enter passphrase (empty for no passphrase):  
 +Enter same passphrase again:  
 +Your identification has been saved in /home/trainee/.ssh/id_ecdsa. 
 +Your public key has been saved in /home/trainee/.ssh/id_ecdsa.pub. 
 +The key fingerprint is: 
 +SHA256:mpBDgsCxP2DqRPkmGvXHpNnvm5B+Cl7MSiiZKfDjWLk trainee@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++---[ECDSA 256]---+ 
 +|o..              | 
 +|.oo              | 
 +|.*o . .          | 
 +|+.++ B           | 
 +|+o =B + S        | 
 +|=*oo.* =         | 
 +|B.* o O .        | 
 +|.= = = o..       | 
 +|. E o oo+.       | 
 ++----[SHA256]-----+ 
 +[trainee@centos8 ~]$ ssh-keygen -t ed25519 
 +Generating public/private ed25519 key pair. 
 +Enter file in which to save the key (/home/trainee/.ssh/id_ed25519) 
 +Enter passphrase (empty for no passphrase) 
 +Enter same passphrase again:  
 +Your identification has been saved in /home/trainee/.ssh/id_ed25519
 +Your public key has been saved in /home/trainee/.ssh/id_ed25519.pub. 
 +The key fingerprint is: 
 +SHA256:JfFxG2mg9feAvFGxoxZ8uSsON3sXvtYQYYg5iVxzZS4 trainee@centos8.ittraining.loc 
 +The key's randomart image is: 
 ++--[ED25519 256]--+ 
 +      ..o*=++=. | 
 +|        o==O+Boo | 
 +|        o ooE.O. | 
 +|           O.= | 
 +|        S   + ...| 
 +|            .o | 
 +|          . + o.o| 
 +|           + +.oo| 
 +|            o..o.| 
 ++----[SHA256]-----+
 </code> </code>
  
-Note that there is **no** memory limit:+The keys can be found in the **~/.ssh/** directory:
  
 <code> <code>
-[root@centos8 ~]# ps -ww -o cgroup 35148 +[trainee@centos8 ~]$ ls .ssh 
-CGROUP +id_dsa  id_dsa.pub  id_ecdsa  id_ecdsa.pub  id_ed25519  id_ed25519.pub  id_rsa  id_rsa.pub
-12:memory:/user.slice/user-1000.slice/session-7.scope,7:devices:/user.slice,4:pids:/user.slice/user-1000.slice/session-7.scope,2:blkio:/user.slice,1:name=systemd:/user.slice/user-1000.slice/session-7.scope+
 </code> </code>
  
-NOw insert the PID of the script into the **helloworld** CGroup:+====3.4 - Authentication using Asymetric Keys====
  
-<code> +Connect to your own virtual machine as if it were the server:
-[root@centos8 ~]# echo 35148 > /sys/fs/cgroup/memory/helloworld/cgroup.procs +
-</code> +
- +
-NOw you can see a memory limit - **12:memory:/helloworld**:+
  
 <code> <code>
-[root@centos8 ~]# ps -ww -o cgroup 35148 +[root@centos8 ~]# ssh -l trainee 127.0.0.1 
-CGROUP +\S 
-12:memory:/helloworld,7:devices:/user.slice,4:pids:/user.slice/user-1000.slice/session-7.scope,2:blkio:/user.slice,1:name=systemd:/user.slice/user-1000.slice/session-7.scope +Kernel \r on an \m 
-</code>+trainee@127.0.0.1's passwordtrainee 
 +Activate the web console withsystemctl enable --now cockpit.socket
  
-Now check the actual memory consumption: +[trainee@centos8 ~]$ ls -la | grep .ssh 
- +drwx------.  2 trainee trainee      4096 Aug 30 02:26 .ssh
-<code> +
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld/memory.usage_in_bytes +
-274432+
 </code> </code>
  
-Kill the **hello-world.sh** script+Now transfer the client'**.ssh/id_ecdsa.pub** key to the server and rename it **authorized_keys** :
  
 <code> <code>
-[root@centos8 ~]# kill 35148 +[trainee@centos8 ~]$ exit 
-[root@centos8 ~]# ps aux | grep hello-world +logout 
-root       35307  0.0  0.0  12136  1112 pts/   S+   08:55   0:00 grep --color=auto hello-world +Connection to 127.0.0.1 closed.
-[1]+  Terminated              ./hello-world.sh +
-</code>+
  
-Create a more restrictive CGroup called **helloworld1** :+[root@centos8 ~]# exit 
 +logout
  
-<code> +[trainee@centos8 ~]$ scp .ssh/id_ecdsa.pub trainee@127.0.0.1:/home/trainee/.ssh/authorized_keys 
-[root@centos8 ~]# mkdir /sys/fs/cgroup/memory/helloworld1 +The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established. 
-[root@centos8 ~]# echo 6000 > /sys/fs/cgroup/memory/helloworld1/memory.limit_in_bytes +ECDSA key fingerprint is SHA256:Q7T/CP0SLiMbMAIgVzTuEHegYS/spPE5zzQchCHD5Vw. 
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld1/memory.limit_in_bytes +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
-4096+Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts
 +\S 
 +Kernel \r on an \m 
 +trainee@127.0.0.1's password: trainee 
 +id_ecdsa.pub                                                                                                       100%  192   497.6KB/  00:00
 </code> </code>
  
-Re-run the script and put the PID in the new CGroup:+Re-connect to your own virtual machine as if it were the server:
  
 <code> <code>
-[root@centos8 ~]./hello-world.sh & +[trainee@centos8 ~]$ ssh -l trainee localhost 
-[135389+The authenticity of host 'localhost (::1)' can't be established. 
 +ECDSA key fingerprint is SHA256:Q7T/CP0SLiMbMAIgVzTuEHegYS/spPE5zzQchCHD5Vw
 +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes 
 +Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. 
 +\S 
 +Kernel \r on an \m 
 +Activate the web console with: systemctl enable --now cockpit.socket
  
-[root@centos8 ~]# hello world +Last loginMon Aug 30 03:57:14 2021 from 127.0.0.1 
-[Enter] +[trainee@centos8 ~]$
- +
-[root@centos8 ~]# echo 35389 > /sys/fs/cgroup/memory/helloworld1/cgroup.procs +
-</code> +
- +
-Wait for **hello world** to appear. You will notice that the script has stopped: +
- +
-<code> +
-[root@centos8 ~]# hello world +
-[Enter] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PUSH Enter Key +
-[1]+  Killed                  ./hello-world.sh +
-</code> +
- +
-===The cgcreate Command=== +
- +
-This command creates a CGroup: +
- +
-<code> +
-[root@centos8 ~]# cgcreate -g memory:helloworld2 +
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ +
-total 0 +
--rw-rw-r--1 root root Jul 13 10:39 cgroup.clone_children +
---w--w----. 1 root root Jul 13 10:39 cgroup.event_control +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 cgroup.procs +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.failcnt +
---w--w----. 1 root root 0 Jul 13 10:39 memory.force_empty +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.slabinfo +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.tcp.usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.kmem.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.max_usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.failcnt +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.limit_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.memsw.max_usage_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.memsw.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.move_charge_at_immigrate +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.numa_stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.oom_control +
-----------. 1 root root 0 Jul 13 10:39 memory.pressure_level +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.soft_limit_in_bytes +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.stat +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.swappiness +
--r--r--r--. 1 root root 0 Jul 13 10:39 memory.usage_in_bytes +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 memory.use_hierarchy +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 notify_on_release +
--rw-rw-r--. 1 root root 0 Jul 13 10:39 tasks +
-</code> +
- +
-Set a memory limit for **helloworld2**: +
- +
-<code> +
-[root@centos8 ~]# echo 40000000 > /sys/fs/cgroup/memory/helloworld2/memory.limit_in_bytes +
-</code> +
- +
-==The cgexec Command== +
- +
-This command inserts the limit into the CGroup **and** launches the script: +
- +
-<code> +
-[root@centos8 ~]# cgexec -g memory:helloworld2 ./hello-world.sh & +
-[1] 37670 +
- +
-[root@centos8 ~]# hello world +
-[Enter] +
- +
-[root@centos8 ~]#  +
-</code> +
- +
-==THe cgdelete Command== +
- +
-Once the sxcript has terminated, this command deletes the CGroup: +
- +
-<code> +
-[root@centos8 ~]# ps aux | grep *.sh +
-root       37670  0.0  0.0  12724  3112 pts/1    S    10:41   0:00 /bin/bash ./hello-world.sh +
-root       37685  0.0  0.0  12136  1148 pts/1    S+   10:42   0:00 grep --color=auto hello-world.sh +
- +
-[root@centos8 ~]# kill 37670 +
- +
-root@centos8 ~]# ps aux | grep *.sh +
-root       37726  0.0  0.0  12136  1156 pts/1    R+   10:43   0:00 grep --color=auto hello-world.sh +
-[1]+  Terminated              cgexec -g memory:helloworld2 ./hello-world.sh +
- +
-[root@centos8 ~]# cgdelete memory:helloworld2 +
- +
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ +
-ls: cannot access '/sys/fs/cgroup/memory/helloworld2/': No such file or directory +
-</code> +
- +
-==The /etc/cgconfig.conf File== +
- +
-In order for limites to be persistent, it is necessary to edit the **/etc/cgconfig.conf** file: +
- +
-<code> +
-[root@centos8 ~]# vi /etc/cgconfig.conf +
-[root@centos8 ~]# cat /etc/cgconfig.conf +
-+
-#  Copyright IBM Corporation. 2007 +
-+
-#  Authors:     Balbir Singh <balbir@linux.vnet.ibm.com> +
-#  This program is free software; you can redistribute it and/or modify it +
-#  under the terms of version 2.1 of the GNU Lesser General Public License +
-#  as published by the Free Software Foundation. +
-+
-#  This program is distributed in the hope that it would be useful, but +
-#  WITHOUT ANY WARRANTY; without even the implied warranty of +
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +
-+
-+
-# By default, we expect systemd mounts everything on boot, +
-# so there is not much to do. +
-# See man cgconfig.conf for further details, how to create groups +
-# on system boot using this file. +
-group helloworld2 { +
-        cpu { +
-                cpu.shares = 100; +
-        } +
-        memory { +
-                memory.limit_in_bytes = 40000; +
-        } +
-}+
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** - Here you have created **two** limits : a memory limit of 40,000 Bytes and a **cpu.shares** limoit of **100**. This latter corresponds to about 9,77% of the CPU.+**Important** - Note that no password is required.
 </WRAP> </WRAP>
- 
-Now create the **two** CGroups: 
- 
-<code> 
-[root@centos8 ~]# cgcreate -g memory:helloworld2 
-[root@centos8 ~]# ls -l /sys/fs/cgroup/memory/helloworld2/ 
-total 0 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.clone_children 
---w--w----. 1 root root 0 Jul 13 10:46 cgroup.event_control 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 cgroup.procs 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.failcnt 
---w--w----. 1 root root 0 Jul 13 10:46 memory.force_empty 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.failcnt 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.limit_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.max_usage_in_bytes 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.slabinfo 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.failcnt 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.limit_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.max_usage_in_bytes 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.tcp.usage_in_bytes 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.kmem.usage_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.limit_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.max_usage_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.failcnt 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.limit_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.memsw.max_usage_in_bytes 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.memsw.usage_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.move_charge_at_immigrate 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.numa_stat 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.oom_control 
-----------. 1 root root 0 Jul 13 10:46 memory.pressure_level 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.soft_limit_in_bytes 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.stat 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.swappiness 
--r--r--r--. 1 root root 0 Jul 13 10:46 memory.usage_in_bytes 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 memory.use_hierarchy 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 notify_on_release 
--rw-rw-r--. 1 root root 0 Jul 13 10:46 tasks 
-</code> 
- 
-<code> 
-[root@centos8 ~]# cgcreate -g cpu:helloworld2 
-[root@centos8 ~]# ls -l /sys/fs/cgroup/cpu/helloworld2/ 
-total 0 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.clone_children 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cgroup.procs 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.stat 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpuacct.usage 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_all 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_sys 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_percpu_user 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_sys 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpuacct.usage_user 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_period_us 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.cfs_quota_us 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_period_us 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.rt_runtime_us 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 cpu.shares 
--r--r--r--. 1 root root 0 Jul 13 10:47 cpu.stat 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 notify_on_release 
--rw-rw-r--. 1 root root 0 Jul 13 10:47 tasks 
-</code> 
- 
-==The cgconfigparser Command== 
- 
-Apply the contents of the **/etc/cgconfig.conf** file using the **cgconfigparser** command: 
- 
-<code> 
-[root@centos8 ~]# cgconfigparser -l /etc/cgconfig.conf 
-[root@centos8 ~]# cat /sys/fs/cgroup/memory/helloworld2/memory.limit_in_bytes 
-36864 
-[root@centos8 ~]# cat /sys/fs/cgroup/cpu/helloworld2/cpu.shares 
-100 
-</code> 
  
 ----- -----
-Copyright © 2021 Hugh Norris.+Copyright © 2022 Hugh Norris
Menu