为了防止路由器的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时间同步的更多相关文章

  1. Linux下ntpdate时间同步

    Linux下ntpdate时间同步 Ntp服务器配置(暂略,以后整理) 时间同步方法 同步命令               # ntpdate ntp服务器域名或IP           例:# nt ...

  2. Linux 时间同步 03 ntpdate时间同步

    Linux 时间同步 03 ntpdate时间同步 目录 Linux 时间同步 03 ntpdate时间同步 安装ntpdate 修改/etc/sysconfig/ntpdate 使用ntpdate手 ...

  3. ntpdate时间同步

    为什么需要网络同步时间: Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用nt ...

  4. yum tenxun ntpdate 时间同步

    centos7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base ...

  5. 时间同步之pxe,cobbler,dhcp

    ntpdate 时间同步 同步方法 ntpdate ntp服务器IP 例: ntpdate 192.168.37.11 自动运行同步时间脚本 crontab -e * */1 * * * /usr/s ...

  6. NTP服务及时间同步(CentOS6.x)

    博客分类: linux   今有一小型项目,完全自主弄,原来以为很简单的NTP服务,我给折腾了2个多小时才整撑头(以前都是运维搞,没太注意,所以这技术的东西,在简单都需要亲尝啊),这里记录为以后别再浪 ...

  7. linux配置时间同步

    目标环境,5台linux centos 6.3, 一台作为NTPD服务与外部公共NTP服务同步时间,同时作为内网的NTPD服务器,其他机器与这台服务做时间同步.  服务器IP 角色   说明 同步方式 ...

  8. CentOS7 设置集群时间同步

    1. 安装ntp时间同步工具 yum -y install ntp ntpdate #安装ntpdate时间同步工具 ntpdate cn.pool.ntp.org #设置时间同步 hwclock - ...

  9. 内网环境NTP服务及时间同步(CentOS6.x)配置和部署

    目标环境,5台linux centos 6.3, 一台作为NTPD服务与外部公共NTP服务同步时间,同时作为内网的NTPD服务器,其他机器与这台服务做时间同步.  服务器IP 角色   说明 同步方式 ...

随机推荐

  1. Hadoop(23)-Yarn资源调度器

    Yarn是一个资源调度平台,负责为运算程序提供服务器运算资源,相当于一个分布式的操作系统平台,而MapReduce等运算程序则相当于运行于操作系统之上的应用程序 1. Yarn工作机制 机制详解 第1 ...

  2. python正则表达式+正则大量实例

    正则表达式 正则表达式内部函数详解http://www.runoob.com/python/python-reg-expressions.html 正则表达式是一个特殊的字符序列,它能帮助你方便的检查 ...

  3. python爬虫 爬取steam热销游戏

    好久没更新了啊...最近超忙 这学期学了学python 感觉很有趣 就写着玩~~~ 爬取的页面是:https://store.steampowered.com/search/?filter=globa ...

  4. 今天买了个pro,开始ios开发

    今天买了个mac pro 开始ios开发啦,爽!

  5. mysql8.0.14 安装

    1.下载 地址:https://dev.mysql.com/downloads/mysql/ 找到zip压缩文件. 2.配置环境变量 把解压后的路径配置到环境变量中 3.安装 在解压后的文件夹中新建m ...

  6. svn资源库url问题

    今天连接svn资源库的时候一直出现 RA layer request failedsvn: Unable to connect to a repository at URL http://... sv ...

  7. 跳出for循环break和continue的区别

    1.break 跳出for循环,结束for循环 如果有两层循环,break只能跳出一层循环 2.continue 跳出本次循环,继续下一条数据的循环

  8. 孤荷凌寒自学python第七十一天开始写Python的第一个爬虫

    孤荷凌寒自学python第七十一天开始写Python的第一个爬虫 (完整学习过程屏幕记录视频地址在文末) 在了解了requests模块和BeautifulSoup模块后,今天开始真正写一个自己的爬虫代 ...

  9. Leetcode 55. Jump Game & 45. Jump Game II

    55. Jump Game Description Given an array of non-negative integers, you are initially positioned at t ...

  10. 对 vscode 自动格式化的结果不太满意,我们该如何自己调整直至自己满意为止

    前提概述 采用vue-cli 3.0自动生成vue项目,选了ESlint+Prettier,在写request.js的时候,顺手用vscode右击格式化文件(Alt+Shift+F),一下子报了8个问 ...