實驗要求:PC1和PC2通過DHCP服務器獲取地址
PC機和服務器能夠連接到外網
PC機可以遠程管理交換機
首先配置DHCP服務器:(拓撲中交換機 pc 服務器均用思科3640路由器模擬)n
conf t
server dhcp
ip dhcp pool vlan10
network 192.168.10.0 /24
default-router 192.168.10.254 (給動態地址分配網關)
ip dhcp pool vlan20
network 192.168.20.0 /24
defaut-router 192.168.20.254
ip dhcp excluded-address 192.168.10.254 (給PC分配地址時 排除網關地址)
ip dhcp excluded-add 192.168.20.254
int f0/0
ip add 192.168.100.100 255.255.255.0
no sh
PC1:
conf t
no ip routing
int f0/0
ip add dhcp (PC2同此操作)
JR_switch1:
vlan database
vlan 10
vlan 20
vlan 255 (管理vlan)
int vlan 255
ip add 192.168.255.1 255.255.255.0
no sh
ip default-gataway 192.168.255.254
int f0/0
switchport mode access
sw access vlan 10
int f0/1
sw mode trunk
int f0/3
sw mode trunk
JR_switch2 (類似操作)
HX_switch(三層交換機):
int f0/3
sw mo trunk
int f0/2
sw mo trunk
vlan database
vlan 10
vlan 20
vlan 255
int vlan 10
ip add 192.168.10.254 255.255.255.0
ip help-address 192.168.100.100 (DHCP中繼)
no sh
int vlan 20
ip add 192.168.20.254 255.255.255.0
ip help-address 192.168.100.100
int vlan 255
ip add 192.168.255.254 255.255.255.0
no sh
int f0/0
no switchport (由於是模擬器模擬的三層交換機 用此命令開啓三層端口 真機不需此命令)
ip add 192.168.254.1 255.255.255.0
no sh
ip route 0.0.0.0 0.0.0.0 192.168.254.2
ip route 192.168.100.0 255.255.255.0 192.168.255.253(SVI接口地址)
HJ_switch:
vlan database
vlan 100
vlan 255
int vlan 100
ip add 192.168.100.254 255.255.255.0
no sh
int vlan 255
ip add 192.168.255.253 255.255.255.0
no sh
int f0/0
sw mo access
sw access vlan 100
int f0/3
sw mode trunk
ip route 0.0.0.0 0.0.0.0 192.168.255.254 (一般匯聚層交換機都處於邊界 所以配置了默認路由)
邊界路由器OR:
int f0/0
ip add 192.168.254.2 255.255.255.0
ip nat inside
no sh
int s1/0
ip add 202.101.100.1 255.255.255.0
ip nat outside
no sh
acce-list 1 permit any
ip nat pool ccnp 202.101.100.1 202.101.100.1 netmask 255.255.255.0
ip nat inside source list 1 pool ccnp overload (PAT的配置)
ip route 192.168.0.0 255.255.0.0 192.168.254.1 (配置路由到達內網)
ip route 0.0.0.0 0.0.0.0 202.101.100.2 (配置默認路由去外網)
ISP路由器:
int s0/0
ip add 202.101.100.2 255.255.255.0
no sh
int lo0
ip add 3.3.3.3 255.255.255.0 (測試用)
no sh
基本配置已經完成了 現在進行DHCP測試,之前我們PC機是沒有配置IP的 現在 sh ip int bri 查看
PC獲取地址後 對服務器、外網以及交換機的telnet測試如下:
這個實驗看起來比較簡單,其實裏面有很多小細節要注意,比如說JR_switch1爲什麼要配置vlan20?三層交換機之間的路由以及DHCP的中繼等細節需注意。上面這個拓撲以及簡化了,其實現實環境中上圖就是一個典型的小型園區網,還必須得進行冗餘和負載均衡的配置以及channel端口的啓用,以達到穩定網絡提高傳輸速率。