RedHat6.2簡單配置dhcp
我的環境:
兩臺RedHat6.2,其中192.168.16.11作測試,192.168.16.12做dhcp伺服器
dhcp版本:dhcp-4.1.1-25.P1.el6.i686
實驗步驟:
1、由於映象已複製到伺服器端,直接在伺服器端搭建本地yum源:
[root@redhat6-2 dhcp]# vi /etc/yum.repos.d/rhel-source.repo
[my-yum]
name=Red Hat Enterprise 6.2
baseurl=file:///var/ftp/pub/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2、使用yum update更新yum源:
3、使用yum install dhcp-* 安裝dhcp
Running Transaction
Installing : 12:dhcp-4.1.1-25.P1.el6.i686 1/1
Installed products updated.
Installed:
dhcp.i686 12:4.1.1-25.P1.el6
Complete!
4、手動寫dhcp的配置檔案:
[root@redhat6-1 ~]# vi /etc/dhcp/dhcpd.conf
也可直接copy模板,修改一下即可:
[root@redhat6-1 ~]# cp -rf /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
配置檔案內容如下:關鍵內容已標出
ddns-update-style interim; 支援DDNS
ignore client-updates; 忽略DDNS更新
subnet 192.168.16.0 netmask 255.255.255.0 { 宣告作用域
# --- default gateway
option routers 192.168.16.1; 閘道器
option subnet-mask 255.255.255.0; 掩碼
option nis-domain "domain.org"; NIS域
option domain-name "domain.org"; DHCP名字
option domain-name-servers 10.37.16.1; 給客戶機分配的DNS
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address fantasia.fugue.com;
}
}
5、儲存退出,重啟一下dhcp服務:service dhcpd restart
6、修改測試端的IP設定為dhcp獲取
[root@redhat6-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
加入BOOTPROTO=dhcp即可
DEVICE="eth1"
HWADDR="00:0C:29:19:FB:ED"
NM_CONTROLLEiD="no"
ONBOOT="yes"
BOOTPROTO=dhcp
IPADDR=192.168.16.11
NETMASK=255.255.255.0
7、測試端(原本IP是192.168.16.11)輸入dhclient
由於dhcp重新獲取ip,ip地址已改變
8、進入虛擬機器檢視IP是否發生了變化,IP是否是從dhcp伺服器端獲得
ip地址果然發生變化,服務端檢視ip資源分配情況
[root@redhat6-2 dhcp]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.1.1-P1
lease 192.168.16.128 {
starts 2 2013/12/10 10:50:51;
ends 2 2013/12/10 16:50:51;
tstp 2 2013/12/10 16:50:51;
cltt 2 2013/12/10 10:50:51;
binding state active;
next binding state free;
hardware ethernet 00:0c:29:19:fb:ed;
}
192.168.16.128分配給了00:0c:29:19:fb:ed,完全一致,dhcp配置成功!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29320885/viewspace-1062880/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何配置DHCP
- 配置dhcp伺服器伺服器
- Webapck 簡單配置Web
- DHCP常用配置檔案解析
- 【實驗】DHCP、NAT配置案例
- 如何配置DHCP 【知識分享】
- VS code 簡單配置
- logback的簡單配置
- spingMVC框架簡單配置MVC框架
- Web Scraper簡單配置方法Web
- webpack(簡單安裝配置)Web
- windows2003 DHCP伺服器配置Windows伺服器
- 動態主機配置協議DHCP協議
- 在Linux中,如何配置DHCP伺服器?Linux伺服器
- Centos8 如何配置DHCP伺服器CentOS伺服器
- Spirent Testcenter二層DHCP繫結流配置
- 一個簡單多庫配置
- 交換機的簡單配置
- node webpack4.6簡單配置Web
- 理論+實驗:Linux的DHCP原理與配置Linux
- 一個簡單vue.config.js配置和axios簡單封裝VueJSiOS封裝
- 伺服器簡單郵箱配置伺服器
- Elasticsearch 的安裝和簡單配置Elasticsearch
- Django安裝與簡單配置(1)Django
- CentOS 7 以上防火牆簡單配置CentOS防火牆
- Spring Cloud Gateway + Nacos(1)簡單配置SpringCloudGateway
- Kali Linux常用服務配置教程安裝及配置DHCP服務Linux
- DHCP伺服器的優缺點簡介伺服器
- 配置中心之Nacos簡介,使用及Go簡單整合Go
- Kali Linux常用服務配置教程DHCP服務原理Linux
- kali虛擬機器配置dhcp--橋接模式虛擬機橋接模式
- 什麼是DHCP動態主機配置協議協議
- Mybatis【配置檔案】就是這麼簡單MyBatis
- 把玩Alpine linux(三):簡單手動配置Linux
- webpack4簡單實用配置解析Web
- 簡單說說webpack的配置檔案Web
- log4j簡單配置解釋
- Ubuntu-kali配置動態ip(簡單)Ubuntu
- 01 . SaltStack部署配置及簡單應用