#################### 系統命令 #################### system-view sysname display current-configuration undo info-center enable description TO-R1-E0/0/1 #################### PC的IP #################### ## 首先配PC機的IP,使用圖形界面 #################### 保存 #################### return save y #################### 配置access口VLAN #################### vlan 10 #或者 vlan batch 10 20 quit ##修改描述信息 interface Ethernet 0/0/1 description TO-R1-E0/0/1 port link-type access port default vlan 10 quit ##注意修改描述信息 interface Ethernet 0/0/2 description TO-R1-E0/0/1 port link-type access port default vlan 10 quit #################### 配置trunk口VLAN #################### port link-type trunk port trunk allow-pass vlan 10 quit #################### 端口聚合 #################### interface Eth-Trunk1 quit interface GigabitEthernet 0/0/2 description TO-R1-E0/0/1 Eth-Trunk1 quit interface GigabitEthernet 0/0/3 description TO-R1-E0/0/1 Eth-Trunk1 quit interface Eth-Trunk1 port link-type trunk port trunk pvid vlan 30 port trunk allow-pass vlan 2 to 4094 #################### 交換機 下掛 路由器 #################### ##路由器上 VLAN20: interface GigabitEthernet 0/0/0.1 description TO-R1-E0/0/1 vlan-type dot1q 20 ip address 10.1.1.1 30 ##交換機上 vlan 20 quit interface GigabitEthernet 0/0/2 description TO-R1-E0/0/1 port link-type trunk port trunk allow-pass vlan 20 quit ## 交換機的上游(路由器一端) interface Vlanif20 ip address 10.2.2.2 30 ## 交換機的下游(PC一端) vlan 10 interface GigabitEthernet 0/0/1 description TO-R1-E0/0/1 port link-type access port default vlan 10 quit ##與VLAN綁定的三層接口,網關地址 interface Vlanif10 ip address 10.10.3.3 30 #################### 靜態路由 #################### ##路由器上 system-view ip routing-table 192.168.1.2 32 192.168.2.1 display ip routing-table #################### 動態路由OSPF #################### ## 整體步驟: ## 先配Router-ID ## 建立OSPF進程(注意進程號) ## 將接口宣告到某個area中 ## 1、先配PC機的IP ## 2、配路由器各個接口上的IP(注意loopback0): interface GigabitEthernet 0/0/0 description TO-R1-E0/0/1 ip address 172.16.1.1 24 quit interface loopback 0 ip address 1.1.1.1 32 ## 3、配置OSPF ## 先建立OSPF進程號,再進入一個area,在此area中宣告網絡 ## network 用反掩碼,每一位用255減 router id 1.1.1.1 ospf 1 area 1 network 172.16.1.0 0.0.0.255 network 1.1.1.1 0.0.0.0 quit display this ##重複此過程: router id 2.2.2.2 ospf 1 area 1 network 172.16.2.4 0.0.0.3 network 172.16.2.4 0.0.0.3 network 172.16.2.4 0.0.0.3 quit area 2 network 172.16.2.4 0.0.0.3 network 172.16.2.4 0.0.0.3 network 172.16.2.4 0.0.0.3 quit ##檢查: display ospf peer brief #################### 將非OSPF的端口注入OSPF #################### ospf import-route direct #################### Stub和nssa #################### # stub:不向外發送路由信息 # nssa:能夠向外發送路由信息 # 配置方法: ospf 1 area 1 stub #################### 靜態路由的路由備份 #################### ## 在路由器B上配置到達路由器A的10.1.1.1網段的備份路由 ip route-static 10.1.1.1 255.255.255.255 2.2.2.1 preference 100 # preference越小,越優先