为了防止路由器的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

最新文章

  1. Docker for Windows使用简介
  2. oracle补丁升级
  3. js 日期对象Date以及传参
  4. ajax讲解:“创建用户”和“用户登录”练习
  5. 关于浏览器兼容处理—— 识别IE浏览器
  6. C# 算速表达式
  7. 40多个非常有用的Oracle 查询语句
  8. Unity3D 游戏的碰撞
  9. 线性代数(高斯消元):JSOI2008 球形空间产生器sphere
  10. 加载gif图过渡效果
  11. 怎样以学习单片机为契机,逐步成为优秀的project师
  12. 使用Identity Server 4建立Authorization Server (3)
  13. Mybatis整理_01
  14. tomcat 绑定ipv4端口
  15. java代码之美(1)---Lambda
  16. Uva 11178 Morley定理
  17. Windows环境下32位汇编语言程序设计笔记-基础篇
  18. C#精华面试题及答案 三
  19. 003.LVM扩容
  20. C++11 之for 新解 auto

热门文章

  1. YII2.0学习二 安装adminlte 后台模板
  2. Nodejs 使用 addons 调用c++ 初体验(一)
  3. 密码发生器 南阳acm519
  4. STM32进阶之串口环形缓冲区实现(转载)
  5. TCD产品技术参考资料
  6. Django中的select_related与prefetch_related
  7. (转载)深入super,看Python如何解决钻石继承难题
  8. java反射操作类方法与属性
  9. 1034 Head of a Gang (30 分)(图的遍历or并查集)
  10. HDU 5794 A Simple Chess Lucas定理+dp