cisco packet tracer之路由器上配置DHCP服務於不同的VLAN

 

解析:此圖中配置實現的功能是讓內網用戶PC1和PC2(二者屬於不同的VLAN),通過公網地址訪問internet中的www服務器(www.sina.com).

配置如下:

(一)按照圖1.1中所給參數配置各個設備和端口的IP地址。

(二)router的配置

router(config)#int s0/0/0
router(config-if)#ip address 202.1.1.1 255.255.255.0
router(config-if)#ip nat outside
router(config-if)#no shutdown
router(config)#access-list 1 permit 192.168.0.0 0.0.255.255
router(config)#ip nat inside source list 1 interface s0/0/0 overload
router(config)#ip route 0.0.0.0 0.0.0.0 202.1.1.2

(三)ISP的配置:
Router(config)#hostname ISP
ISP(config)#no ip domain-lookup
ISP(config)#line console 0
ISP(config-line)#logging synchronous
ISP(config-line)#int s0/0/0
ISP(config-line)#exec-timeout 0 0
ISP(config-if)#ip address 202.1.1.2 255.255.255.0
ISP(config-if)#no shutdown
ISP(config)#int f0/0
ISP(config-if)#ip address 202.2.2.1 255.255.255.0
ISP(config-if)#int f0/1
ISP(config-if)#ip address 202.3.3.1 255.255.255.0
ISP(config)#ip route 0.0.0.0 0.0.0.0 202.1.1.1

(四)DNS和WWW服務器的配置
           這個大家應該都會吧,本實驗中提供的域名是www.sina.com

(五)交換機的配置
Switch(config)#vlan 2
Switch(config-vlan)#vlan 3
Switch(config-if)#switchport mode trunk
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int f0/3
Switch(config-if)#switchport access vlan 3
(六)在router上配置單臂路由,並啓用DHCP服務功能。
router(config)#int f0/0.1
router(config-subif)#encapsulation dot1Q 2
router(config-subif)#ip address 192.168.1.1 255.255.255.0
router(config)#int f0/0.2
router(config-subif)#encapsulation dot1Q 3
router(config-subif)#ip address 192.168.2.1 255.255.255.0
router(config)#ip dhcp pool vlan2
router(dhcp-config)#network 192.168.1.0 255.255.255.0
router(dhcp-config)#dns-server 202.2.2.2
router(dhcp-config)#default-router 192.168.1.1
router(config)#ip dhcp pool vlan3
router(dhcp-config)#network 192.168.2.0 255.255.255.0
router(dhcp-config)#dns-server 202.2.2.2
router(dhcp-config)#default-router 192.168.2.1
router(config)#ip dhcp excluded-address 192.168.1.1
router(config)#ip dhcp excluded-address 192.168.2.1
router(config)#int f0/0.1
router(config-subif)#ip nat inside
router(config)#int f0/0.2
router(config-subif)#ip nat inside
(七)PC1通過DHCP獲取的參數如圖1.2所示
 

 
                                                                                                 圖1.2      
PC2通過DHCP獲取的參數如圖1.3所示

 
                                                                                      圖1.3
(八)測試
分別打開PC1和PC2的瀏覽器,在地址欄輸入www.sina.com,結果是可以看到網頁的內容。
                                           

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章