六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學習啦 > 學習電腦 > 網絡知識 > 路由器 > 路由器設置 > cisco思科 > cisco dhcp服務器設置

cisco dhcp服務器設置

時間: 春健736 分享

cisco dhcp服務器設置

  網絡交換機的設置方法那是比較多的,要視具體情況而定,有不少網友不知道cisco dhcp服務器怎么設置?下面學習啦小編為大家講解具體設置方法,供你參考!

  cisco dhcp服務器設置具體操作

  配置DHCP服務器實例網絡環(huán)境:一臺2811路由,一臺2950交換機,一臺3560交換機,三臺自動獲取IP地址的PC。

  劃分三個vlan1,vlan2,vlan3。拓撲如下

  配置命令及步驟如下:

  第一步:配置路由成為DHCP服務器

  1、設置地址池 /*有幾個VLAN要設幾個地址池,我們有3個vlan所以要設3個地址池*/

  /*第一個地址池*/

  Switch(Config)#ip dhcp pool test01

  /*建立地址池,test01為名稱~~名字可自己設置

  Switch(Config-pool)#network 192.168.1.0 255.255.255.0

  /*此處為設置要分配的子網,可根據(jù)自己喜好設置

  Switch(Config-pool)#Default-router 192.168.1.254

  /*此處為設置上面分配子網IP的網關,此處和下面要設置的vlan ip相關聯(lián),你想讓哪個vlan分配什么IP子網段

  就要把vlan的IP地址設成該子網的網關

  Switch(Config-pool)#lease 30

  /*租期為30天,可自己改

  Switch(Config-pool)#exit

  /*第二個地址池*/

  Switch(Config)#ip dhcp pool test02

  Switch(Config-pool)#network 192.168.2.0 255.255.255.0

  Switch(Config-pool)#Default-router 192.168.2.254

  Switch(Config-pool)#lease 30

  Switch(Config-pool)#exit

  /*同上

  /*第三個地址池*/

  Switch(Config)#ip dhcp pool test03

  Switch(Config-pool)#network 192.168.3.0 255.255.255.0

  Switch(Config-pool)#Default-router 192.168.3.254

  Switch(Config-pool)#lease 30

  Switch(Config-pool)#exit

  /*同上

  PS:Switch(Config-pool)#domain-name XXXX

  /*此命令是為客戶機配置域后綴,XX為域后綴~比如yonghu.com,這里不使用該命令

  Switch(Config-pool)#Dns-server x.x.x.x

  /*這是設置DNS服務器地址,我們在這里不使用該命令

  Switch(Config-pool)#netbios-name-server x.x.x.x

  /*為客戶機配置wins服務器地址,我們在這里不使用該命令

  Switch(Config-pool)#netbios-node-type h-node

  /*為客戶機配置h節(jié)點模式,我們在這里不使用該命令

  Switch(Config-pool)#ip dhcp pool XXX

  /*此命令為在當前地址池下創(chuàng)建一個子地址池,這個子地址池將繼承域后綴、DNS服務器、

  wins服務器等可繼承的參數(shù) ,一個地址池可以設置多個子池,這樣可以減少很多麻煩,我們在這里不使用該命令

  2、設置DHCP保留不分配的地址 /*可以理解為設置不分配的IP地址,這里可以根據(jù)環(huán)境情況來設置,也可不設置,在此我只是舉例以說明命令作用*/

  Switch(Config)Ip Dhcp Excluded-address 192.168.1.2 192.168.1.10

  /* ip 192.168.1.2至192.168.1.10這9個IP地址服務器不分配出去

  Switch(Config)Ip Dhcp Excluded-address 192.168.2.2 192.168.2.10

  /*同上 192.168.2.2至192.168.2.10不分配

  Switch(Config)Ip Dhcp Excluded-address 192.168.3.2 192.168.3.10

  /*同上 192.168.3.2至192.168.3.10不分配

  PS:一般要把網關地址設成不分配~~比如我們剛才設的子網網關192.168.1.254

  3、設置連接端口IP

  Switch(Config)#fastEthernet 0/4

  Switch(Config-if)#switchport address 192.168.4.2 255.255.255.0

  Switch(Config-if)#no shutdown

  Switch(Config-if)#exit

  4、配置路由表

  Switch(Config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1

  /*要送到192.168.1.0網段的數(shù)據(jù)發(fā)往192.168.4.1 ip地址

  Switch(Config)#ip route 192.168.2.0 255.255.255.0 192.168.4.1

  Switch(Config)#ip route 192.168.3.0 255.255.255.0 192.168.4.1

  Switch(Config)#ip route 192.168.4.0 255.255.255.0 192.168.4.1

  Switch(Config)#exit

  Switch#show ip route

  /*會看到路由表上已經更新:

  PS:這里使用的時靜態(tài)路由~~但是本人推薦用動態(tài)路由~這里只是因為需要設置的IP段比較少所以才選用靜態(tài)路由設置

  但是一般情況下是不會選擇靜態(tài)路由的,特別是IP段特別多得時候,不然設置很麻煩~所以推薦使用動態(tài)路由!命令如下

  Switch(Config)#router rip

  Switch(Config-router)#network x.x.x.x /* x.x.x.x為地址段~~如192.168.1.0

  5、開啟DHCP服務

  Switch(Config)#Service Dhcp

  Switch(Config)#ip dhcp relay information option

  /*這個命令現(xiàn)在很少使用了,個人感覺可有可無,因為已經

  設置helper-address了(下面的三層交換機里設置),但是保險起見打吧- -

  第二步:配置三層交換機3560

  1、創(chuàng)建VLAN:

  Switch>en

  Switch#configure terminal

  Switch(config)#vlan 2

  Switch(config-vlan)#vlan 3

  Switch(config-vlan)#exit

  2、設置vlan的IP 以及相關參數(shù)

  Switch(config)#interface vlan 1

  Switch(config-if)#ip add 192.168.1.254 255.255.255.0

  Switch(config-if)#ip helper-address 192.168.4.2

  Switch(config-if)#no shutdown

  Switch(config-if)#exit

  Switch(config)#interface vlan 2

  Switch(config-if)#ip add 192.168.2.254 255.255.255.0 //IP地址要和DHCP設置子網的網關一樣,

  Switch(config-if)#ip helper-address 192.168.4.2 否則PC無法獲取IP地址且無法通信

  Switch(config-if)#no shutdown

  Switch(config-if)#exit

  Switch(config)#interface vlan 3

  Switch(config-if)#ip address 192.168.3.254 255.255.255.0

  Switch(config-if)#ip helper-address 192.168.4.2 //此處為設置指定dhcp服務器的地址,

  Switch(config-if)#no shutdown 表示通過Ethernet0向該服務器發(fā)送DHCP請求包

  3、設置各個連接端口參數(shù)

  Switch(Config)#Interface fastEthernet 0/4

  Switch(Config)#switchport trunk encapsulation dot1q //二層交換機和三層不一樣,必須先設置數(shù)據(jù)封裝格式

  Switch(Config)#switchport mode trunk //對應二層交換機,形成trunk口實現(xiàn)多vlan通信

  Switch(Config)#Interface fastEthernet 0/1

  Switch(config-if)#no switchport //使端口開啟三層功能,可以理解為變成路由端口

  Switch(config-if)#ip address 192.168.4.1 255.255.255.0

  Switch(config-if)#no shutdown

  Switch(config-if)#exit

  Switch(config)#ip routing //開啟路由功能

  4、設置路由表

  Switch(Config)#router rip //進入動態(tài)路由模式

  Switch(Config-router)#network 192.168.1.0 //自動學習 192.168.1.0網段地址

  Switch(Config-router)#network 192.168.2.0 //同上

  Switch(Config-router)#network 192.168.3.0

  Switch(Config-router)#network 192.168.4.0

  Switch(Config-router)#exit

  /*配置動態(tài)路由后,記得要在特權模式下查看路由表,確保要學的IP地址都已學到

  第三步:配置二層交換機2950

  1、創(chuàng)建VLAN:

  Switch1>en

  Switch1#configure terminal

  Switch1(config)#vlan 2

  Switch1(config-vlan)#vlan 3

  Switch1(config-vlan)#exit

  2、設置端口全局參數(shù)

  Switch1(Config)#Interface Range fastEthernet 0/1 - 3

  /*注意:哪些端口連接PC就設置哪個端口,如果設置的端口是連接交換機或者路由的就有可能造成環(huán)路

  Switch1(Config-if-range)#switchport mode access

  /*此處把端口設成為portfast模式~即不在不再使用STP的算法,也就是說端口從堵塞直接變?yōu)檗D發(fā)

  3、將端口添加到VLAN2,3中(PS:所有端口默認VLAN1~~這個都知道吧~~)

  Switch1(Config)#interface fastethernet 0/2

  Switch1(Config)#switchport access Vlan 2

  Switch1(Config)interface fastethernet 0/3

  Switch1(Config-if-range)#switchport access vlan 3

  4、將F0/4端口設成trunk模式

  Switch1(Config)#interface fastethernet 0/4

  Switch1(Config)#switchport mode trunk

  第四步:設置PC機

  1、 這步很簡單只要吧PC 設成自動獲取IP就好,如下圖

  2、更新DHCP

  打開開始菜單>運行>輸入CMD然后回車,出現(xiàn)命令窗口>輸入ipconfig/renew,然后你就可以看到服務器分給這臺PC的ip地址了:

  PS:到這里就結束了~~本章講得是用路由做DHCP~但其實只要有三層交換機就可以了~~不需要用路由~~在三層交換機做DHCP中繼和在路由上配置命令是一樣的

  學習啦小編分享了cisco dhcp服務器設置的解決方法,希望大家喜歡。

567015