> For the complete documentation index, see [llms.txt](https://anida-huang.gitbook.io/computer-network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anida-huang.gitbook.io/computer-network/qi-mo/20201216-cisco-chan-bi-lu-you.md).

# 20201223 cisco 單臂路由

## 課堂資料

單臂路由器：是指與網路有單一物理或邏輯連接的路由器。

它通常用於在本地連接的主機之間轉發獨立邏輯路由域上的流量，或者方便路由表的管理、分發和中繼。

## 課堂練習

### 單臂路由

![](/files/-MPCJ-CEVL3tjjHP6q4j)

{% tabs %}
{% tab title="VPC3" %}

```
ip 192.168.10.1/24
```

> #### 設定 Gateway

```
ip 192.168.10.1 255.255.255.0 192.168.10.254
```

![](/files/-MPCQACuEPrKqSv0MG6d)

```
ping 192.168.10.254
```

```
ping 192.168.20.254
```

```
ping 192.168.20.1
```

![](/files/-MPCUyY4wkWS_ORre3OZ)
{% endtab %}

{% tab title="VPC4" %}

```
ip 192.168.20.1/24
```

> #### 設定 Gateway

```
ip 192.168.20.1 255.255.255.0 192.168.20.254
```

![](/files/-MPCQRicvS8g_7ThtlDn)

```
ping 192.168.10.254
```

```
ping 192.168.20.254
```

```
ping 192.168.10.1
```

![](/files/-MPCVE_t2LVgEAnlQaU6)
{% endtab %}

{% tab title="SW" %}

```
vlan 10
```

```
vlan 20
```

```
do sh vlan brief
```

![](/files/-MPCQt-caKQ3bPDYnX01)

```
int e0/1
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/2
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
do sh vlan brief
```

![](/files/-MPCREh1_7pPgGDk25Qp)

```
int e0/0
```

> #### 設定 trunk 的 encapsulation

```
switchport trunk encapsulation dot1q
```

```
switchport mode trunk
```

![](/files/-MPCSpP6V1Na1PGUyxuB)

```
do sh run
```

![](/files/-MPCUiKIXkloJjtROw33)
{% endtab %}

{% tab title="R2" %}

```
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
```

![](/files/-MPCUJhjz3XNYZ8lIKVs)

```
do sh run
```

![](/files/-MPCU_Wm16SbAG8lvuBV)
{% endtab %}
{% endtabs %}

![](/files/-MPC_l46CT_GjrNYCtP_)

{% tabs %}
{% tab title="VPC7" %}

```
ip 192.168.10.1/24
```

> #### 設定 Gateway

```
ip 192.168.10.1 255.255.255.0 192.168.10.254
```

![](/files/-MPC_zjc5Y7tQSpqMDYi)

```
ping 192.168.10.254
```

```
ping 192.168.20.254
```

```
ping 192.168.20.1
```

![](/files/-MPCeBhugtu06qFfV2se)
{% endtab %}

{% tab title="VPC8" %}

```
ip 192.168.20.1/24
```

> #### 設定 Gateway

```
ip 192.168.20.1 255.255.255.0 192.168.20.254
```

![](/files/-MPCaBQCwhEXvV4N1oVc)

```
ping 192.168.10.254
```

```
ping 192.168.20.254
```

```
ping 192.168.10.1
```

![](/files/-MPCeVAd4AmnkUNH3JcW)
{% endtab %}

{% tab title="SW L3" %}

```
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
```

![](/files/-MPCcl7D7ViiKpe2QLjx)

```
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
```

![](/files/-MPCd6bYhfh-X4kzmth3)

```
do sh run
```

![](/files/-MPCdGiArnvqZwJh2Ida)
{% endtab %}

{% tab title="SW" %}

```
int e0/1
```

```
switchport mode access
```

```
switchport access vlan 10
```

```
int e0/2
```

```
switchport mode access
```

```
switchport access vlan 20
```

```
do sh vlan brief
```

![](/files/-MPCdktS_HTq6wsUlUVq)
{% endtab %}
{% endtabs %}

### 實戰練習：VRF

![](/files/-MQHbdlf4yDhlmixRSUM)

{% tabs %}
{% tab title="R1" %}

```
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
```

![](/files/-MQHcBwRUOKnF5akLvYY)

```
ping 192.168.2.1
```

{% endtab %}

{% tab title="R2" %}

```
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
```

![](/files/-MQHctTn1ahBbiZ4cbpb)
{% endtab %}

{% tab title="R3" %}

```
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
```

![](/files/-MQHdOr6dHy3RMoLge-V)
{% endtab %}

{% tab title="R4" %}

```
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
```

![](/files/-MQHdnuvjlf40IqR9_u3)
{% endtab %}

{% tab title="R5" %}

```
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 
```

![](/files/-MQHeer0o_quRRLUEgA4)

```
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
```

![](/files/-MQHerq7L2MxerBAwUrU)
{% endtab %}

{% tab title="R6" %}

```
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 
```

![](/files/-MQHfktwnUAWCqUIscYm)

```
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
```

![](/files/-MQHftZnGi77Yk_U069h)
{% endtab %}
{% endtabs %}
