centOS7linux期末考题,【Linux操作系统面试题】面试问题:CentOS7…-看...

centOS7linux期末考题,【Linux操作系统面试题】面试问题:CentOS7…-看...

2023年6月30日发(作者:)

centOS7linux期末考题,【Linux操作系统⾯试题】⾯试问题:CentOS7…-看准⽹在配置时钟同步服务器时第⼀次同步时间时,使⽤ntpdate命令;后续通过ntpd服务与服务器同步时间。⼀、搭建NTP服务器1、查看服务器、客户端操作系统版本[root@web ~]# cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core)2、查看服务器是否安装ntp,系统默认安装ntpdate;[root@web ~]# rpm -qa | grep .x86_3、安装ntp ntpdate,其中ntpdate默认安装,可以只安装ntp;yum install ntp ntpdate -y4、查看是否已安装完成,与第2步对⽐[root@web ~]# rpm -qa | grep .x86_.x86_5、查看ntp服务器状态,两条命令效果⼀样[root@web ~]# systemctl status ntpd● e - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/e; disabled; vendor preset: disabled)Active: inactive (dead)或[root@web ~]# service ntpd statusRedirecting to /bin/systemctl status e● e - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/e; disabled; vendor preset: disabled)Active: inactive (dead)6、修改配置⽂件,使该NTP服务器在不联⽹的情况下,使⽤本服务器的时间作为同步时间vim /etc/把如下四⾏代码注释掉server iburstserver iburstserver iburstserver iburst在下⾯再添加⼀⾏server 127.127.1.0 iburst7、启动ntp服务systemctl start ntpd或service ntpd start8、再次查看服务器状态[root@web ~]# systemctl status ntpd● e - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/e; enabled; vendor preset: disabled)Active: active (running) since Tue 2018-08-21 14:29:12 CST; 8s agoProcess: 6588 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)Main PID: 6589 (ntpd)Tasks: 1CGroup: //e└─6589 /usr/sbin/ntpd -u ntp:ntp -gAug 21 14:29:12 web ntpd[6589]: Listen normally on 2 lo 127.0.0.1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 3 eno1 192.168.0.163 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 4 virbr0 192.168.122.1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 5 lo ::1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 6 eno1 fe80::6e92:bfff:fe6f:daea UDP 123Aug 21 14:29:12 web ntpd[6589]: Listening on routing socket on fd #23 for interface updatesAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c016 06 restartAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPMAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c011 01 freq_not_setAug 21 14:29:13 web ntpd[6589]: 0.0.0.0 c514 04 freq_mode或[root@web ~]# service ntpd statusRedirecting to /bin/systemctl status e● e - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/e; enabled; vendor preset: disabled)Active: active (running) since Tue 2018-08-21 14:29:12 CST; 56s agoProcess: 6588 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)Main PID: 6589 (ntpd)Tasks: 1CGroup: //e└─6589 /usr/sbin/ntpd -u ntp:ntp -gAug 21 14:29:12 web ntpd[6589]: Listen normally on 2 lo 127.0.0.1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 3 eno1 192.168.0.163 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 4 virbr0 192.168.122.1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 5 lo ::1 UDP 123Aug 21 14:29:12 web ntpd[6589]: Listen normally on 6 eno1 fe80::6e92:bfff:fe6f:daea UDP 123Aug 21 14:29:12 web ntpd[6589]: Listening on routing socket on fd #23 for interface updatesAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c016 06 restartAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPMAug 21 14:29:12 web ntpd[6589]: 0.0.0.0 c011 01 freq_not_setAug 21 14:29:13 web ntpd[6589]: 0.0.0.0 c514 04 freq_mode9、查看是否同步[root@web ~]# ntpq -premote refid st t when poll reach delay offset jitter==============================================================================*LOCAL(0) .LOCL. 5 l 20 64 7 0.000 0.000 0.00010、设置开机启动[root@web ~]# systemctl enable ntpdCreated symlink from /etc/systemd/system//e to /usr/lib/systemd/system/ntpdservice.11、设置防⽕墙,打开udp123端⼝[root@web ~]# firewall-cmd --permanent --add-port=123/udpsuccess[root@web ~]# firewall-cmd --reloadsuccess12、查看防⽕墙已打开端⼝iptables -L -n⼆、客户端配置前5步与服务器⼀致6、修改配置⽂件,将刚刚搭建好的NTP服务器作为客户端上游时间服务器vim /etc/#注释掉其他上游时间服务器#server iburst#server iburst#server iburst#server iburst#配置上游时间服务器为本地的ntpd Server服务器server 192.168.0.163#配置允许上游时间服务器主动修改本机的时间restrict 192.168.0.163 nomodify notrap noquery7、与本地ntpd Server同步⼀下ntpdate -u 192.168.0.1638、启动ntp服务systemctl start ntpd或service ntpd start9、设置开机启动[root@db3 ~]# systemctl enable ntpdCreated symlink from /etc/systemd/system//e to /usr/lib/systemd/system/e.10、查看状态[root@db3 ~]# ntpq -premote refid st t when poll reach delay offset jitter==============================================================================*192.168.0.163 LOCAL(0) 11 u 21 64 377 0.068 -0.824 0.367

发布者:admin,转转请注明出处:http://www.yc00.com/news/1688120043a84946.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信