实验目的
实验步骤
1、分配ip地址
由题可将192.168.0.0/24划分成九个,所有网络位向主机位借4位
192.168.0.0/28
192.168.0.16/28
192.168.0.32/28
192.168.0.48/28
192.168.0.64/28
192.168.0.80/28
192.168.0.96/28
192.168.0.112/28
192.168.0.128/28
再将192.168.0.0/28分给R1的三个环回地址
192.168.0.0/30
192.168.0.4/30
192.168.0.8/30
上图为划分好的拓扑图
然后分配ip地址
R1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.0.17 28
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.0.65 28
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.0.1 30
[r1-LoopBack0]q
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.0.5 30
[r1-LoopBack1]q
[r1]interface LoopBack 2
[r1-LoopBack2]ip address 192.168.0.9 30
R2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.0.18 28
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.0.33 28
R3
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.0.50 28
[r3-GigabitEthernet0/0/1]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.0.66 28
[r3-GigabitEthernet0/0/0]int g0/0/2
[r3-GigabitEthernet0/0/2]ip address 192.168.0.113 28
R4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.0.34 28
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.0.49 28e.
[r4-GigabitEthernet0/0/1]int g4/0/0
[r4-GigabitEthernet4/0/0]ip address 192.168.0.81 28
[r4-GigabitEthernet4/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.0.97 28
R5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.0.98 28
[r5-GigabitEthernet0/0/0]int g0/0/2
[r5-GigabitEthernet0/0/2]ip address 192.168.0.82 28
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip address 100.1.1.1 24
R6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip address 100.1.1.2 24
2、划分VLAN
SW1:
[sw1]vlan batch 2 3
[sw1]interface e0/0/2
[sw1-Ethernet0/0/2]p l a[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]p l a
[sw1-Ethernet0/0/3]p d
[sw1-Ethernet0/0/3]int e0/0/1
[sw1-Ethernet0/0/1]port link-type trunk
[sw1-Ethernet0/0/4]port link-type trunk
[sw1-GigabitEthernet0/0/1]int e0/0/1
[sw1-Ethernet0/0/1]port trunk allow-pass vlan all
[sw1-Ethernet0/0/1]int e0/0/4
[sw1-Ethernet0/0/4]port trunk allow-pass vlan all
SW2:
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all
[sw2]vlan batch 2 3
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]p l a
[sw2-Ethernet0/0/2]p d vlan 2
[sw2-Ethernet0/0/3]p l a
[sw2-Ethernet0/0/3]p d vlan 3
R3:
[r3]interface g0/0/2.1
[r3-GigabitEthernet0/0/2.1]dot1q termination vid 2
[r3-GigabitEthernet0/0/2.1]ip address 192.168.0.113 28
[r3-GigabitEthernet0/0/2.1]int g0/0/2.2
[r3-GigabitEthernet0/0/2.2]dot1q termination vid 3
[r3-GigabitEthernet0/0/2.2]ip address 192.168.0.129 28
[r3-GigabitEthernet0/0/2.2]arp broadcast enable
3、使用DHCP给终端配置ip地址
R3:
[r3]dhcp enable
[r3]ip pool v2
Info: It's successful to create an IP address pool.
[r3-ip-pool-v2]network 192.168.0.112 mask 28
[r3-ip-pool-v2]gateway-list 192.168.0.113
[r3-ip-pool-v2]dns-list 8.8.8.8
[r3-ip-pool-v2]q
[r3]ip pool v3
[r3-ip-pool-v3]network 192.168.0.128 mask 28
[r3-ip-pool-v3]gateway-list 192.168.0.129
[r3-ip-pool-v3]dns-list 8.8.8.8
[r3-ip-pool-v3]q
[r3]int g0/0/2.1
[r3-GigabitEthernet0/0/2.1]dhcp select global
[r3-GigabitEthernet0/0/2.1]int g0/0/2.2
[r3-GigabitEthernet0/0/2.2]dhcp select global
4、手写静态路由
R1:
ip route-static 192.168.0.32 255.255.255.240 192.168.0.16
ip route-static 192.168.0.48 255.255.255.240 192.168.0.66
ip route-static 192.168.0.80 255.255.255.240 192.168.0.16
ip route-static 192.168.0.96 255.255.255.240 192.168.0.66
ip route-static 192.168.0.112 255.255.255.240 192.168.0.66
ip route-static 192.168.0.128 255.255.255.240 192.168.0.66
[r1]ip rou
[r1]ip route
[r1]ip route-static 192.168.0.0 28 nu
[r1]ip route-static 192.168.0.0 28 NULL 0
[r1]ip route-static 0.0.0.0 0 192.168.0.18
[r1]ip route-static 0.0.0.0 0 192.168.0.66
R2:
ip route-static 0.0.0.0 0.0.0.0 192.168.0.34
ip route-static 192.168.0.0 255.255.255.240 192.168.0.17
ip route-static 192.168.0.32 255.255.255.240 192.168.0.16
ip route-static 192.168.0.48 255.255.255.240 192.168.0.66
ip route-static 192.168.0.48 255.255.255.240 192.168.0.34
ip route-static 192.168.0.64 255.255.255.240 192.168.0.17
ip route-static 192.168.0.80 255.255.255.240 192.168.0.16
ip route-static 192.168.0.80 255.255.255.240 192.168.0.34
ip route-static 192.168.0.96 255.255.255.240 192.168.0.66
R3:
ip route-static 0.0.0.0 0.0.0.0 192.168.0.49
ip route-static 192.168.0.0 255.255.255.240 192.168.0.65
ip route-static 192.168.0.16 255.255.255.240 192.168.0.65
ip route-static 192.168.0.32 255.255.255.240 192.168.0.49
ip route-static 192.168.0.80 255.255.255.240 192.168.0.49
ip route-static 192.168.0.96 255.255.255.240 192.168.0.49
R4:
ip route-static 0.0.0.0 0.0.0.0 192.168.0.82
ip route-static 0.0.0.0 0.0.0.0 192.168.0.98
ip route-static 192.168.0.0 255.255.255.240 192.168.0.33
ip route-static 192.168.0.0 255.255.255.240 192.168.0.50
ip route-static 192.168.0.16 255.255.255.240 192.168.0.33
ip route-static 192.168.0.64 255.255.255.240 192.168.0.50
ip route-static 192.168.0.112 255.255.255.240 192.168.0.50
R5:
ip route-static 0.0.0.0 0.0.0.0 100.1.1.2
ip route-static 192.168.0.0 255.255.255.240 192.168.0.97
ip route-static 192.168.0.0 255.255.255.240 192.168.0.81
ip route-static 192.168.0.16 255.255.255.240 192.168.0.97
ip route-static 192.168.0.32 255.255.255.240 192.168.0.97
ip route-static 192.168.0.48 255.255.255.240 192.168.0.97
ip route-static 192.168.0.64 255.255.255.240 192.168.0.97
ip route-static 192.168.0.112 255.255.255.240 192.168.0.97
ip route-static 192.168.0.128 255.255.255.240 192.168.0.97
5、配置ACL与NAT
[r5]acl 2000
[r5-acl-basic-2000]rule 1 permit source any
[r5-acl-basic-2000]q
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
实验结果
实现全网可达