要求:把R1作为ntp server,R2、R3同步R1的时间
1、前提条件:实现R1、R2、R3互通
R1:
interface Loopback1
ip address 1.1.1.1 255.255.255.255
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.0 0.0.0.255 area 0
R2:
interface Loopback1
ip address 2.2.2.2 255.255.255.255
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.0 0.0.0.255 area 0
network 23.1.1.0 0.0.0.255 area 0
R3:
interface Loopback1
ip address 3.3.3.3 255.255.255.255
interface FastEthernet0/1
ip address 23.1.1.3 255.255.255.0
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 23.1.1.0 0.0.0.255 area 0
2、对于R1:做ntp server基本配置:
R1#clock set 14:55:00 21 May 2024
R1(config)#clock timezone GMT +8
R1(config)#ntp server 1.1.1.1
R1(config)#ntp master 1
R1(config)#ntp source lo1
有两个时区:UTC和GMT,因此要更改为中国的时区GMT,默认为UTC
master:值越小则时间匹配的越精确
ntp source 来指定ntp发送的源地址
3、对R2、R3:做ntp client基本配置:
R2(config)#clock timezone GMT +8
R2(config)#ntp server 1.1.1.1
R2(config)#ntp source lo1
检测:
show ntp status
synchronized为同步成功