# 20201230 cisco STP

## 課堂資料

{% embed url="<https://www.jannet.hk/zh-Hant/post/spanning-tree-protocol-stp/>" %}

{% embed url="<https://www.jannet.hk/zh-Hant/post/etherchannel-pagp-lacp/>" %}

{% embed url="<https://www.jannet.hk/zh-Hant/post/authentication-authorization-accounting-aaa/>" %}

{% embed url="<https://www.twblogs.net/a/5c220b1bbd9eee16b4a769ce>" %}

{% file src="<https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlCvMNZ0H3hk6a-rEx%2F-MPlD_kh1uZROUdv09lM%2FSpanningTree.pdf?alt=media&token=5359074b-f473-467b-a4e0-c635d1737e15>" %}

### FDB

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlCvMNZ0H3hk6a-rEx%2F-MPlJ3YsPyif0XvMyl6x%2FComputer%20Network%20-%20SpanningTree.jpg?alt=media\&token=7e180468-94db-430d-8163-d70c2a08e124)

### Spanning Tree Steps

* **Find the Root Bridge**
  * 最小：priority ( 可手動設定，預設值&#x70BA;**`32768 + Vlan ID`**) + MAC address
* **Find the Root Port**

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlCvMNZ0H3hk6a-rEx%2F-MPlL-7Ia3c27EtCuSuO%2Fimage.png?alt=media\&token=663f6655-a757-4aa8-87d0-9b28a3a9a85d)

* **Find the Designated Port ( D Port )**

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlCvMNZ0H3hk6a-rEx%2F-MPlL733m8U-MtIhhhrt%2Fimage.png?alt=media\&token=f51eccab-0d5c-4328-bc22-a39ff0352e19)

### AAA Tacacs

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlVacvlXWK2creMSMG%2Fimage.png?alt=media\&token=da13766e-de12-4513-9bbb-4e879bfddea6)

## 課堂練習

### STP

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlSOOSlnTgT7ZawMnT%2Fimage.png?alt=media\&token=045aff55-a550-4fb7-aa52-758fd5c188dc)

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

```
do sh spanning-tree
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlPSpaIUC6G4NmV4HC%2Fimage.png?alt=media\&token=bdfb0f00-1560-4685-8b82-b81253024510)
{% endtab %}

{% tab title="sw2" %}

```
do sh spanning-tree
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlPrm-mtt6Ys7SID3n%2Fimage.png?alt=media\&token=b677972b-44f6-4387-8290-5dc3debc529f)
{% endtab %}

{% tab title="sw3" %}

```
do sh spanning-tree
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlQ6VycFlUnrQZ9vyT%2Fimage.png?alt=media\&token=23d1ae7e-e8e6-4777-ba04-5a3a50bd5fee)

{% endtab %}

{% tab title="VPC4" %}

```
ip 192.168.1.1 255.255.255.0
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlQVIZwiNWvEfTl8mw%2Fimage.png?alt=media\&token=d359e401-c265-4007-8c2d-2e0d0ddcaa42)

```
ping 192.168.1.2
```

{% endtab %}

{% tab title="VPC5" %}

```
ip 192.168.1.2 255.255.255.0
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlQaSLI7ItUxCjQa25%2Fimage.png?alt=media\&token=5290897f-57f4-4647-9309-09b2ad41ee8d)

```
ping 192.168.1.1
```

{% endtab %}
{% endtabs %}

### Ether Channel

###

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlTrshnkKK-0HNkwpf%2Fimage.png?alt=media\&token=8ba7360b-f693-4101-bb2b-5a25794fa63c)

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

```
int range e0/0 - 1
```

```
channel-group 1 mode on
```

```
do sh etherchannel summary
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlUKbZQqZKOS7Qy9IU%2Fimage.png?alt=media\&token=cd78672d-6ce5-44ba-a205-7ffc73069e1e)

```
do sh spanning-tree
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlV0nXf1tKcqjbyQDi%2Fimage.png?alt=media\&token=f06f5312-23a1-4447-9b58-b712d8c37c2d)
{% endtab %}

{% tab title="sw7" %}

```
int range e0/0 - 1
```

```
shut
```

```
channel-group 1 mode on
```

```
no shut
```

```
do sh etherchannel summary
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlUhdSwEHZhR_pnZJC%2Fimage.png?alt=media\&token=ae65feba-0cea-4887-a775-8636ca5e2ce0)

```
do sh spanning-tree
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlVLaOsyQ30oy1Ea82%2Fimage.png?alt=media\&token=ad61f065-0bc5-4d52-a9a4-4e289caabaf5)
{% endtab %}
{% endtabs %}

### AAA Tacacs

#### Part 01.

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlLhOGFW2Ffwz5lHwP%2F-MPlXNHTfUPtP5FNhqkX%2Fimage.png?alt=media\&token=2eb53a6d-bb19-4c47-b804-57c48d1a5237)

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

```
wget ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F4.0.4.28.tar.gz
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlY6OhkC00B3ggeahW%2Fimage.png?alt=media\&token=a3f9ecae-dca1-45e5-a7bc-9bd91968a437)

