20201223 cisco 單臂路由

課堂資料

單臂路由器:是指與網路有單一物理或邏輯連接的路由器。
它通常用於在本地連接的主機之間轉發獨立邏輯路由域上的流量,或者方便路由表的管理、分發和中繼。

課堂練習

單臂路由

VPC3
VPC4
SW
R2
ip 192.168.10.1/24

設定 Gateway

ip 192.168.10.1 255.255.255.0 192.168.10.254
ping 192.168.10.254
ping 192.168.20.254
ping 192.168.20.1
ip 192.168.20.1/24

設定 Gateway

ip 192.168.20.1 255.255.255.0 192.168.20.254
ping 192.168.10.254
ping 192.168.20.254
ping 192.168.10.1
vlan 10
vlan 20
do sh vlan brief
int e0/1
switchport mode access
switchport access vlan 10
int e0/2
switchport mode access
switchport access vlan 20
do sh vlan brief
int e0/0

設定 trunk 的 encapsulation

switchport trunk encapsulation dot1q
switchport mode trunk
do sh run
int e0/0
no shut
int e0/0.10
encapsulation dot1Q 10
ip add 192.168.10.254 255.255.255.0
no shut
int e0/0.20
encapsulation dot1Q 20
ip add 192.168.20.254 255.255.255.0
no shut
do sh run
VPC7
VPC8
SW L3
SW
ip 192.168.10.1/24

設定 Gateway

ip 192.168.10.1 255.255.255.0 192.168.10.254
ping 192.168.10.254
ping 192.168.20.254
ping 192.168.20.1
ip 192.168.20.1/24

設定 Gateway

ip 192.168.20.1 255.255.255.0 192.168.20.254
ping 192.168.10.254
ping 192.168.20.254
ping 192.168.10.1
int vlan 10
ip add 192.168.10.254 255.255.255.0
no shut
int vlan 20
ip add 192.168.20.254 255.255.255.0
no shut
do sh ip int brief
int e0/0

設定 trunk 的 encapsulation

switchport trunk encapsulation dot1q
switchport mode trunk
exit
vtp mode server
vtp domain ccna
vlan 10
vlan 20
do sh vlan brief
do sh run
int e0/1
switchport mode access
switchport access vlan 10
int e0/2
switchport mode access
switchport access vlan 20
do sh vlan brief

實戰練習:VRF

R1
R2
R3
R4
R5
R6
int e0/0
ip addr 192.168.1.1 255.255.255.0
no shut
router ospf 1
net 192.168.1.0 0.0.0.255 area 0
ping 192.168.2.1
int e0/0
ip addr 192.168.2.1 255.255.255.0
no shut
router ospf 1
net 192.168.2.0 0.0.0.255 area 0
int e0/0
ip addr 192.168.3.1 255.255.255.0
no shut
router ospf 1
net 192.168.3.0 0.0.0.255 area 0
int e0/0
ip addr 192.168.4.1 255.255.255.0
no shut
router ospf 1
net 192.168.4.0 0.0.0.255 area 0
ip vrf Upper
ip vrf Lower
int e0/0
ip vrf forwarding Upper
ip addr 192.168.1.2 255.255.255.0
no shut
int e0/1
ip vrf forwarding Lower
ip addr 192.168.3.2 255.255.255.0
no shut
int e0/2
no shut
int e0/2.10
ip vrf for Upper
encapsulation dot1Q 10
ip addr 56.1.1.1 255.255.255.0
int e0/2.20
ip vrf for Lower
encapsulation dot1Q 20
ip addr 56.3.3.3 255.255.255.0
do sh ip vrf
do sh ip route vrf Upper
do sh ip route vrf Lower
router ospf 1 vrf Upper
net 192.168.1.0 0.0.0.255 area 0
net 56.1.1.0 0.0.0.255 area 0
router ospf 2 vrf Lower
net 192.168.3.0 0.0.0.255 area 0
net 56.3.3.0 0.0.0.255 area 0
ip vrf Upper
ip vrf Lower
int e0/0
ip vrf forwarding Upper
ip addr 192.168.2.2 255.255.255.0
no shut
int e0/1
ip vrf forwarding Lower
ip addr 192.168.4.2 255.255.255.0
no shut
int e0/2
no shut
int e0/2.10
ip vrf for Upper
encapsulation dot1Q 10
ip addr 56.1.1.2 255.255.255.0
int e0/2.20
ip vrf for Lower
encapsulation dot1Q 20
ip addr 56.3.3.4 255.255.255.0
do sh ip vrf
do sh ip route vrf Upper
do sh ip route vrf Lower
router ospf 1 vrf Upper
net 192.168.2.0 0.0.0.255 area 0
net 56.1.1.0 0.0.0.255 area 0
router ospf 2 vrf Lower
net 192.168.4.0 0.0.0.255 area 0
net 56.3.3.0 0.0.0.255 area 0