iT邦幫忙

1

OSPF 網路架構

  • 分享至 

  • xImage

https://ithelp.ithome.com.tw/upload/images/20220929/20114199oVJmVOXhum.png
如圖,做OSPF動態路由,想請問各位前輩如果要在紅框內新增一台L3 switch並與SW0、SW1作OSPF動態路由,請教vlan跟IP、OSPF該如何配置呢?
紅框內為Vlan-2 access (192.168.3.0/24),但SW1連接SW2就不知道該如何正確配置了,再請大神們指點一下 ,感謝。
最終目的是想讓PC4(192.168.3.2/24)這台電腦能夠在OSPF的架構下ping通其他台PC。
試了好幾次,都沒成功讓SW1、SW2的OSPFrouting table增加..

附上SW0、SW1的configure:
SW-0
Switch>enable
Switch#conf t
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit

Switch(config)#interface vlan 2
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface range fastEthernet 0/1-2
Switch(config-if-range)#switchport access vlan 2
Switch(config-if-range)#no shutdown
Switch(config-if-range)#exit

Switch(config)#interface vlan 3
Switch(config-if)#ip address 1.1.1.1 255.0.0.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport access vlan 3
Switch(config-if)#no shutdown
Switch(config-if)#exit

SW-1
Switch#conf t
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit

Switch(config)#interface vlan 2
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface range fastEthernet 0/1-2
Switch(config-if-range)#switchport access vlan 2
Switch(config-if-range)#no shutdown
Switch(config-if-range)#exit

Switch(config)#interface vlan 3
Switch(config-if)#ip address 1.1.1.2 255.0.0.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport access vlan 3
Switch(config-if)#no shutdown
Switch(config-if)#exit

SW-1
Switch#conf t
Switch(config)#ip routing
Switch(config)#router ospf 10
Switch(config-router)#network 1.1.1.0 0.0.0.255 area 10
Switch(config-router)#network 192.168.1.0 0.0.0.255 area 10
Switch(config-router)#network 192.168.2.0 0.0.0.255 area 10
Switch(config-router)#exit
----------------------------------------------------show ip route
PC(192.168.1.2)-ping-(PC192.168.2.3)

SW0:
show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
192.168.2.1 1 FULL/BDR 00:00:36 1.1.1.2 Vlan3

SW1:
show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
192.168.1.1 1 FULL/DR 00:00:34 1.1.1.1 Vlan3

SW0:
show ip route
C 1.0.0.0/8 is directly connected, Vlan3
C 192.168.1.0/24 is directly connected, Vlan2
O 192.168.2.0/24 [110/2] via 1.1.1.2, 00:09:53, Vlan3

SW1:
show ip route
C 1.0.0.0/8 is directly connected, Vlan3
O 192.168.1.0/24 [110/2] via 1.1.1.1, 00:10:29, Vlan3
C 192.168.2.0/24 is directly connected, Vlan2

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
I.T. Wang
iT邦新手 2 級 ‧ 2022-09-30 13:29:57
最佳解答

請看一下這是不是你要的結果
https://ithelp.ithome.com.tw/upload/images/20220930/201427939IZXLxVIb2.png

https://ithelp.ithome.com.tw/upload/images/20220930/2014279370WWasIEIJ.png

https://ithelp.ithome.com.tw/upload/images/20220930/20142793CM1IbmIGHW.png

感謝I.T. Wang大神!!
測試有成功!!
但有幾個問題想問,還請不吝解答
1.[network 0.0.0.0 255.255.255.255 同等於用讓ip address全部通過的方式,有其他作法嗎?]
2.在這段影片裡,雖然只有SW0、SW1,但他的OSPF裡個別加了

Switch(config-router)#network 1.1.1.0 0.0.0.255 area 10
Switch(config-router)#network 192.168.1.0 0.0.0.255 area 10

Switch(config-router)#network 1.1.1.0 0.0.0.255 area 10
Switch(config-router)#network 192.168.2.0 0.0.0.255 area 10

想請問用意是甚麼呢?
影片參考:
https://www.youtube.com/watch?v=vWJeFNVOZQM&t=443s

3.我用一樣的方式增加了一台L3 Switch,做了Vlan2、Vlan3
加入了
Switch(config-router)#network 1.1.1.0 0.0.0.255 area 10
Switch(config-router)#network 192.168.2.0 0.0.0.255 area 10
但show ip route卻沒有增加任何路由條目,是為什麼呢?

以上再麻煩大神指導了!!感謝你!!

I.T. Wang iT邦新手 2 級 ‧ 2022-10-03 10:43:48 檢舉

1.network 0.0.0.0是路由全開沒錯,是我做lab比較懶...
當然有很多作法,建議先把CCNA學好學扎實,往上念CCNP自然有其他作法。

2.用意是在ospf網域中,通告網段給鄰居:我有哪些路由。
通告1.1.1.0 / 24區域10給鄰居,我有這筆路由、
通告192.168.1.0 / 24區域10給鄰居,我有這筆路由。
使鄰居與更遠程的節點知道,這兩筆網段的位置在你那裡。

3.不是很懂你的意思...
我先假設你的vlan2、3是SVI(就是有挨批地址的介面),那你show ip route中,vlan2和3是屬於C直連網路,而你提供的指令如我2所述;
如果你的介面有192.168.2.0 / 24,而你的動態路由鄰居(不僅OSPF,EIGRP也可以)也有通告192.168.2.0 / 24給你,
那你的路由表會以直連網路為優先,AD值越小越好,萬一你的192.168.2.0/24介面down了,AD值第二優的路由會自動install進路由表。

希望有回答到你的問題

I.T.Wang 大大!!很感謝你!!之後我有試出來了!!有問題再請教您!!感恩感恩

我要發表回答

立即登入回答