# 20200930 Introduction Router Setting

## 課堂資料

#### Cisco router 基本設定：

{% embed url="https://giboss.pixnet.net/blog/post/26807628" %}

#### Administrative Distance (AD) 管理距離：

{% embed url="https://www.jannet.hk/zh-Hant/post/administrative-distance-ad/" %}



![模式切換](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJPaIeTF9Qy8_SEVIWm%2F-MJPgLOtl36ecYFRqFuh%2FComputer%20Network%20-%20.jpg?alt=media\&token=82f2bba8-7dfc-4820-8e3d-af23a36e107f)

* **User Mode：一般使用者模式**
* **Priviledged Mode：特權模式**
* **Config Mode：設定模式**

## 課堂練習

### 設定Router ( R2 與 R1 設定相同 )

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRuf4LLGOa-39rRVqj%2F00.png?alt=media\&token=5641109f-6a01-4262-be61-618615c9bea7)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRuh_12lREJNcGFzhi%2F01.png?alt=media\&token=f7cfa326-668c-4c18-923b-e9743c0dad35)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRujwBXrYf7CyoHqgW%2F02.png?alt=media\&token=43882d32-55a7-40af-9f80-cac6067eba95)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRum8ByFA3bJqM4-SZ%2F03.png?alt=media\&token=1904c108-8417-4b2a-bf85-aa80a527d90d)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRuqeIA_WJVaKS5OHX%2F04.png?alt=media\&token=e88fd7df-3c8e-4479-89e6-9facdd5aaba5)

> 進入特權模式

```
enable
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRusYxFaqCxWu98is8%2F05.jpg?alt=media\&token=7a158c85-b7d9-4082-ba81-8175654184a2)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRutxe8rmgGe0vt2FW%2F06.jpg?alt=media\&token=89e3ae69-07a9-476a-b8fc-30f8f1da92d0)

> 進入設定模式

```
conf t
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRuwCOxjYChJsZlyhk%2F07.jpg?alt=media\&token=093052af-1001-4b8c-86de-0b9192e10936)

設定路由名稱

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

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRuyWuRSTUJOsJLeFU%2F08.jpg?alt=media\&token=cc2c0a88-8b50-4a63-91d8-f1156c90e13a)
{% endtab %}

{% tab title="R2" %}
```
hostname R2
```
{% endtab %}
{% endtabs %}

> 離開超級模式

```
^Z
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRv-_feJOvoNBT5FqN%2F09.jpg?alt=media\&token=a617ca8e-6737-48c1-9c28-4232e45623a4)

{% hint style="info" %}
#### `^Z：ctrl + z`
{% endhint %}

> 寫入快取

```
writ

// write memory
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRv1bigfeRJdOgCuXG%2F10.jpg?alt=media\&token=64087c1a-4c4d-463e-9424-e5c7ec166498)

> 進入介面進行設定

```
int e0/0
```

> 避免進行關機作業

```
no shutdown
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MIRb2JFz-eO3RRp49MQ%2F-MIRv4M6FGTL-JzGwjs7%2F11.jpg?alt=media\&token=734ac1dd-9054-432b-9cba-a6b1309d3653)

{% tabs %}
{% tab title="R1" %}
> 設定 R1&#x20;

```
ip addr 12.1.1.1 255.255.255.0
```

> 取消 R1 IP

```
no ip addr 12.1.1.1 255.255.255.0
```

{% hint style="danger" %}
IP 前面加個 no 同等取消 IP
{% endhint %}

> 顯示每一個路由器的 IP 位置資訊

```
show ip int brief
```

![新增 R1 IP](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJ-xYluGXjK5yRCX541%2F-MJ0-5-u8_lqVfPSLM-Q%2F12.jpg?alt=media\&token=dd30698f-a873-42dc-835a-555bd220fab6)

![取消 R1 IP](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJxF99_x1mNWHMfppcI%2F-MJxFZnBCaCq4OSdVvcE%2F19.jpg?alt=media\&token=43f195aa-10f0-4f85-84c8-f7f41a45f5bf)

> R1 ping R2

```
ping 12.1.1.2
```
{% endtab %}

{% tab title="R2" %}
> 設定 R2

```
ip addr 12.1.1.2 255.255.255.0
```

> 取消R2 IP

```
no ip addr 12.1.1.2 255.255.255.0
```

{% hint style="danger" %}
IP 前面加個 no 同等取消 IP
{% endhint %}

> 顯示每一個路由器的 IP 位置資訊

```
show ip int brief
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJ-xYluGXjK5yRCX541%2F-MJ0-99yhuVdN4GPEdY6%2F13.jpg?alt=media\&token=19b8f961-2f08-4365-8cf4-667a020e9b4a)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJxF99_x1mNWHMfppcI%2F-MJxGHHqytsLgdHeOVFz%2F20.jpg?alt=media\&token=501f88c4-3259-4d09-b6cd-3f14104043be)

