思科簡單DHCP配置實驗

2021-10-01 03:47:30 字數 3367 閱讀 8676

描述

dhcp(動態主機配置協議)是乙個區域網的網路協議。指的是由伺服器控制一段lp位址範圍,客戶機登入伺服器時就可以自動獲得伺服器分配的lp位址和子網掩碼。預設情況下,dhcp作為windows server的乙個服務元件不會被系統自動安裝,還需要管理員手動安裝並進行必要的配置。

裝置連線

各台主機不需要配置ip,後面通過配置dhcp服務後主機自動獲取ip

配置交換機

switch>enable

switch#config termianl //進入全域性配置模式

switch(config)

#vlan 10 //建立vlan 10

switch(config-vlan)

#exit

switch(config)

#vlan 20

switch(config-vlan)

#exit

switch(config)

#int f0/1 //進入埠f0/1

switch(config-if)

#switchport mode access 設定埠模式為access,access模式只允許乙個vlan通過,trunk 可允許多個vlan通過

switch(config-if)

#switchport access vlan 10 //設定埠允許vlan10 通過

switch(config-if)

#exit

switch(config)

#int f0/2

switch(config-if)

#switchport mode access

switch(config-if)

#switchport access vlan 10

switch(config-if)

#exit

switch(config)

#int f0/3

switch(config-if)

#switchport mode access

switch(config-if)

#switchport access vlan 20

switch(config-if)

#exit

switch(config)

#int f0/4

switch(config-if)

#switchport mode access

switch(config-if)

#switchport access vlan 20

switch(config-if)

#switch(config)

#int g0/1 //進入埠g0/1

switch(config-if)

#switchport mode trunk //設定埠模式為trunk

switch(config-if)

#no shutdown //開啟埠

配置路由器

router>enable

router#

router#config

router(config)

#hostname r1

r1(config)

#ip dhcp excluded-address 202.196.1.1 //從位址池中排除ip202.196.1.1

r1(config)

#ip dhcp excluded-address 202.196.1.129 //從位址池中排除ip202.196.1.129

r1(config)

#ip dhcp pool vlan10 //建立位址池vlan10

r1(dhcp-config)

#network 202.196.1.0 255.255.255.128 //位址範圍

r1(dhcp-config)

#default-router 202.196.1.1 //設定預設閘道器

r1(dhcp-config)

#dns-server 202.196.2.250 分配的dns

r1(dhcp-config)

#exit

r1(config)

#ip dhcp pool vlan20

r1(dhcp-config)

#network 202.196.1.129 255.255.255.128

r1(dhcp-config)

#default-router 202.196.1.129

r1(dhcp-config)

#dns-server 202.196.2.250

r1(dhcp-config)

#r1(dhcp-config)

#exit

r1(config)

#//配置單臂路由,用於實現vlan10與valn20的互通

r1(config)

#int g0/0.1

r1(config-subif)

#encapsulation dot1q 10

r1(config-subif)

#ip add 202.196.1.1 255.255.255.128

r1(config-subif)

#exit

r1(config)

#int g0/0.2

r1(config-subif)

#ip add 202.196.1.129 255.255.255.128

r1(config-subif)

#exit

r1(config)

#int g0/0

r1(config-if)

#no shutdown

r1(config-if)

#

開啟pc獲取ip

測試

下發dhcp閘道器的引數 思科DHCP實驗

r2模擬dhcp server r1模擬pc客戶端 r2 config service dhcp開啟dchp服務 r2 config ip dhcp pool cisco dhcp位址池的名字 r2 dhcp config network 100.1.1.0 255.255.255.0確定網段 r2...

DHCP配置實驗

r1 router enable router configure terminal router config no ip domain lookup router config line console 0 router config line exec timeout 0 0 router c...

思科dhcp以及中繼的配置

配置命令及步驟如下 第一步 建立vlan switch vlan database switch vlan vlan 2 name server switch vlan vlan 3 name work01 switch vlan vlan 4 name work02 第二步 啟用dhcp中繼 關鍵...