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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- redhat6.2配置本地yumRedhat
- Linux DHCP 配置Linux
- 配置dhcp伺服器伺服器
- 如何配置DHCP 【知識分享】
- DHCP常用配置檔案解析
- Webapck 簡單配置Web
- 簡單配置ASMASM
- VS code 簡單配置
- SELinux簡單配置Linux
- mysql cluster 簡單配置MySql
- squid 簡單配置UI
- PXE+DHCP+TFTP+NFS+Kickstart網路自動安裝配置簡化版FTPNFS
- 動態主機配置協議DHCP協議
- Cisco 3550配置DHCP中繼代理中繼
- 動態主機配置協議(DHCP)協議
- Web Scraper簡單配置方法Web
- spingMVC框架簡單配置MVC框架
- VsCode簡單配置VSCode
- webpack(簡單安裝配置)Web
- LINUX FTP簡單配置LinuxFTP
- Redhat 簡單本地yum 配置Redhat
- Windows下Subversion簡單配置Windows
- VSFTP的簡單配置FTP
- Linux NTP 簡單配置Linux
- Centos8 如何配置DHCP伺服器CentOS伺服器
- 一個簡單多庫配置
- node webpack4.6簡單配置Web
- window下mongodb的簡單配置MongoDB
- 簡單安裝配置lighttpdhttpd
- 簡單的ANT配置檔案
- 簡單配置PostFix伺服器伺服器
- mysql goldengate同步 簡單配置MySqlGo
- postfix安裝和簡單配置
- linux bind dns簡單配置LinuxDNS
- [DHCP服務]——DHCP詳解
- RedHat6.2搭建FTP伺服器RedhatFTP伺服器
- DHCP伺服器的優缺點簡介伺服器
- Django安裝與簡單配置(1)Django