Change time & date & timezone

  • Display the current time and date: timedatectl
  • Check if NTP is enabled: timedatectl | grep "NTP enabled"
  • Disable automatic synchronization (stops chronyd service): timedatectl set-ntp no
  • Set time: timedatectl set-time "16:24:00"
  • Set date: timedatectl set-time "2017-03-03"
  • Set date and time: timedatectl set-time "2017-03-03 16:25:20"
  • List zones: timedatectl list-timezones
  • Set timezone: timedatectl set-timezone Europe/Bucharest
  • View detailed NTP specific information: chronyc tracking
  • View all NTP servers that chronyc is synchronizing with chronyc sources

Notes

  • chrony is the default NTP client/server
  • /etc/chrony.conf is the configuration file

ip

  • Set an IP address: ip addr add 192.168.100.29/24 dev enp0s3
  • Delete the IP address: ip addr del 192.168.100.29/24 dev enp0s3
  • Display the settings for the interface: ip addr show enp0s3
  • Show routing table entries: ip route show
  • Change the default gateway: ip route add default via 192.168.100.1
  • Display ARP entries: ip neighbour
  • Show network statistics: ip -s link
  • Activate/deactivate an particular interface: ip link set enp0s3 up or ip link set enp0s3 down

nmtui

  • Installation: yum install NetworkManager-tui
  • Start the service: systemctl status NetworkManager.service
  • Configure the interfaces: nmtui or nmtui edit enp0s3

firewalld

  • The location of all definitions: ls -l /lib/firewalld/services
  • Check the service: systemctl status firewalld
  • List services added: firewall-cmd --list-services
  • List ports added for zone: firewall-cmd --list-ports
  • Reload firewall rules and keep state information: firewall-cmd --reload
  • Check whether the firewalld daemon is active: firewall-cmd --state
  • Add a service: firewall-cmd --add-service=dns --permanent
  • Add a specific port: firewall-cmd --add-port=80/tcp --permanent
  • List all zones: firewall-cmd --get-zones
  • List the default zone: firewall-cmd --get-default-zone
  • Change the default zone: firewall-cmd --set-default-zone=internal

grub2

Do not edit /boot/grub2/grub.cfg by hand !

  • Configuration files:

    • /boot/grub2/grub.cfg (or symbolick link /etc/grub2.cfg)
    • /etc/default/grub
    • /etc/sysconfig/kernel
    • /etc/grub.d directory
  • List all kernel entries:

grubby --info=ALL
grep ^menuentry /boot/grub2/grub.cfg | cut -f 2 -d \' | nl -v 0
grep ^menuentry /etc/grub2.cfg  | awk -F'--' '{print $1}'
  • Add an argument: grubby --args "rhgb" --update-kernel /boot/vmlinuz-3.10.0-693.1.1.el7.x86_64
  • Remove "rhgb quiet LANG=en_US.UTF-8" arguments: grubby --remove-args "rhgb quiet LANG=en_US.UTF-8" --update-kernel /boot/vmlinuz-3.10.0-693.1.1.el7.x86_64
  • Updating all kernel with the same argument: grubby --args="rdblacklist=lpfc" --update-kernel=ALL
  • Remove the argument for all kernels: grubby --remove-args="rdblacklist=lpfc" --update-kernel=ALL
  • Rebuild grub.cfg (after editing /etc/default/grub):
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bkp
grub2-mkconfig -o /boot/grub2/grub.cfg
  • Display the numeric index of the current default boot entry: grubby --default-index or grub2-editenv list
  • Set the default boot menu entry for GRUB (file /boot/grub2/grubenv): grubby --set-default-index 3 or grub2-set-default 3
  • Display the full path to the current default kernel: grubby --default-kernel
  • Display information on all boot entries which match kernel-path: grubby --info /boot/vmlinuz-3.10.0-693.11.1.el7.x86_64