centos 7 mini初始化配置

來源:本站原創 Linux 超過796 views圍觀 0條評論

centos 7 mini初始化

網卡配置靜態IP
NAME=ens160
DEVICE=ens160
UUID=
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
DNS1=172.16.1.3
DNS2=172.30.100.3
IPADDR0=172.
PREFIX0=24
GATEWAY0=172.

查看網關命令
ip route show

[[email protected] ~]# ip route show
default via 192.168.142.1 dev ens33  proto static  metric 100
192.168.142.0/24 dev ens33  proto kernel  scope link  src 192.168.142.131  metric 100

default via 192.168.142.2 dev ens33  proto static  metric 100    ——–192的網關192.168.142.2
192.168.142.0/24 dev ens33  proto kernel  scope link  src 192.168.142.139  metric 100

增加國內源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum install epel-release

增加管理帳號
修改 /etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
dev    ALL=(ALL)       ALL

服務器配置chrony  ntp
  yum install -y chrony  安裝
  systemctl enable chronyd  開機啟動
  systemctl restart chronyd  啟動服務
  timedatectl
  chronyc sources

  開放端口看
  [[email protected] ~]# netstat -ntlpu |grep chrony
udp        0      0 127.0.0.1:323           0.0.0.0:*                           31875/chronyd      
udp        0      0 0.0.0.0:123             0.0.0.0:*                           31875/chronyd      
udp6       0      0 ::1:323                 :::*                                31875/chronyd      
[[email protected] ~]#

 
客戶端配置chrony
vim /etc/chrony.conf
service 172.30.100.139 iburst
保存重啟服務
查看同步命令

systemctl restart chronyd
chronyc sources -v
date
timedatectl -h
timedatectl set-timezone Asia/Shanghai
date  確認無誤

6.8
[[email protected] ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*172.30.100.139  85.199.214.100   2 u   24   64    1    2.261    1.572   0.806
7.0
[[email protected] conf.d]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.30.100.139                2   6   377    42   -203us[+1131us] +/-  145ms
[[email protected] conf.d]#

測試
[[email protected] ~]# date -s 2000-01-01  修改時間
Sat Jan  1 00:00:00 CST 2000
[[email protected] ~]# date
Sat Jan  1 00:00:02 CST 2000
[[email protected] ~]# service ntpd restart 重啟服務
Shutting down ntpd:                                        [FAILED]
Starting ntpd: 
[[email protected] ~]# date
Fri Apr 28 15:50:59 CST 2017
[[email protected] ~]# ntpq -p  查看狀態
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*172.30.100.139  61.216.153.104   4 u    9   64    1    2.673    0.396   0.376
[[email protected] ~]#

文章出自:CCIE那點事 http://www.qdxgqk.live/ 版權所有。本站文章除注明出處外,皆為作者原創文章,可自由引用,但請注明來源。 禁止全文轉載。
本文鏈接:http://www.qdxgqk.live/?p=3579轉載請注明轉自CCIE那點事
如果喜歡:點此訂閱本站
  • 相關文章
  • 為您推薦
  • 各種觀點
?
暫時還木有人評論,坐等沙發!
發表評論

您必須 [ 登錄 ] 才能發表留言!

?
?
萌宠夺宝游戏