引言
通过前面的不断学习,我们已经基本知道HCIA所需的基础知识与实验配置了,接下来就让我们用一个实验来检验一下自己的学习成果吧!
实验拓扑
实验需求
1.ISP路由器仅配置IP地址
2.内网基于192.168.1.0/24 网段进行IP划分
3.R1/R2之间使用OSPF做到全网全通,单区域
4.PC1-PC4可以使用DHCP获取地址
5.PC2-PC4可以访问PC5,PC1不行
6.R2出口只拥有一个公网IP
7.test-1设备可以登录telnet服务器,test-2不行
实验步骤
1.依据实验需求及拓扑图划分网段
内网192.168.1.0/24:
(1)192.168.1.0/26——骨干
- 因为只有一条,不细化(也可以细化到/30)
(2)192.168.1.64/26——R1下网络
- 192.168.1.64/28——VLAN 2
- 192.168.1.80/28——VLAN 3
- 192.168.1.96/28——VLAN 4
- 192.168.1.112/28——预留
(3)192.168.1.128/26——R2下网络
- 192.168.1.128/27——VLAN 2
- 192.168.1.160/27——VLAN 3
(4)192.168.1.192/26——预留
外网:
- 200.1.1.0/30——R2与ISP之间,为了只有一个公网IP
- 201.1.1.0/24——ISP下方网络
2.先实现内网通
(1)配置ip与VLAN
//R1
//ip
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.1.1 26
[R1-GigabitEthernet0/0/1]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.1.65 28
[R1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.81 28
[R1-GigabitEthernet0/0/0.2]int g 0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.1.97 28
//vlan
[R1-GigabitEthernet0/0/0.3]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]int g 0/0/0.3
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 4
[R1-GigabitEthernet0/0/0.3]arp broadcast enable
//R2
[R2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.1.2 26
[R2-GigabitEthernet0/0/1]int g 0/0/0.1
[R2-GigabitEthernet0/0/0.1]ip add 192.168.1.129 27
[R2-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R2-GigabitEthernet0/0/0.1]arp broadcast enable
[R2-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R2-GigabitEthernet0/0/0.2]ip add 192.168.1.161 27
[R2-GigabitEthernet0/0/0.2]dot1q termination vid 3
[R2-GigabitEthernet0/0/0.2]arp broadcast enable
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]ip add 200.1.1.1 30
//ISP
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 200.1.1.2 30
[ISP-GigabitEthernet0/0/0]int g 0/0/1
[ISP-GigabitEthernet0/0/1]ip add 201.1.1.1 24
//Telnet S
[Telnet S]int g 0/0/0
[Telnet S-GigabitEthernet0/0/0]ip add 192.168.1.98 28
//test-1
[test-1]int g 0/0/0
[test-1-GigabitEthernet0/0/0]ip add 201.1.1.2 24
///test-2
[test-2]int g 0/0/0
[test-2-GigabitEthernet0/0/0]ip add 201.1.1.3 24
//LSW1
[LSW1]vlan 2
[LSW1]vlan 3
[LSW1]vlan 4
[LSW1]int g 0/0/2
[LSW1-GigabitEthernet0/0/2]p l a
[LSW1-GigabitEthernet0/0/2]p d v 2
[LSW1-GigabitEthernet0/0/2]int g 0/0/3
[LSW1-GigabitEthernet0/0/3]p l a
[LSW1-GigabitEthernet0/0/3]p d v 3
[LSW1-GigabitEthernet0/0/3]int g 0/0/4
[LSW1-GigabitEthernet0/0/4]p l a
[LSW1-GigabitEthernet0/0/4]p d v 4
[LSW1]int g 0/0/1
[LSW1-GigabitEthernet0/0/1]p l t
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3 4
//LSW2
[LSW2]vlan 2
[LSW2]vlan 3
[LSW2]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]p l a
[LSW2-GigabitEthernet0/0/2]p d v 2
[LSW2-GigabitEthernet0/0/2]int g 0/0/3
[LSW2-GigabitEthernet0/0/3]p l a
[LSW2-GigabitEthernet0/0/3]p d v 3
[LSW2-GigabitEthernet0/0/3]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]p l t
[LSW2-GigabitEthernet0/0/1]p t a v 2 3
(2)启动OSPF
//R1
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 192.168.1.1 0.0.0.0
network 192.168.1.65 0.0.0.0
network 192.168.1.81 0.0.0.0
network 192.168.1.97 0.0.0.0
//R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.1.2 0.0.0.0
network 192.168.1.129 0.0.0.0
network 192.168.1.161 0.0.0.0
(3)配置DHCP
只需要两个地址池,因为只有PC1、PC2需要DHCP获取地址
//R1
[R1]dhcp enable
[R1]ip pool 1
[R1-ip-pool-1]network 192.168.1.64 mask 28
[R1-ip-pool-1]gateway-list 192.168.1.65
[R1-ip-pool-1]dns 114.114.114.114
[R1]ip pool 2
[R1-ip-pool-2]network 192.168.1.80 mask 28
[R1-ip-pool-2]gateway-list 192.168.1.81
[R1-ip-pool-2]dns 114.114.114.114
[R1-ip-pool-2]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global
//R2
[R2]dhcp enable
[R2]ip pool 1
[R2-ip-pool-1]network 192.168.1.128 mask 27
[R2-ip-pool-1]gateway-list 192.168.1.129
[R2-ip-pool-1]dns 114.114.114.114
[R2]ip pool 2
[R2-ip-pool-2]network 192.168.1.160 mask 27
[R2-ip-pool-2]gateway-list 192.168.1.161
[R2-ip-pool-2]dns 114.114.114.114
[R2]int g 0/0/0.1
[R2-GigabitEthernet0/0/0.1]dhcp select global
[R2-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R2-GigabitEthernet0/0/0.2]dhcp select global
3.ACL与NAT配置
//R2
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]nat outbound 2000
[R2]ip route-static 0.0.0.0 0 200.1.1.2//配置静态路由
[R2]ospf 1
[R2-ospf-1]default-route-advertise //下发缺省
//到这一步PC1已经可以ping通PC5了
//做一条限制test-2去telnet到telnet S服务器的ACl
[R2]acl 3000
[R2-acl-adv-3000]rule deny tcp source 201.1.1.3 0 destination-port eq 23
//只是不能登录telnet S,所以不写目的地址
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]traffic-filter inbound acl 3000
//R1
[R1]acl 3000
[R1-acl-adv-3000]rule deny ip source 192.168.1.64 0.0.0.15 destination 201.1.1.1
00 0.0.0.0//限制的是PC1这个区域的,并不是仅仅限制PC1,因为PC1是DHCP获取的
[R1-acl-adv-3000]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]traffic-filter inbound acl 3000
//做完这一步就可以实现PC1不能PING通PC5了
4.配置telent
//Telnet S
[Telnet S-aaa]local-user xiaodu privilege level 15 password cipher 123456
[Telnet S-aaa]local-user xiaodu service-type telnet
[Telnet S]user-interface vty 0 4
[Telnet S-ui-vty0-4]authentication-mode aaa
//此时telnet服务已经开启,但是还是连不上去,因为test-1与2不认识200.1.1.0网段,所以需要配置一条静态路由
[test-1]ip route-static 200.1.1.1 32 201.1.1.1
//但是因为有内外网之分,还需要做一个服务器映射
[R2]int g 0/0/2
[R2-GigabitEthernet0/0/2]nat server protocol tcp global current-interface telnet
inside 192.168.1.98 telnet
//R2只有一个公网IP,所以使用当前端口
//做完这里,已经可以ping通telnet S服务器了,但是依旧无法telnet,是因为telnet S并没有启动OSPF协议,因为一般服务器不加入动态路由,所以telnet S只有自己的直连,它无法回复数据包,所以还需要配置缺省
[Telnet S]ip route-static 0.0.0.0 0 192.168.1.97
实验结果
标签:R1,R2,int,ip,GigabitEthernet0,HCIA,192.168,实验,综合 From: https://blog.csdn.net/2401_86511216/article/details/145234062