```
tar zxvf tacacs-F4.0.4.28.tar.gz
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlYt0T29gmBKsKrsPB%2Fimage.png?alt=media\&token=0975f1c0-d0db-4347-9952-9b0e27218160)

```
cd tacacs-F4.0.4.28
```

```
./configure
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlZAL63pQYZ6y7sGDw%2Fimage.png?alt=media\&token=e11f4743-ff5a-4aa2-a99c-4d6b7d28af4f)

```
apt install bison
```

```
apt install bison --fix-missing
```

```
apt install libwrap0-dev
```

```
./configure
```

```
make install 
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlbiA9DLxQbZwdfRDs%2Fimage.png?alt=media\&token=a195d556-bf29-4bbf-8f5e-bf53797e444c)

```
gedit /etc/ld.so.conf
```

{% hint style="info" %}

#### ld.so.conf

```
include /etc/ld.so.conf.d/*.conf
/usr/lib
```

{% endhint %}
{% endtab %}
{% endtabs %}

#### Part 02.

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPldPcV0_A49Z0zLmVP%2Fimage.png?alt=media\&token=c161e5c3-4238-4cbc-99bc-0551355cfac4)

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

```
ip addr add 192.168.1.2/24 brd + dev eth0
```

```
ping 192.168.1.1
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlnpn09g2uSTt3Xsjb%2Fimage.png?alt=media\&token=5e3f91df-bbaf-406f-9351-2da59b3502a7)

> #### 新增 user

```
useradd anida
```

```
passwd anida
```

> #### 安裝 tac plus

```
./tac_pwd
```

```
gedit tac_plus.conf
```

{% hint style="info" %}

#### tac\_plus.conf

```
key = ccie

accounting file = /var/log/tac.acct

user = user {
    member = user5
    login = des aerYSwBGbhIlo
}
group = user5 {
    service = exec {
        priv-lvl = 5
    }
}
```

{% endhint %}

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MQCdiqRq3PMPvEpHOOq%2F-MQDAagzoZgaPj0vmYt6%2Fimage.png?alt=media\&token=91d48cda-4f25-43b1-9709-629ec56e1c45)

> #### 執行 tacacs+ server

```
./tac_plus -C ./tac_plus.conf -G
```

{% endtab %}

{% tab title="R2" %}

```
int e0/0
```

```
ip add 23.1.1.2 255.255.255.0
```

```
no shut
```

```
exit
```

> #### 啟動 AAA New-Model

```
aaa new-model
```

> #### 設定 TACACS+ 資料

```
tacacs server TACACS-SERVER
```

```
add ipv4 192.168.1.2
```

```
key ccie
```

```
exit
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPllvyJ3uyWFgfcMmT4%2Fimage.png?alt=media\&token=12fbf894-25ee-4882-98f8-fd119e3ca709)

> #### 設定 Authentication

```
aaa authentication login List_Login group tacacs+ local
```

```
line console 0 
```

```
login authentication List_Login
```

```
line vty 0 4
```

```
login authentication List_Login
```

```
aaa authentication enable default group tacacs+ enable
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlm5PciY8Rr30vD3Tz%2Fimage.png?alt=media\&token=a71243db-c08f-4993-af4e-dedd3c01da1b)

> #### 設定 Authorization

```
aaa authorization exec List_Priv group tacacs+ local
```

```
line console 0 
```

```
authorization exec List_Priv
```

```
exit
```

```
aaa authorization console
```

```
line vty 0 4
```

```
authorization exec List_Priv
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPlmi-Afhdzj5GOXSeK%2Fimage.png?alt=media\&token=48c19ead-434b-4461-b5bb-0f4cee5963a4)

> #### 設定 Accounting

```
line console 0 
```

```
accounting exec List_Acc
```

```
accounting commands 5 List_Comm_5
```

```
accounting commands 10 List_Comm_10
```

```
accounting commands 15 List_Comm_15
```

```
line vty 0 4
```

```
accounting exec List_Acc
```

```
accounting commands 5 List_Comm_5
```

```
accounting commands 10 List_Comm_10
```

```
accounting commands 15 List_Comm_15
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPln918-n1Tg9Zyr1Hs%2Fimage.png?alt=media\&token=2fb343b2-1b13-49b9-b8a9-a904766bb714)

```
do telnet 23.1.1.3
```

{% endtab %}

{% tab title="R3" %}

```
int e0/0
```

```
ip add 23.1.1.3 255.255.255.0
```

```
no shut
```

```
int e0/1
```

```
ip add 192.168.1.1 255.255.255.0
```

```
no shut
```

![](https://1182807199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MHJUVmIukmM2g9Ai7CY%2F-MPlXX_njQcaCS8qCLla%2F-MPln_-GF-BEqzgRbW6P%2Fimage.png?alt=media\&token=aec32545-44b2-4df6-8724-ee47cee64504)
{% endtab %}
{% endtabs %}
