dhcp 和ntpdate时间同步
为了防止路由器的dhcp服务干扰实验,我们2台机器分别新加了1快网卡. vmnet4

dhcp安装
[root@ygy130 ~]# yum -y install dhcp
将配置文件放在/etc/dhcp下
[root@ygy130 ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
设置开机自启动
[root@ygy130 ~]# chkconfig dhcpd on
修改配置文件
[root@ygy130 ~]# vim /etc/dhcp/dhcpd.conf
subnet 192.168.2.0 netmask 255.255.255.0{ 网段
range 192.168.2.100 192.168.2.200; 范围
option domain-name-servers 114.114.114.114; dns
option domain-name "ygy123.cn"; 域名
option routers 192.168.2.1; 网关
option broadcast-address 192.168.2.255; 广播
default-lease-time 600; 租期
max-lease-time 7200; 最长租期
host ygy130{ 指定服务器主机
hardware ethernet 00:0C:29:59:B1:B2; 绑定客户机地址
fixed-address 192.168.2.110; 客户机的ip
}
}

启动
[root@ygy130 ~]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
要关闭防火墙,否则其他机器不能获得服务。
注意,这里多网卡,要设置路由才能上网。
[root@ygy130 ~]# route add default gw 192.168.1.1 eth0
[root@ygy130 ~]# route add default gw 192.168.8.1 eth1
[root@yu131 ~]# route add -net 192.168.8.0/24 gw 192.168.1.1 eth0
这样就能上网了。
重启失效。
时间同步:ntpdate time.windows.com
yum install ntpdate -y
[root@ygy130 ~]# date +" %F"
2016-09-25
修改时间
[root@ygy130 ~]# date -s "2015-3-6 21:13"
Fri Mar 6 21:13:00 CST 2015
[root@ygy130 ~]# date
Fri Mar 6 21:13:03 CST 2015
[root@ygy130 ~]# hwclock -r
Sun 25 Sep 2016 11:59:48 PM CST -0.766794 seconds
[root@ygy130 ~]# hwclock -w
[root@ygy130 ~]# hwclock -r
Fri 06 Mar 2015 09:14:06 PM CST -0.329304 seconds
[root@yu131 ~]# ntpdate time.windows.com
26 Sep 00:01:30 ntpdate[12406]: adjust time server 40.118.103.7 offset 0.040445 sec
[root@yu131 ~]# date
Mon Sep 26 00:01:35 CST 2016
dhcp 和ntpdate时间同步的更多相关文章
- Linux下ntpdate时间同步
Linux下ntpdate时间同步 Ntp服务器配置(暂略,以后整理) 时间同步方法 同步命令 # ntpdate ntp服务器域名或IP 例:# nt ...
- Linux 时间同步 03 ntpdate时间同步
Linux 时间同步 03 ntpdate时间同步 目录 Linux 时间同步 03 ntpdate时间同步 安装ntpdate 修改/etc/sysconfig/ntpdate 使用ntpdate手 ...
- ntpdate时间同步
为什么需要网络同步时间: Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用nt ...
- yum tenxun ntpdate 时间同步
centos7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base ...
- 时间同步之pxe,cobbler,dhcp
ntpdate 时间同步 同步方法 ntpdate ntp服务器IP 例: ntpdate 192.168.37.11 自动运行同步时间脚本 crontab -e * */1 * * * /usr/s ...
- NTP服务及时间同步(CentOS6.x)
博客分类: linux 今有一小型项目,完全自主弄,原来以为很简单的NTP服务,我给折腾了2个多小时才整撑头(以前都是运维搞,没太注意,所以这技术的东西,在简单都需要亲尝啊),这里记录为以后别再浪 ...
- linux配置时间同步
目标环境,5台linux centos 6.3, 一台作为NTPD服务与外部公共NTP服务同步时间,同时作为内网的NTPD服务器,其他机器与这台服务做时间同步. 服务器IP 角色 说明 同步方式 ...
- CentOS7 设置集群时间同步
1. 安装ntp时间同步工具 yum -y install ntp ntpdate #安装ntpdate时间同步工具 ntpdate cn.pool.ntp.org #设置时间同步 hwclock - ...
- 内网环境NTP服务及时间同步(CentOS6.x)配置和部署
目标环境,5台linux centos 6.3, 一台作为NTPD服务与外部公共NTP服务同步时间,同时作为内网的NTPD服务器,其他机器与这台服务做时间同步. 服务器IP 角色 说明 同步方式 ...
随机推荐
- python函数的返回值
返回值:return1.没有返回值 #不写return #只写return:结束一个函数 #return None2.有一个返回值 #可以返回任何数据类型 #只要返回就可 ...
- 用pathon实现计算器功能
实现计算类似公式的计算器程序1 - 2 * ( (60-30 +(-40/5) * (9-2*5/3 + 7 /3*99/4*2998 +10 * 568/14 )) - (-4*3)/ (16-3* ...
- 关于在各种int类型选择时的考虑
整数类型int在不同版本的c标准中不断丰富. 最初的K&R标准给出了int作为整数的基本类型,给出long.short.unsigned作为int的变式.在c90中又加入了signed. 在c ...
- array_x
import java.util.*; public class array_x { public static void main(String args[]) { int a[][]={{2,4, ...
- kafka重置offset
kafka重置offset 1.删除zookeeper上节点信息 打开client :./zkCli.sh -server 127.0.0.1:12181 删除consumer:rmr /cons ...
- Android面试收集录 Android组件
1.请说出Android SDK支持哪些方式显示富文本信息? 使用TextView组件可以显示富文本信息,如果要实现图文混排,需实现ImageGetter接口 使用WebView组件显示HTML页面 ...
- 实用脚本 2 -- Linux下定时执行脚本
今天学习Linux下定时执行脚本,看到一篇讲解比较好的文章,特此拿来分享. 原文链接:http://www.blogjava.net/decode360/archive/2009/09/18/2877 ...
- nodejs的交叉(跨平台)编译(to android)
nodejs的二进制包有两种安装方式node-gyp以及node-pre-gyp 这两条命令会写入该包的安装脚本. node-gyp是使用gyp工具编译源码,因此必须指定交叉编译器(参见http:// ...
- 远程连接云主机MySql数据库
笔者最近在学习MySql数据库,试着远程连接阿里云主机数据库.在连接过程中遇到不少麻烦,这里总结一下过程中遇到的问题. 基本前提 先在本地电脑和远程主机上安装MySql数据库,保证数据库服务启动. 云 ...
- DOM操作相关案例 模态对话框,简易留言板,js模拟选择器hover,tab选项卡,购物车案例
1.模态框案例 需求: 打开网页时有一个普通的按钮,点击当前按钮显示一个背景图,中心并弹出一个弹出框,点击X的时候会关闭当前的模态框 代码如下: <!DOCTYPE html> <h ...