# 20201007 Introduction DHCP

## 課堂練習

### Part 01.

![](/files/-MLSqwI2LE5C2PMycuse)

![](/files/-MLODvPOvogNaGsFtm9g)

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

```
conf t
```

```
hostname R1
```

```
do writ
```

```
int s1/0
```

```
ip addr 12.1.1.1 255.255.255.252
```

```
no shut
```

```
clock rate 64000
```

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

{% tab title="S2" %}

```
conf t
```

```
hostname R2
```

```
do writ
```

```
int s1/0
```

```
ip addr 12.1.1.2 255.255.255.252
```

```
no shut
```

```
clock rate 64000
```

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

```
do sh ip int brief
```

```
exit
```

{% tabs %}
{% tab title="R1" %}
![](/files/-MLOHBAeQa5J0qaku3wo)

```
int lo 0
```

```
ip addr 1.1.1.1 255.255.255.255
```

```
int lo 0
```

![](/files/-MLOJ9qkXeVFY1dfLM4S)

```
do sh ip int brief
```

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

{% tab title="R2" %}
![](/files/-MLOHPYIzpRDbl9L-4xN)

```
int lo 0
```

```
ip addr 2.2.2.2 255.255.255.255
```

```
no shut
```

![](/files/-MLOJOTvb78iAXIQyDyU)

```
do sh ip int brief
```

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

```
exit
```

```
do sh ip ro
```

{% tabs %}
{% tab title="R1" %}
![](/files/-MLRnnkvfA95tTnqTMCp)

```
do sh ip ro 12.1.1.2
```

![](/files/-MLRoerOfNOQ02o3lEgh)

```
ip route 2.2.2.0 255.255.255.0 ?
```

![](/files/-MLRpFyY00ABL19rssVC)

```
ip route 2.2.2.0 255.255.255.0 s1/0 12.1.1.2
```

```
do sh ip ro
```

![](/files/-MLRqabjypleHaSabcsz)

```
do sh ip ro 2.2.2.2
```

![](/files/-MLRrk-aeinXhnclq8f_)

```
do ping 2.2.2.2
```

![](/files/-MLRs1wJoiLVud2r4Lds)

```
do ping 2.2.2.2 source 1.1.1.1
```

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

{% tab title="R2" %}
![](/files/-MLRnw0yG_CdLRWu-Zu-)

```
do sh ip ro 12.1.1.1
```

![](/files/-MLRoY195pnoq4vi59OW)

```
ip route 1.1.1.0 255.255.255.0 ?
```

![](/files/-MLRpZlvSWnRNxtCx-ZE)

```
ip route 1.1.1.0 255.255.255.0 s1/0 12.1.1.1
```

```
do sh ip ro
```

![](/files/-MLRqku1MNXLxKml36oj)

```
do sh ip ro 1.1.1.1
```

![](/files/-MLRr_30lgVFqt9KHcGW)

```
do ping 1.1.1.1
```

![](/files/-MLRsCImXMSYrEfytmVL)

```
do ping 1.1.1.1 source 2.2.2.2
```

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

### Part 02. Ping IP Address

![](/files/-MLSr3ECc6Ddl0xhV71_)

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

```
hostname R3
```

```
do writ
```

```
int e0/0
```

```
ip addr 192.168.1.1 255.255.255.0
```

```
no shut
```

```
exit
```

```
int lo 0
```

```
ip addr 3.3.3.3 255.255.255.255
```

```
no shut
```

```
do sh ip int brief
```

```
exit
```

![](/files/-MLSgVOAYZUgM5khngOo)

```
ip route 4.4.4.0 255.255.255.0 192.168.1.2
```

```
do sh ip ro
```

![](/files/-MLSjrEJjxsojMGRk8gk)

```
do sh ip ro 4.4.4.4
```

```
do ping 4.4.4.4
```

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

{% tab title="R4" %}

```
hostname R4
```

```
do writ
```

```
int e0/0
```

```
ip addr 192.168.1.2 255.255.255.0
```

```
no shut
```

```
exit
```

```
int lo 0
```

```
ip addr 4.4.4.4 255.255.255.255
```

```
no shut
```

```
do sh ip int brief
```

```
exit
```

![](/files/-MLSho5jflTH36NiPVpn)

```
ip route 5.5.5.0 255.255.255.0 192.168.1.3
```

```
do sh ip ro
```

![](/files/-MLSlXt79jbk9P0bi3fF)

```
do sh ip ro 5.5.5.5
```

```
do ping 5.5.5.5
```

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

{% tab title="R5" %}

```
hostname R5
```

```
do wirt
```

```
int e0/0
```

```
ip addr 192.168.1.3 255.255.255.0
```

```
no shut
```

```
exit
```

```
int lo 0
```

```
ip addr 5.5.5.5 255.255.255.255
```

```
no shut
```

```
do sh ip int brief
```

![](/files/-MLSibujw4EU-5ER308k)

```
exit
```

```
ip route 3.3.3.0 255.255.255.0 192.168.1.1
```

```
do sh ip ro
```

