第一篇:思科交換機學習第八課:路由器單臂路由配置實現vlan互通
Switch>enable
2960 Switch#configure terminal Switch(config)#vlan 2 Switch(config-vlan)#exit
第一步 創建vlan Switch(config)#vlan 3 Switch(config-vlan)#exit Switch(config)#interface fastEthernet 0/2 Switch(config-if)#switchport access vlan 2 Switch(config-if)#exit Switch(config)#interface fastEthernet 0/3
端口劃分vlan Switch(config-if)#switchport access vlan 3 Switch(config-if)#exit Switch(config)#interface fastEthernet 0/1 Switch(config-if)#switchport mode trunk
交換機跟路由器連接的端口改為trunk Switch(config-if)#exit
Router>enable
開啟路由器端口 Router#configure terminal
Router(config)#interface fastEthernet 0/0 Router(config-if)#no shutdown Router(config-if)#exit Router(config)#interface fastEthernet 0/0.1
進入子端口 Router(config-subif)# %LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
Router(config-subif)#encapsulation dot1Q 2 Router(config-subif)#ip address 192.168.1.1 255.255.255.0 Router(config-subif)#exit Router(config)#interface fastEthernet 0/0.2
進入子端口 Router(config-subif)# %LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
Router(config-subif)#encapsulation dot1Q 3 Router(config-subif)#ip address 192.168.2.1 255.255.255.0 Router(config-subif)#end Router#show ip route
Codes: Cstatic, IRIP, MBGP
DEIGRP external, OOSPF inter area
N1OSPF NSSA external type 2
E1OSPF external type 2, EIS-IS, L1IS-IS level-2, iacandidate default, UODR
P-periodic downloaded static route
Gateway of last resort is not set
C
192.168.1.0/24 is directly connected, FastEthernet0/0.1 C
192.168.2.0/24 is directly connected, FastEthernet0/0.2
dot1q就是802.1q,是vlan的一種封裝方式。
cisco模擬器中dot1Q 2是什么意思? 答
封裝為dot1q,這個是trunk的封裝
后面的2是VLAN ID,指的就是路由下聯的交換機上劃分的VLAN號
第二篇:實驗五利用三層交換機實現VLAN間路由總結
實驗5 利用三層交換機實現VLAN間路由
采用單臂路由的方式實現VLAN間的路由具有速度慢(受到接口帶寬限制)、轉發速率低(路由器采用軟件轉發,轉發速率比采用硬件轉發方式的交換機慢)的缺點,容易產生瓶頸,所以現在的網絡中,一般都采用三層交換機,以三層交換的方式來實現VLAN間的路由。
三層交換機,本質上就是帶有路由功能的二層交換機,我們可以將它簡單地看成是一臺路由器和一臺二層交換機的疊加。三層交換機是將二層交換機和路由器兩者的優勢有機而智能化地結合起來,它可在各個層次提供線速轉發性能。在一臺三層交換機內,分別設置了交換機模塊和路由器模塊;而內置的路由模塊與交換模塊類似,也使用ASIC硬件處理路由。因此,與傳統的路由器相比,三層交換機可以實現高速路由,并且,路由與交換模塊是匯集鏈接的,由于是內部鏈接,可以確保相當大的寬帶。
由于在三層交換機上。IP路由功能是默認開啟的,因此在特權模式下,通過如下步驟,便可以配置SVI(交換虛擬接口)接口實現VLAN間的路由:
1.Switch#configure terminal
進入全局配置模式。
2.Switch(config)#interface vlan vlan-id
進入SVI接口配置模式。
3.Switch(config-if)#ip address ip-address mask
給VLAN的SVI接口配置IP地址。這些IP地址將作為各個VLAN內主機的網關,并且,這些SVI接口所在的網段也會作為直連路由出現在三層交換機的路由表中。
直連路由是指:為三層交設備的接口配置IP地址,并且激活該端口,三層設備會自動產生該接口IP所在網段的直連路由信息。
SVI是指:為交換機中得VLAN創建虛擬接口,并且配置IP地址。4.Switch(config-if)#end 回到特權命令模式。
5.Switch#show running-config 檢查一下剛才的配置是否正確。6.Switch#show ip route 檢查配置SVI接口所在的網段是否已經出現在路由表中。注意:只有當VLAN內有激活的接口時,即有主機連入該VLAN時,該VLAN的SVI接口所在的網段才會出現在路由表中。
7.如果需要保存剛才的配置結果,可以繼續使用write命令或者copy命令保存配置。在交換機網絡中,通過VLAN對一個物理網絡進行邏輯劃分,不同的VLAN之間無法直接訪問的,必須通過三層的路由設備進行連接。一般利用路由器或三層交換機來實現不同VLAN之間的互相訪問。三層交換機和路由器具備網絡層的功能,能夠根據數據的IP包頭信息,進行選路和轉發,從而實現不同網段之間的訪問。
三層交換機實現VLAN互訪的原理是,利用三層交換機的路由功能,通過識別數據包的IP地址,查找路由表進行選路轉發。三層交換機利用直連路由可以實現不同VLAN之間的互相訪問。三層交換機給接口配置IP地址,采用SVI的方式實現VLAN間互聯。
實驗中必須注意的事項:(1)、兩臺交換機之間連接的端口應該設置為tag vlan模式。(2)、為SVI端口設置IP地址后,一定要使用no shutdown命令進行激活,否則無法正常使用。
(3)、如果VLAN內沒有激活端口,相應VLAN的SVI端口將無法被激活。(4)、需要設置PC的網關為相應VLAN的SVI接口地址。
這次的實驗跟實驗三非常相似,只是多了“在三層交換機上配置SVI端口”這一步。
第三篇:成都大學教學用思科交換機路由器配置命令
成都大學思科路由器教學資料 思科Cisco交換機、路由器設置命令 Lzshihj_tz2f_3550
交換機口令設置:
switch>enable ;進入特權模式 switch#config terminal ;進入全局配置模式 switch(config)#hostname
switch(config)#enable secret xxx ;設置特權加密口令為 xxx
switch(config)#enable password xxx ;設置特權非密口令為 xxx
switch(config)#line console 0 ;進控制臺口(Rs232)初始化
switch(config-line)#line vty 0 4 ;進入虛擬終端virtual tty
switch(config-line)#login ;允許登錄
switch(config-line)#password xx ;設置登錄口令xx switch#exit ;返回命令
交換機VLAN設置:
switch#vlan database ;進入VLAN設置 switch(vlan)#vlan 2 ;建VLAN 2 switch(vlan)#no vlan 2 ;刪vlan 2 switch(config)#int f0/1 ;進入端口1 switch(config-if)#switchport access vlan 2 ;當前端口1加入VLAN 2
switch(config-if)#switchport mode trunk ;設置為干線 switch(config-if)#switchport trunk allowed vlan 1,2;設置允許的vlan switch(config-if)#switchport trunk encap dot1q ;設置vlan中繼 switch(config)#vtp domain
交換機設置IP地址:
switch(config)#interface vlan 1 ;進入vlan 1
switch(config-if)#ip address
switch#dir flash: ;查看內存
交換機顯示命令:
switch#write ;寫入保存 switch#show vtp switch#show run ;查看當前配置信息 switch#show vlan ;看VLAN switch#show interface ;顯示所有端口信息
switch#show int f0/0 ;顯示端口0的信息 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 路由器顯示命令:
router#show run ;顯示接口 router#show interface ;顯示接口 router#show ip route ;顯示路由 router#show cdp nei ;看鄰居 router#reload
;重新起動
設置口令:
router>enable ;進入特權模式 router#config terminal ;進入全局配置模式 router(config)#hostname
router(config)#enable secret xxx ;設置特權加密口令為 xxx
router(config)#enable password xxx ;設置特權非密口令為 xxx
router(config)#line console 0 ;進控制臺口(Rs232)初始化
router(config-line)#line vty 0 4 ;進入虛擬終端virtual tty
router(config-line)#login ;允許登錄
router(config-line)#password xx ;設置登錄口令xx router(config)#(Ctrl+z);返回特權模式 router#exit ;返回命令
配置IP地址:
router(config)#int s0/0 ;進行串Serail接口
router(config-if)#no shutdown ;起動接口 router(config-if)#clock rate 64000 ;設置時鐘
router(config-if)#ip address 10.1.1.1 255.255.0.0 ;設置IP地址和子網掩碼
router(config-if)#ip add 10.1.1.2 255.255.0.0 second;
router(config-if)#int f0/0.1;進入子接口 router(config-subif.1)#ip address
router(config)#config-register 0x2142 ;跳過配置文件 router(config)#config-register 0x2102 ;正常使用配置文件 router#reload ;重新引導 復制操作:
router#copy running-config startup-config ;存配置 router#copy running-config tftp ;上載 router#copy startup-config tftp
router#copy tftp flash: ;特權模式下升級IOS
router#copy tftp startup-config
;下載配置文件到nvram
ROM狀態:
Ctrl+Break ;進入ROM監控狀態
rommon>confreg 0x2142 ;跳過配置,26 36 45xx
rommon>confreg 0x2102 ;使用配置,恢復工作狀態
rommon>reset
;重新引導,等效于重開機
rommon>copy xmodem:
rommon>IP_ADDRESS=10.65.1.2 ;設置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;設置路由器掩碼 rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服務器IP
rommon>TFTP_FILE=c2600.bin ;所要下載的文件 rommon>tftpdnld ;ROM監控狀態下升級IOS
rommon>dir flash: ;查看閃存中的內容 rommon>boot ;引導IOS
靜態路由:
ip route
動態路由:
router(config)#ip routing ;啟動路由 router(config)#router rip ;啟動RIP路由協議。router(config-router)#network
router(config-router)#negihbor
幀中繼命令:
router(config)# frame-relay switching ;使能幀中繼交換 router(config-s0)# encapsulation frame-relay ;使能幀中繼
router(config-s0)# frame-relay intf-type DCE ;DCE端(需要配虛電路)
router(config-s0)# frame-relay local-dlci 20 ;配置虛電路號
基本訪問控制列表:
router(config)#access-list
例:
RB(config)#access-list 4 permit 10.8.1.1
RB(config)#access-list 4 deny 10.8.1.0 0.0.0.255
RB(config)#access-list 4 permit 10.8.0.0 0.0.255.255 RB(config)#access-list 4 deny 10.0.0.0 0.255.255.255 RB(config)#access-list 4 permit any RB(config)#int f0/0
RB(config-if)#ip access-group 4 in
擴展訪問控制列表:
access-list
access-list
router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo router(config)#access-list 101 permit ip any any router(config)#int s0/0
router(config-if)#ip access-group 101 in 例2:
router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80 router(config)#access-list 102 permit ip any any router(config)#interface s0/1
router(config-if)#ip access-group 102 out
router(config)#no access-list 102
router(config-if)#no ip access-group 101 in
在路由器上設置 SNMP Community Strings
router(config)# snmp-server community read-community-string ro
router(config)# snmp-server community write-community-string rw
在交換機上設置 SNMP Community Strings
switch(config)# snmp-server community read-community-string ro
switch(config)# snmp-server community write-community-string rw
在路由器上配置日志信息(Syslog Message Logging)
router(config)# logging on
router(config)# logging server-ip-address router(config)# logging trap severity-level 路由器恢復出廠設置
erase start-config 或write erase 或erase NVROM
第四篇:分組交換網絡綜合實驗-劃分子網_及單臂路由的配置報告
分組交換網絡綜合實驗 劃分子網及單臂路由的配置
實驗目的
? 通過這個實驗進一步理解了IP地址的含義,掌握IP地址的分配和劃分子網的方法。? 熟練掌握交換機和路由器的互聯。
? 在大型復雜網絡里熟練使用Vlan的劃分、路由的配置。? 學會配置單臂路由。實驗原理
? 路由器實現單臂路由的配置方法,連接如圖,ROUTE0的F0/0與SWITCH0的F0/1相連,SWITCH的F0/2,F0/3分別與PC0,PC1相連接;ROUTE2的F0/1與SWITCH0的F0/1相連,SWITCH的F0/2,F0/3分別與PC2,PC3相連接.PC0,PC2分到VLAN10,PC1,PC3分到VLAN20。
路由器的配置
? 注意的地方,在子接口先要先描術DOT1Q,再配IP地址,DOT1Q后面的數字是VLAN的號碼,根據交換機的配置不同有所不同
配置router0:
//系統模式 ? Router#configure
terminal
? Router>enable
//配置模式 ? Router(config)#int //端口模式
? Router(config-if)#no shut ? Router(configure-if)#ex ? Router(config)#int f1/0.1
? Router(config-subif)#encapsulation //綁定Vlan10
? Router(config-subif)#ip
add 255.255.255.0
? Router(config-subif)#exit ? Router(config)#int f1/0.2
? Router(config-subif)#encapsulation //綁定Vlan20 ? Router(config-subif)#ip
add 255.255.255.0
? Router(config-subif)#exit
f1/0
dot1q 10
192.168.1.254
dot1q 20
192.168.2.254
? Router(config)#exit
? Router#copy
run star
//router#copy running-config startup-config ;保存配置的簡寫
配置router2:同理可得
f0/1.1 ip 192.168.3.254 f0/1.2 ip 192.168.4.254 配置switch: 設置PC:
PC0:192.168.1.1網關192.168.1.254 PC1:192.168.2.1網關192.168.2.254 PC2:192.168.3.1網關192.168.3.254 PC3:192.168.4.1網關192.168.4.254 設置router:
Router0:f 0/1 ip 192.168.5.1 Router1:f 0/0 ip 192.168.5.2 Router1:f 0/1 ip 192.168.6.1 Router2:f 0/0 ip 192.168.6.2
設置路由表:用RIP方式。測試結果: