综合实验1

发布时间 2023-12-18 00:59:46作者: KE-XI

综合实验1

拓扑

image-20231218005354841

1.实验目的

内网互通,并且配置无线。内网要能访问到外网的DNS服务器,内网接入和核心之间要增加链路可靠性,另一边的私网服务器需要映射,让另一边的私网能够访问

2.实验分析

增加链路可靠性可以配置链路聚合,内网划分不同vlan来隔离广播域,DHCP在核心上面做,接入多个vlan不好做。外部路由器没有固定ip都要做PPPOE的,但是还没学习,所以就先做PPP。

1.eth-trunk
2.vlan
3.STP(RSTP/根桥/EP)
4.IP(网关)
5.DHCP
6.OSPF
7.WLAN
8.PPP(认证/自动获取IP)
9.默认路由
10.NAT

3.具体步骤

DNS服务器配置:IP地址为114.114.114.114 /24 网关为114.114.114.254

image-20231218003936616

另一边私网的服务器配置为IP地址192.168.1.1 /24 网关为192.168.1.254

内网部分

第一步配置Eth-trunk

SW1
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20 30 101 to 103
trunkport GigabitEthernet 0/0/1 to 0/0/2

SW3
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20 30 101 to 103
trunkport GigabitEthernet 0/0/1 to 0/0/2
interface Eth-Trunk2
port link-type trunk
port trunk allow-pass vlan 10 20 30 101 to 103
trunkport GigabitEthernet 0/0/3 to 0/0/4
interface Eth-Trunk3
port link-type access
trunkport GigabitEthernet 0/0/6 to 0/0/7
q
vlan 101
interface Eth-Trunk3
p d v 103

AR1
interface Eth-Trunk3
undo portswitch
trunkport GigabitEthernet 0/0/0 to 0/0/1
ip ad 10.1.1.1 24


SW2
interface Eth-Trunk2
port link-type trunk
port trunk allow-pass vlan 10 20 30 101 to 103
trunkport GigabitEthernet 0/0/1 to 0/0/2

2.配置vlan

SW1
vlan batch 10 30 103
int e0/0/1
p l a
p d v 10
int e0/0/2
p l a
p d v 10
int e0/0/3
p l t
p t p v 103
p t a v 30 103

SW2
vlan batch 20 30 103
int e0/0/1
p l a
p d v 20
int e0/0/2
p l a
p d v 20
int e0/0/3
p l t
p t p v 103
p t a v 30 103

SW3
vlan batch 10 20 30 103 102 101
int vlan 102
ip ad 10.1.2.254 24
q
int g0/0/5
p l a
p d v 102
AC1
vlan 102
int vlan 102
ip ad 10.1.2.1 24
q
int g0/0/1
p l a
p d v 102

3.接下来配置rstp快速生成树

LSW1
stp mode rstp 
int e0/0/1
stp edged-port enable
int e0/0/2
stp edged-port enable
LSW2
stp mode rstp 
int e0/0/1
stp edged-port enable
int e0/0/2
stp edged-port enable
LSW3
stp priority  0
stp mode rstp 
int Eth-Trunk 3
stp edged-port enable

4.IP网关+DHCP

SW3
dchp enable
ip pool 10
network 10.2.1.0 mask 24
gateway-list 10.2.1.254
dns-list 114.114.114.114
int vlan 10
ip ad 10.2.1.254 24
dhcp select global
q
ip pool 20
network 10.2.2.0 mask 24
gateway-list 10.2.2.254
dns-list 114.114.114.114
int vlan 20
ip ad 10.2.2.254 24
dhcp select global
q
ip pool 30
network 10.2.3.0 mask 24
gateway-list 10.2.3.254
dns-list 114.114.114.114
int vlan 30
ip ad 10.2.3.254 24
dhcp select global
q
ip pool 103
network 10.1.3.0 mask 24
gateway-list 10.1.3.254
dns-list 114.114.114.114
int vlan 103
ip ad 10.1.3.254 24
dhcp select global
q

5.配置ospf为了内网互通

SW3
ospf 
area 0
network 10.1.3.254 0.0.0.0
network 10.2.1.254 0.0.0.0
network 10.2.2.254 0.0.0.0
network 10.2.3.254 0.0.0.0
network 10.1.2.254 0.0.0.0
network 10.1.1.254 0.0.0.0
AR1
ospf 
a 0
network 10.1.1.1 0.0.0.0
AC
ospf 
a 0
network 10.1.2.1 0.0.0.0

6.配置wlan

SW3
ip pool 103 
option 43 sub-option 2 ip-address 10.1.2.1

AC
wlan
ap-group name shiyan1
q
regulatory-domain-profile name anquan1
country-code cn
q
ap-group name shiyan1
regulatory-domain-profile anquan1
y
dis this
q
ap auth-mode mac-auth
ap-id 1 ap-mac  00e0-fc9a-5530
//查看两个AP的mac地址dis int vlan 1
ap-name AP1
ap-group ceshi1
y
dis this
q
ap-id 2
ap-id 2 ap-mac 00e0-fc15-3340
ap-name AP2
ap-group ceshi1
y
dis this
q
q
capwap source ip-address 10.1.2.1
配置完这里AP和AC就可以正常通信了
wlan
security-profile name celue
security wpa-wpa2 psk pass-phrase 88888888 aes
y
q
ssid-profile name celue
ssid celue
q
vap-profile name celue
security-profile celue
ssid-profile celue
service-vlan vlan-id 30  //配置业务vlan为30
q
ap-group name shiyan1
vap-profile tech wlan 1 raido all

接下来配置外部

7.PPP

AR1
内部是被认方,运营商是认证方。通过拨号
AR1
int s4/0/0
ppp pap local-user zhangsan password simple 88888888  //这里zhangsan就相当于家里的宽带账号
ip address ppp-negotiate //这个就是让对端也就是运营商分配地址给我用
AR2
int s4/0/0
ppp authentication-mode pap
q
aaa  //三a数据库
local-user zhangsan password cipher 88888888
local-user zhangsan service-type ppp
dis th
int s4/0/0
ip ad 100.1.12.2 24
remote address 100.1.12.1  //这个就是给对端分配的ip地址
在AP1上用dis ip inter b 查看获取ip

8.运营商通ospf

AR2
int g0/0/0
ip ad 100.1.23.2 24
ospf 2
a 0
network 100.1.23.2 0.0.0.0
network 100.1.12.2 0.0.0.0
AR3
int g0/0/0
ip ad 100.1.23.3 24
int g0/0/1
ip ad 114.114.114.254 24
int g0/0/2
ip ad 100.1.34.3 24
q
ospf 2
a 0
network 100.1.23.3 0.0.0.0
network 114.114.114.114 0.0.0.0
network 100.1.34.3 0.0.0.0

9.内网通运营商dns服务器,natacl默认路由

SW3
ip route-static 0.0.0.0 0 10.1.1.1
AR1
acl 2000
rule 5 permit source 10.2.0.0 0.0.3.255 //这样就可以匹配2.1  2.2  2.3 的网段了
q
int s4/0/0
nat outbound 2000
q
ip route-static 0.0.0.0 0 Serial4/0/0
ospf 
default-route-advertise

10.另一个私网配置,私网服务器映射到外网

AR4
int g0/0/0
ip ad 100.1.34.4 24
int g0/0/1
ip ad 192.168.1.254 24
q
ip route-static 0.0.0.0 0 100.1.34.3
int g0/0/0
nat server global 100.1.34.1 inside 192.168.1.1 

4.遇到的问题

[Huawei-Eth-Trunk6]trunkport GigabitEthernet 0/0/1
Info: This operation may take a few seconds. Please wait for a moment...
Error: The layer-3 interface can not add into a layer-2 trunk.
The error port is GigabitEthernet0/0/1.done.
出口路由器配置Eth-trunk,要把Eth-trunk关闭交换模式,un portswitch,把它从二层口变成三层口才可以

PC机没法·ping通服务器,连自己的dns服务器都ping不通

ppp不稳定,重新配一遍就可以了ping通dns服务器了。
另一个私网的服务器通过dis ip routing-table,加ping命令,找到了出现问题就是在私网的出口路由器上丢包了。其实还可以用这条命令tracert www.baidu.com,查看报文转发的路径。
在私网的出口路由器加上默认路由ip route-static 0.0.0. 0 100.1.34.3就可以了

5.优化

1.wlan信道可以修改一下,同样的信道会互相影响,这样会影响用户的体验

dis radio all :查看无线信道
如果发现两个ap距离很近信道又一样,那很有可能信号会互相影响,所以得调整信道
wlan
ap-id 2   进入2号ap
radio 0  //进入2.4G得信道,0是2.4g,1是5g
channel 20mhz 6   修改为6信道

2.链路聚合可以用lacp,虽然实验只有2条,但也还是可以配置一下的。这样可以使端口的调整灵活,也能检测到端口的异常

int Eth-trunk 1
mode lacp
max active-linknumber 要设置活动的数量
trunkport 加入的端口
q
lacp priority 30000  //设置优先级,越小越优先
dis eth-trunk 1 //查看trunk链路状态
两边都要配置,主导的把优先级加大就行,小的那个不用

6.总结(一些知识或者不熟的配置)

1.学习PPPOE,出口路由器要用的

2.配置链路聚合Eth-trunk 1 ,这个1的编号本地有意义,也就是说两边的设备编号可以不一样,只要各自的端口加入正确就行了

3.跟AP之间的链路之所以配置trunk是因为AP属于vlan103管理vlan,还有一个vlan是要给客户的也就是vlan30,所以得配置trunk,还要给连接AP的口划分为pvid103.。跟AC的口和跟出口路由器的口就配置access口就可以了

4.rstp配置

先改变生成树的类型,三台交换机都要改
stp mode rstp   
根桥配置,越性能好的配置为根桥,因为越往上性能越好
SW3
stp priority  0
dis stp b :查看stp端口信息,都是db口
接下来配置边缘端口
int e0/0/1
stp edged-port enable
给所有pc和出口路由器配置边缘端口

5.查看所有接口ip配置情况:dis ip inter b

6.二层与三层链路聚合可以但是注意:端口类型相同就可以,但是速率不同就不行

7.以后多用3w和1h问下,what,why,wherer,how

8.APAC配置

wlan
ap-group name taike
q
regulatory-domain-profile name damin
country-code cn
q
ap-group name taike
regulatory-domain-profile damin
y
dis this
q
ap auth-mode mac-auth
ap-id 1 ap-mac  
//查看两个AP的mac地址dis int vlan 1
ap-name AP1
ap-group taike
y
dis this
q
ap-id 2
ap-id 2 ap-mac
ap-name AP2
ap-group taike
y
dis this
q
q
capwap source ip-address 10.1.2.1
配置完这里AP和AC就可以正常通信了
wlan
security-profile name tech
security wpa-wpa2 psk pass-phrase 88888888 aes
y
q
ssid-profile name tech
ssid tech
q
vap-profile name tech
security-profile tech
ssid-profile tech
service-vlan vlan-id 30  //配置业务vlan为30
q
ap-group name taike
vap-profile tech wlan 1 raido 0

9.PPP(看华为数通路由交换HCNA/HCIA (完)P59,还有PPPOE拨号的配置方式和原理超有趣网络)

内部是被认方,运营商是认证方。通过拨号
AR1
int s4/0/0
ppp pap local-user zhangsan password simple 88888888  //这里zhangsan就相当于家里的宽带账号
ip address ppp-negotiate //这个就是让对端也就是运营商分配地址给我用
AR2
int s4/0/0
ppp authentication-mode pap
q
aaa  //三a数据库
local-user zhangsan password cipher 8888
local-user zhangsan service-type ppp
dis th
int s4/0/0
ip ad 100.1.12.2 24
remote address 100.1.12.1  //这个就是给对端分配的ip地址
在AP1上用dis ip inter b 查看获取ip



10.出口路由器配置默认路由下一跳现实生活中是不知道下一跳地址的,所以配置出接口地址就行了

ip route-static 0.0.0.0 0 Serial4/0/0

11.下发默认路由,可以在ospf上面配置

AR1
ospf
default-route-advertise

12.acl配置

acl 2000
rule 5 permit source 10.2.0.0 0.0.3.255 //这样就可以匹配2.1  2.2  2.3 的网段了
q
int s4/0/0
nat outbound 2000