DHCP的配置

                                                       實驗報告DHCP的配置vim

一.實驗拓撲服務器

服務器 ----------      客戶機網絡

 

二.實驗條件。dom

  1. 全部試驗機在相同的網段ide

  2. DHCP服務器有固定的ipspa

三.實驗步驟:rest

  1. 設置iprouter

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0server

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)dns

DEVICE=eth0

BOOTPROTO=none                    //這個選項不用改

HWADDR=00:0C:29:6F:36:09

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=192.168.4.5         //服務器上固定的ip地址

TYPE=Ethernet

USERCTL=no

IPV6INIT=no

PEERDNS=yes

 

[root@localhost ~]# cat /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=tarena.com    //修改用戶名

 

[root@localhost ~]# service network restart    //重啓網絡配置

[root@localhost ~]# chkconfig network on       //重啓配置

 

  1. 檢查安裝dhcp

[root@localhost ~]# rpm -q dhcp       //檢查軟件包是否安裝

package dhcp is not installed                //沒有安裝包的意思

[root@localhost ~]# cd /misc/cd/Server/     

[root@localhost Server]# ls *dhcp*      //搜索dhcp軟件包

[root@localhost Server]# rpm -ivh dhcp-3.0.5-31.el5_8.1.x86_64.rpm  //安裝此包

[root@localhost Server]# rpm -q dhcp

dhcp-3.0.5-31.el5_8.1                     //再次檢查表明本機器已安裝此包

 

  1. 修改配置文件

[root@localhost Server]# vim /etc/dhcpd.conf

ddns-update-style interim;

 2 ignore client-updates;

 3 subnet 192.168.4.0 netmask 255.255.255.0 {   //前面的是網段,後面是的子網

 4         option routers                  192.168.4.254;   //網關

  5         option subnet-mask              255.255.255.0;   //子網

6         option domain-name              "tarena.com";     //名字自定義

  7         option domain-name-servers      202.203.204.200;   //DNS

  8         range dynamic-bootp 192.168.4.10 192.168.4.200;      //地址池網段

  9         default-lease-time 21600;        

 10         max-lease-time 43200;

 11         host ns {

 12                 next-server marvin.redhat.com;

 13                 hardware ethernet 12:34:56:78:AB:CD;   //固定獲取ip的機器的MAC地址

 14                 fixed-address 207.175.42.254;    //固定ip地址

 15         }        

 16 }

[root@localhost Server]# service dhcpd restart

啓動 dhcpd                                               [肯定]

[root@localhost Server]# chkconfig dhcpd on                //兩段全是重啓服務服務的意思

  1. 驗證:

[root@localhost ~]# service network restart     //重啓服務器的網卡設置

[root@localhost ~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 00:0C:29:B8:B7:76      //本機MAC地址

          inet addr:192.168.4.200  Bcast:192.168.4.255  Mask:255.255.255.0    //dhcp獲取得ip地址,通常以最大的開頭,從大到小獲取

          inet6 addr: fe80::20c:29ff:feb8:b776/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:135 errors:0 dropped:0 overruns:0 frame:0

          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:20790 (20.3 KiB)  TX bytes:16392 (16.0 KiB)

[root@localhost ~]# ping 192.168.4.5

PING 192.168.4.5 (192.168.4.5) 56(84) bytes of data.

64 bytes from 192.168.4.5: icmp_seq=1 ttl=64 time=1.84 ms

64 bytes from 192.168.4.5: icmp_seq=2 ttl=64 time=0.291 ms

64 bytes from 192.168.4.5: icmp_seq=3 ttl=64 time=0.266 ms

64 bytes from 192.168.4.5: icmp_seq=4 ttl=64 time=0.280 ms

64 bytes from 192.168.4.5: icmp_seq=5 ttl=64 time=0.284 ms

 

--- 192.168.4.5 ping statistics ---

5 packets transmitted, 5 received, 0% packet loss, time 4003ms

rtt min/avg/max/mdev = 0.266/0.593/1.845/0.626 ms   //能夠ping

  1. 實驗驗證成功.

相關文章
相關標籤/搜索