> R2 ping R1

```
ping 12.1.1.1
```
{% endtab %}
{% endtabs %}

#### 設定enable 密碼

> 設定密碼

```
enable password [密碼]
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJwVYXvGvLR0R60H3P4%2F-MJx7f9GG5U33-fyxWOH%2F14.jpg?alt=media\&token=86cbf68d-080e-439e-827e-5f37616205fd)

> 登入enable

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJwVYXvGvLR0R60H3P4%2F-MJx8JPxcSxlSPnXt3QV%2F15.jpg?alt=media\&token=127935e6-029c-44ee-9c9a-2fdf9617baa3)

{% hint style="warning" %}
在離開特權模式並重新登入後，需輸入enable 密碼進行登入
{% endhint %}

#### 設定輔助密碼(aux)

{% hint style="success" %}
允許使用Console線以Telnet方式登入
{% endhint %}

>

```
line aux 0
```

> 設定密碼

```
password [密碼]
```

> 登入

```
login
```

>

```
transport input telnet
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJwVYXvGvLR0R60H3P4%2F-MJxCQ4AmnNvkg0uEbiI%2F17.jpg?alt=media\&token=3daeee11-9217-446c-b12d-5528f056e38f)

>

```
show run
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJwVYXvGvLR0R60H3P4%2F-MJxBmR-HQMT79jnt0MP%2F16.jpg?alt=media\&token=ced81126-09fa-4962-8c56-dfb086da80eb)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJwVYXvGvLR0R60H3P4%2F-MJxCxkKqyMkuByCF5lf%2F18.jpg?alt=media\&token=1a14de0f-4a69-4960-9287-8a5ef3e3972c)



#### VPC

> 新增VPC節點

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJxF99_x1mNWHMfppcI%2F-MJxHiYfviqsMpp81kN0%2F21.jpg?alt=media\&token=68a66f71-0358-43f2-9276-891242c718ad)

> 進入 e0/1 介面

```
int e0/1
```

> 新增 e0/1 IP&#x20;

```
ip addr 192.168.1.1 255.255.255.0
```

>

```
no shutdown
```

> 查詢已設置IP

```
do sh ip int brief
```

{% hint style="danger" %}
設定模式下若要查詢 IP，在 show 之前加上 do 即可
{% endhint %}

> 新增 VPC IP

```
ip dhcp
```

> 查詢

```
sh ip
```

> ping

```
ping 192.168.1.1

ping 12.1.1.2

ping 12.1.1.1
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MJxJxOgft0AZsZWX4sF%2F-MJxOok-SJBAgPD8wbeB%2F26.jpg?alt=media\&token=0a644a62-3195-4e3e-89f3-5a4f02c789e5)

#### R1、R2

> 特權模式下 debug ip

```
debug ip icmp
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MK0B_Szt03FARkcSW3k%2F-MK0Q7u18dNT8KDfcLUT%2F29.jpg?alt=media\&token=4a7bf7a3-90ae-4751-9220-6265195430a6)

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MK0B_Szt03FARkcSW3k%2F-MK0PQaVv5_gqwZtv5Ff%2F28.jpg?alt=media\&token=4ec416c8-2dc9-4fa6-afea-3e8f5ab7fe5e)

{% tabs %}
{% tab title="R1" %}
#### 查詢路由IP

```
ip route ?
```

>

```
ip route 2.2.2.2 255.255.255.255 12.1.1.2
```

>

```
ip route 3.3.3.3 255.255.255.255 12.1.1.2
```

>

```
ip route 192.168.1.0 255.255.255.0 12.1.1.2
```

>

```
do ping 2.2.2.2
```
{% endtab %}
{% endtabs %}