![](/files/-MLSmh_TmPJVROK8oYUC)

```
do sh ip ro 3.3.3.3
```

```
do ping 3.3.3.3
```

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

### Part 03. Setting DHCP

![](/files/-MLT6fV4RMRlgx9_oj86)

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

```
hostname R1
```

```
do writ
```

```
int e0/0
```

```
ip addr 12.1.1.1 255.255.255.0
```

```
no shut
```

```
int e0/1
```

```
ip addr 192.168.1.1 255.255.255.0
```

```
no shut
```

```
exit
```

![](/files/-MLSuvW6xfBeHk35TIHB)

```
ip dhcp pool DHCP
```

```
network 192.168.1.0 /24
```

```
default-router 192.168.1.1
```

```
dns-server 8.8.8.8
```

![](/files/-MLSviyITMMQTUQX4dox)

```
ip route 23.1.1.0 255.255.255.0 e0/0 12.1.1.2
```

![](/files/-MLT3AVbpT57oFSQtf1p)

```
ip route 192.168.2.0 255.255.255.0 e0/0 12.1.1.2
```

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

{% tab title="R3" %}

```
hostname R3
```

```
do writ
```

```
int e0/0
```

```
ip addr 23.1.1.3 255.255.255.0
```

```
no shut
```

```
int e0/1
```

```
ip addr 192.168.2.1 255.255.255.0
```

```
no shut
```

![](/files/-MLSxouypBYRWmcY9nwa)

```
exit
```

```
ip dhcp pool DHCP2
```

```
network 192.168.2.0 /24
```

```
default-router 192.168.2.1
```

```
dns-server 8.8.8.8
```

![](/files/-MLSz-BfMXwM4023j0CK)

```
ip route 192.168.1.0 255.255.255.0 e0/0 23.1.1.2
```

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

{% tab title="R2" %}

```
hostname R2
```

```
do writ
```

```
int e0/0
```

```
ip addr 12.1.1.2 255.255.255.0
```

```
no shut
```

```
int e0/1
```

```
ip addr 23.1.1.2 255.255.255.0
```

```
no shut
```

![](/files/-MLT-8V3cr0NszkU76ik)

```
ip route 192.168.1.0 255.255.255.0 e0/0 12.1.1.1
```

![](/files/-MLT1s3mQmnrzkNHwalR)

```
ip route 192.168.2.0 255.255.255.0 e0/0 23.1.1.3
```

![](/files/-MLT5-egqJJzkydlgw1F)

```
ip route 192.168.2.0 255.255.255.0 e0/1 23.1.1.3
```

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

{% tabs %}
{% tab title="VPC\[1]" %}

```
ip dhcp
```

![](/files/-MLSwMTyRoT4S5Kq0Tvg)

```
sh ip
```

![](/files/-MLSwZiU-jtgP9RxhIcN)

```
ping 192.168.1.1
```

![](/files/-MLSwpWbwbgVRY5EWx15)

#### 設定完 R3 和 R2 的 IP 後：

```
ping 12.1.1.1
```

![](/files/-MLT0BdDVbF8keN70ZXv)

```
ping 12.1.1.2
```

![](/files/-MLT0mavnqTuACD9fdwm)

#### 將 R2 設置 router 後重 ping 12.1.1.2：

```
ping 12.1.1.2
```

![](/files/-MLT1xoEEAwSuOi2TwXq)

```
ping 23.1.1.2
```

![](/files/-MLT297VVFSMr6mHCAJE)

```
ping 23.1.1.3
```

```
ping 192.168.2.1
```

![](/files/-MLT43vAPFNutKRSwinc)

#### R3 重設後：

```
ping 192.168.2.1
```

![](/files/-MLT4NL4Vwu1q9CW8AfM)

#### R2重設後：

```
ping 192.168.2.2
```

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

{% tab title="VPC\[2]" %}

```
ip dhcp
```

```
sh ip
```

```
ping 192.168.2.1
```

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

### Part 04.

![](/files/-MLT9rmwgaXhUJJ2BKNG)

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

```
hostname R1
```

```
do writ
```

```
int e0/0
```

```
ip addr 12.1.1.1 255.255.255.0
```

```
no shut
```

![](/files/-MLTAY3dptvGADvVrTr3)

```
ip route 0.0.0.0 0.0.0.0 e0/0 12.1.1.2
```

```
do sh ip ro
```

![](/files/-MLTCiwy2fgzQDKrh2c7)

```
do ping 3.3.3.3
```

![](/files/-MLTD4PEY83y-O_eVfr1)

```
do sh ip static ro
```

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

{% tab title="R2" %}

```
hostname R2
```

```
do writ
```

```
int e0/0
```

```
ip addr 12.1.1.2 255.255.255.0
```

```
no shut
```

![](/files/-MLTB5xjJqDTlUU1gi5A)

```
int lo 0
```

```
ip addr 2.2.2.2 255.255.255.255
```

```
int lo 1
```

```
ip addr 3.3.3.3 255.255.255.255
```

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://anida-huang.gitbook.io/computer-network/qi-zhong/20201007-introduction-dhcp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
