####Configure networking, update connections / devices
- Devices and connections are two distinct things
- devices are actual interfaces on the system
- connections can be bound & be turned on/off
- only 1 connection can be up at a time
nmcli con show
ornmcli dev status
- display network connections or devicesnmcli con del <name|UUID>
- remove a connection / interfacenmcli con add con-name <name> ifname <interface> type ethernet ip4 1.1.1.1/24 gw4 1.1.1.1
- create a connection (provide ip / gateway)
nmcli con reload
- reload configs into network managerip address show
orip a
- check configurationnmcli con show <name>
- all information about a connection
nmcli con down <name>
- stop a connectionnmcli con up <name>
- start a connection- To modify a connection:
nmcli con mod <name> ipv4.address 1.1.1.1/24
- ip addressnmcli con mod <name> ipv4.gateway 1.1.1.1
- gatewaynmcli con reload
- reload configs into network managernmcli con up <name>
- ensure connection is upnmcli con delete <name>
- delete the connection when through
#####Hostname updates: statically or dynamically
hostnamectl <--static|--transient|--pretty>
- view all current hostnames (static, transient, pretty)hostnamectl set-hostname <name>
- set the hostname- use
--static
,--transient
,--pretty
for individual hostnames
- use
- hostname resolution relies on
/etc/nsswitch.conf
hosts: files dns
- entry resloves first through files (static) then dns (dynamic)- static comes from
/etc/hosts
file - dynamic comes from
/etc/resolve.conf
file
- static comes from
nmcli con mod <interface> +ipv4.dns 1.1.1.1
- add DNS server+ipv4.dns
- adds a serveripv4.dns
- replaces it-ipv4.dns
- removes a server
nmcli con up <interface>
- restart connection
####Schedule tasks using at and cron
Minute | Hour | Day Of Month | Month | Day Of Week | CMD |
---|---|---|---|---|---|
0-59 | 0-23 | 1-31 | 1-12 | 1-7 | /root/script.sh |
crontab -u <username> -e
- edit users crontab- wildcards
*
can be used to match every value - cron jobs that neet to run routinely can be placed in
/etc/cron.{daily,weekly,monthly}
- these must be executable
#####Configure time services using NTP
timedatectl
- get current configtimedatectl list-timezones
- list available time zonestimedatectl set-timezone <timezone>
- set the timezone eg:America/Chicago
yum install -y ntp
- install ntpsystemctl enable ntpd.service
- enable ntpd at bootsystemctl start ntpd.service
- start ntpd- config file is at
/etc/ntp.conf
- config file is at
#####Configure time services using Chrony
yum install -y chrony
- install chronysystemctl enable cronyd.service
- enable chronyd at bootsystemctl start cronyd.service
- start chronydntpdate <timeserver>
- synchronize server- config file is located at
/etc/chrony.conf
- config file is located at
####Install and update packages from Redhat network, remote repo or local file system
yum-config-manager --add-repo=http://myrepo.com
- leverage this tool to generate repo filevi /etc/yum.repos.d/<remote>.repo
- modify the repository to
[base]
[myrepo.com]
name=added from http://myrepo.com
baseurl=http://myrepo.com
enabled=1
gpgcheck=0 # <----- add this line!