配置RIP、OSPF實現全網互通

臭瑱發表於2020-10-02

在這裡插入圖片描述
【實驗需求】
1.二層交換機根據拓撲配置VLAN,將介面加入對應的VLAN ;並配置鏈路聚合,將介面加入鏈路。
2.R2、R3之間配置OSPF,R3、R4、R5之間配置RIP版本2。
3.R1與R2之間配置靜態路由及預設路由。
4.配置重分發,實現全網互通。
5.配置NAT,將伺服器對映到外網介面G0/0/0上

具體命令
SW1:
vlan batch 10 20 30 40
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]qui
[sw1-Eth-Trunk1]quit
[sw1]interface Ethernet0/0/3
[sw1-Ethernet0/0/3]et
[sw1-Ethernet0/0/3]eth-trunk 1
[sw1]interface Ethernet0/0/2
[sw1-Ethernet0/0/2]e
[sw1-Ethernet0/0/2]eth-trunk 1
[sw1]int Eth-Trunk1
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pass vlan all

[sw1]int Ethernet0/0/4
[sw1-Ethernet0/0/4]port link-type access
[sw1-Ethernet0/0/4]port default vlan 10
[sw1-Ethernet0/0/4]interface Ethernet0/0/5
[sw1-Ethernet0/0/5]port link-type access
[sw1-Ethernet0/0/5]port default vlan 20

[sw1]int Ethernet0/0/1
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/1]port trunk allow-pass vlan all

SW2:
vlan batch 10 20 30 40
[sw1]int Eth-Trunk 1
[sw1-Eth-Trunk1]quit
[sw1]interface Ethernet0/0/3
[sw1-Ethernet0/0/3]eth-trunk 1
[sw1]interface Ethernet0/0/2
[sw1-Ethernet0/0/2]e
[sw1-Ethernet0/0/2]eth-trunk 1
[sw1]int Eth-Trunk1
[sw1-Eth-Trunk1]port link-type trunk
[sw1-Eth-Trunk1]port trunk allow-pass vlan all

[sw2]int Ethernet0/0/4
[sw2-Ethernet0/0/4]port link-type access
[sw2-Ethernet0/0/4]port default vlan 30
[sw2-Ethernet0/0/4]quit
[sw2-Ethernet0/0/4]int Ethernet0/0/5
[sw2-Ethernet0/0/5]port link-type access
[sw2-Ethernet0/0/5]port default vlan 40

SW3:
[sw3]vlan batch 50 60
[sw3]int Ethernet0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 50
[sw3-Ethernet0/0/2]quit
[sw3]int
[sw3]interface Ethernet0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 60
[sw3-Ethernet0/0/3]quit
[sw3]int Ethernet0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan all

ISP:
[ISP]int GigabitEthernet 0/0/1
[ISP-GigabitEthernet0/0/1]ip address 192.168.1.254 24
[ISP-GigabitEthernet0/0/1]quit
[ISP]int GigabitEthernet 0/0/0
[ISP-GigabitEthernet0/0/0]ip address 192.168.2.1 24

R2:
[R2]int GigabitEthernet 0/0/2.10

[R2-GigabitEthernet0/0/2.10]dot1q termination vid 10
[R2-GigabitEthernet0/0/2.10]arp broadcast enable
[R2-GigabitEthernet0/0/2.10]ip add 192.168.10.254 24

[R2]int GigabitEthernet 0/0/2.20
[R2-GigabitEthernet0/0/2.20]dot1q termination vid 20
[R2-GigabitEthernet0/0/2.20]arp broadcast enable
[R2-GigabitEthernet0/0/2.20]ip add 192.168.20.254 24

[R2]int GigabitEthernet 0/0/2.30
[R2-GigabitEthernet0/0/2.30]dot1q termination vid 30
[R2-GigabitEthernet0/0/2.30]arp broadcast enable
[R2-GigabitEthernet0/0/2.30]ip add 192.168.30.254 24

[R2]int GigabitEthernet 0/0/2.40
[R2-GigabitEthernet0/0/2.40]dot1q termination vid 40
[R2-GigabitEthernet0/0/2.40]arp broadcast enable
[R2-GigabitEthernet0/0/2.40]ip add 192.168.40.254 24

R4:
[R4]interface GigabitEthernet 0/0/2.50
[R4-GigabitEthernet0/0/2.50]dot1q termination vid 50
[R4-GigabitEthernet0/0/2.50]arp broadcast enable
[R4-GigabitEthernet0/0/2.50]ip address 192.168.50.254 24
[R4-GigabitEthernet0/0/2.50]quit
[R4]int GigabitEthernet 0/0/2.60
[R4-GigabitEthernet0/0/2.60]dot1q termination vid 60
[R4-GigabitEthernet0/0/2.60]arp broadcast enable
[R4-GigabitEthernet0/0/2.60]ip add 192.168.60.254 24

驗證vlan互通
在這裡插入圖片描述
在這裡插入圖片描述
配置介面IP,RIP以及OSPF。
R2:
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
R3:
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3]rip 1
[r3-rip-1]ver 2
[r3-rip-1]network 192.168.4.0
[r3-rip-1]undo summary
R4:
[R4]rip 1
[R4-rip-1]ver 2
[R4-rip-1]network 192.168.4.0
[R4-rip-1]network 192.168.5.0
[R4-rip-1]network 192.168.50.0
[R4-rip-1]network 192.168.60.0
[R4-rip-1]undo summary
R5:
[r5]rip 1
[r5-rip-1]ver 2
[r5-rip-1]network 192.168.5.0
[r5-rip-1]network 192.168.6.0
[R5-rip-1]undo summary
驗證:路由器檢視路由表可以看見各自協議宣告的網段。
3. 外網配置靜態路由。
[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.2
4. 配置重分發,實現全網互通。
[R2]ospf 1
[R2-ospf-1]import-route static
[R2-ospf-1]import-route direct
[r3-ospf-1]rip 1
[r3-rip-1]import-route ospf 1
[r3]ospf 1
[r3-ospf-1]import-route rip 1
驗證:全網可以互通
在這裡插入圖片描述
配置NAT。
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]nat server protocol tcp global 192.168.2.10 www inside 192.168.6.1 www
驗證:可以通過對映的介面訪問到192.168.6.1www伺服器。
在這裡插入圖片描述
在這裡插入圖片描述

相關文章