20201007 Introduction DHCP

課堂練習

Part 01.

S1
S2
conf t
hostname R1
do writ
int s1/0
ip addr 12.1.1.1 255.255.255.252
no shut
clock rate 64000
conf t
hostname R2
do writ
int s1/0
ip addr 12.1.1.2 255.255.255.252
no shut
clock rate 64000
do sh ip int brief
exit
R1
R2
int lo 0
ip addr 1.1.1.1 255.255.255.255
int lo 0
do sh ip int brief
int lo 0
ip addr 2.2.2.2 255.255.255.255
no shut
do sh ip int brief
exit
do sh ip ro
R1
R2
do sh ip ro 12.1.1.2
ip route 2.2.2.0 255.255.255.0 ?
ip route 2.2.2.0 255.255.255.0 s1/0 12.1.1.2
do sh ip ro
do sh ip ro 2.2.2.2
do ping 2.2.2.2
do ping 2.2.2.2 source 1.1.1.1
do sh ip ro 12.1.1.1
ip route 1.1.1.0 255.255.255.0 ?
ip route 1.1.1.0 255.255.255.0 s1/0 12.1.1.1
do sh ip ro
do sh ip ro 1.1.1.1
do ping 1.1.1.1
do ping 1.1.1.1 source 2.2.2.2

Part 02. Ping IP Address

R3
R4
R5
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
ip route 4.4.4.0 255.255.255.0 192.168.1.2
do sh ip ro
do sh ip ro 4.4.4.4
do ping 4.4.4.4
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
ip route 5.5.5.0 255.255.255.0 192.168.1.3
do sh ip ro
do sh ip ro 5.5.5.5
do ping 5.5.5.5
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
exit
ip route 3.3.3.0 255.255.255.0 192.168.1.1
do sh ip ro
do sh ip ro 3.3.3.3
do ping 3.3.3.3

Part 03. Setting DHCP

R1
R3
R2
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
ip dhcp pool DHCP
network 192.168.1.0 /24
default-router 192.168.1.1
dns-server 8.8.8.8
ip route 23.1.1.0 255.255.255.0 e0/0 12.1.1.2
ip route 192.168.2.0 255.255.255.0 e0/0 12.1.1.2
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
exit
ip dhcp pool DHCP2
network 192.168.2.0 /24
default-router 192.168.2.1
dns-server 8.8.8.8
ip route 192.168.1.0 255.255.255.0 e0/0 23.1.1.2
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
ip route 192.168.1.0 255.255.255.0 e0/0 12.1.1.1
ip route 192.168.2.0 255.255.255.0 e0/0 23.1.1.3
ip route 192.168.2.0 255.255.255.0 e0/1 23.1.1.3
VPC[1]
VPC[2]
ip dhcp
sh ip
ping 192.168.1.1

設定完 R3 和 R2 的 IP 後:

ping 12.1.1.1
ping 12.1.1.2

將 R2 設置 router 後重 ping 12.1.1.2:

ping 12.1.1.2
ping 23.1.1.2
ping 23.1.1.3
ping 192.168.2.1

R3 重設後:

ping 192.168.2.1

R2重設後:

ping 192.168.2.2
ip dhcp
sh ip
ping 192.168.2.1

Part 04.

R1
R2
hostname R1
do writ
int e0/0
ip addr 12.1.1.1 255.255.255.0
no shut
ip route 0.0.0.0 0.0.0.0 e0/0 12.1.1.2
do sh ip ro
do ping 3.3.3.3
do sh ip static ro
hostname R2
do writ
int e0/0
ip addr 12.1.1.2 255.255.255.0
no shut
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