此篇已經重新謄錄完成!!
可以作廢。
HostOS:
windows10
192.168.2.100
若無法 ping :
控制台\系統及安全性\Windows Defender 防火牆-->進階設定-->輸入規則
啟用 檔案及印表機共用(回應要求-ICMPv4-IN) 設定檔:私人 -->啟用規則
GuestOS:
CentOS8
192.168.2.103
# ping 192.168.2.100
PING 192.168.2.100 (192.168.2.100) 56(84) bytes of data.
64 bytes from 192.168.2.100: icmp_seq=1 ttl=128 time=0.367 ms
.
.
----------------------------------------------- 啟用網卡
# ip addr
# ip -s link
# ip link set ens33 up //啟用網路介面卡 up:開 down:關
# nmcli device status
DEVICE TYPE STATE CONNECTION
ens33 ethernet 已連線 ens33
lo loopback 不受管理 --
# nmcli device connect ens33 //啟用網卡 停用網卡:disconnect
裝置「ens33」已成功以「9cb77588-c78e-40b0-acbe-3be164c3e385」啟用。
# nmtui //啟用連線
----------------------------------------------- 路由
# ip route | column -t
default via 192.168.2.1 dev ens33 proto static metric 100
192.168.2.0/24 dev ens33 proto kernel scope link src 192.168.2.103 metric 100
# ip route | column -t > kkRouteTable.txt
# ls
kkRouteTable.txt
# cat kkRouteTable.txt
# ip -6 route | column -t //IPv6 Route Table
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev ens33 proto kernel metric 100 pref medium
# tracepath 168.95.1.1 //traceroute
# ss -antp |column -t //對應 netstat -antp
# ss -t
-----------------------------------------------
# systemctl list-unit-files //查詢服務啟動或是關閉狀態,以檔名顯示
# systemctl list-units //查詢目前所有已啟動的服務
UNIT LOAD ACTIVE SUB DESCRIPTION
...
crond.service loaded active running Command Scheduler
UNIT LOAD ACTIVE SUB DESCRIPTION
...
crond.service loaded active running Command Scheduler
...
firewalld.service loaded active running firewalld - dynamic firew>
...
NetworkManager.service loaded active running Network Manager
...
sshd.service loaded active running OpenSSH server daemon
...
# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-03-03 07:47:29 CST; 1h 40min ago
firewalld.service loaded active running firewalld - dynamic firew>
...
NetworkManager.service loaded active running Network Manager
...
sshd.service loaded active running OpenSSH server daemon
...
# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-03-03 07:47:29 CST; 1h 40min ago
# systemctl stop firewalld.service //立即停止xxx.service
# systemctl start firewalld.service //立即啟動xxx.service
# systemctl is-active firewalld.service
active
# systemctl disable firewalld.service //設定開機不啟動xxx.service
# systemctl enable firewalld.service //設定開機啟動xxx.service
# chkconfig firewalld off //設定 firewalld 開機時不要啟動
# chkconfig firewalld on //設定 firewalld 開機時啟動,且不加.service
# systemctl is-enabled firewalld.service
enabled
-----------------------------------------------
# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
...
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
...
# vi /etc/sysconfig/selinux //關閉SELINUX
...
SELINUX=disabled
...
...
-----------------------------------------------
# journalctl //日誌檢視說明
# journalctl -n10 //列出最後10行資料
# journalctl -xn //列出最後事件,並提供相關解決問題資訊
# journalctl -n10 //列出最後10行資料
# journalctl -xn //列出最後事件,並提供相關解決問題資訊
# journalctl --follow //持續列出最後10行事件記錄
-- Logs begin at Tue 2020-03-03 07:47:06 CST. --
3月 03 09:31:32 Ku.CentOS8 systemd[1]: Stopped firewalld - dynamic firewall daemon.
-- Logs begin at Tue 2020-03-03 07:47:06 CST. --
3月 03 09:31:32 Ku.CentOS8 systemd[1]: Stopped firewalld - dynamic firewall daemon.
...
# tail -n 10 -f /var/log/messages
Mar 3 09:31:43 kk systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 3 09:31:44 kk systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 3 09:31:43 kk systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 3 09:31:44 kk systemd[1]: Stopped firewalld - dynamic firewall daemon.
-----------------------------------------------
(一)使用者的設定
# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
# crontab -e
53 07 * * * /usr/bin/ls
# crontab -l
53 07 * * * /usr/bin/ls
# cat /var/spool/cron/root
53 07 * * * /usr/bin/ls
# journalctl -n 10
...
# cat /var/log/cron
...
Mar 4 07:51:52 Ku crontab[1733]: (root) BEGIN EDIT (root)
Mar 4 07:52:43 Ku crontab[1733]: (root) REPLACE (root)
Mar 4 07:52:43 Ku crontab[1733]: (root) END EDIT (root)
Mar 4 07:53:01 Ku crond[967]: (root) RELOAD (/var/spool/cron/root)
Mar 4 07:53:01 Ku CROND[1737]: (root) CMD (/usr/bin/ls )
# tail /var/log/cron
...
(二)系統的設定檔
# vi /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
00 08 * * * root /usr/bin/ls
# systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable >
...
crond.service loaded active running Command Scheduler
...
firewalld.service loaded active running firewalld - dynamic firewall daemon
...
NetworkManager.service loaded active running Network Manager
...
sshd.service loaded active running OpenSSH server daemon
# systemctl restart crond
# tail /var/log/cron
...
Mar 5 08:00:01 Ku crond[974]: (*system*) RELOAD (/etc/crontab)
Mar 5 08:00:01 Ku CROND[1765]: (root) CMD (/usr/bin/ls)
Mar 5 08:00:01 Ku CROND[1764]: (root) CMDOUT (anaconda-ks.cfg)
Mar 5 08:00:01 Ku CROND[1764]: (root) CMDOUT (kkRouteTable.txt)
...
# journalctl -n 10
-- Logs begin at Thu 2020-03-05 07:42:10 CST, end at Thu 2020-03-05 08:01:01 CS>
3月 05 08:00:01 Ku.CentOS8 crond[974]: (*system*) RELOAD (/etc/crontab)
3月 05 08:00:01 Ku.CentOS8 CROND[1765]: (root) CMD (/usr/bin/ls)
3月 05 08:00:01 Ku.CentOS8 CROND[1764]: (root) CMDOUT (anaconda-ks.cfg)
3月 05 08:00:01 Ku.CentOS8 CROND[1764]: (root) CMDOUT (kkRouteTable.txt)
-----------------------------------------------
# date
四 3月 5 11:06:39 CST 2020
// 更改日期間: MMDDhhmmYYYY 月日時分年
# date 040608302020
一 4月 6 08:30:00 CST 2020
//查看 BIOS 時間
# hwclock -r
2020-03-05 11:13:12.171152+08:00
//將電腦日期時間寫入到 BIOS 時間
# hwclock -w
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
(一)使用者的設定
# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
# crontab -e
53 07 * * * /usr/bin/ls
# crontab -l
53 07 * * * /usr/bin/ls
# cat /var/spool/cron/root
53 07 * * * /usr/bin/ls
# journalctl -n 10
...
3月 04 07:51:52 Ku.CentOS8 crontab[1733]: (root) BEGIN EDIT (root)
3月 04 07:52:43 Ku.CentOS8 crontab[1733]: (root) REPLACE (root)
3月 04 07:52:43 Ku.CentOS8 crontab[1733]: (root) END EDIT (root)
3月 04 07:53:01 Ku.CentOS8 crond[967]: (root) RELOAD (/var/spool/cron/root)
3月 04 07:53:01 Ku.CentOS8 systemd[1]: Started Session 3 of user root.
3月 04 07:53:01 Ku.CentOS8 CROND[1737]: (root) CMD (/usr/bin/ls )
...
# cat /var/log/cron
...
Mar 4 07:51:52 Ku crontab[1733]: (root) BEGIN EDIT (root)
Mar 4 07:52:43 Ku crontab[1733]: (root) REPLACE (root)
Mar 4 07:52:43 Ku crontab[1733]: (root) END EDIT (root)
Mar 4 07:53:01 Ku crond[967]: (root) RELOAD (/var/spool/cron/root)
Mar 4 07:53:01 Ku CROND[1737]: (root) CMD (/usr/bin/ls )
...
...
# vi /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
00 08 * * * root /usr/bin/ls
# systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable >
...
crond.service loaded active running Command Scheduler
...
firewalld.service loaded active running firewalld - dynamic firewall daemon
...
NetworkManager.service loaded active running Network Manager
...
sshd.service loaded active running OpenSSH server daemon
# systemctl restart crond
# tail /var/log/cron
...
Mar 5 08:00:01 Ku crond[974]: (*system*) RELOAD (/etc/crontab)
Mar 5 08:00:01 Ku CROND[1765]: (root) CMD (/usr/bin/ls)
Mar 5 08:00:01 Ku CROND[1764]: (root) CMDOUT (anaconda-ks.cfg)
Mar 5 08:00:01 Ku CROND[1764]: (root) CMDOUT (kkRouteTable.txt)
...
# journalctl -n 10
-- Logs begin at Thu 2020-03-05 07:42:10 CST, end at Thu 2020-03-05 08:01:01 CS>
3月 05 08:00:01 Ku.CentOS8 crond[974]: (*system*) RELOAD (/etc/crontab)
3月 05 08:00:01 Ku.CentOS8 CROND[1765]: (root) CMD (/usr/bin/ls)
3月 05 08:00:01 Ku.CentOS8 CROND[1764]: (root) CMDOUT (anaconda-ks.cfg)
3月 05 08:00:01 Ku.CentOS8 CROND[1764]: (root) CMDOUT (kkRouteTable.txt)
...
# date
四 3月 5 11:06:39 CST 2020
// 更改日期間: MMDDhhmmYYYY 月日時分年
# date 040608302020
一 4月 6 08:30:00 CST 2020
//查看 BIOS 時間
# hwclock -r
2020-03-05 11:13:12.171152+08:00
//將電腦日期時間寫入到 BIOS 時間
# hwclock -w
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------