设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 2125|回复: 6
收起左侧

军哥笔记之【综合实验】

[复制链接]
发表于 2023-3-9 17:19:59 | 显示全部楼层 |阅读模式
实验目的
了解CCNA综合实验中所应用到的知识,并能够让网络能够正常访问外网,总公司和分公司能够互通。
二、实验过程
本次实验思路为,先做好内网二层,再做好三层,最后做好外网互通及公司之间互通
主要步骤及图为以下:
图片2.png
1.交换机的vlan ACCESS trunk配置
SW1的配置
sysname SW3  //设备命名
vlan batch 8 to 10  //创建多个vlan
stp edged-port default  //全局开启边缘端口
stp mode rstp  //配置STP模式为RSTP模式
stp bpdu-protection  //开启BPDU防止误接到其他交换机
interface GigabitEthernet0/0/1
port link-type trunk  //接口为trunk模式
port trunk allow-pass vlan 2 to 4094  //允许所有vlan数据通过
stp edged-port disable  //当前端口关闭边缘端口(优先级高于全局边缘端口配置)
#
interface GigabitEthernet0/0/3
port link-type trunk  //接口为trunk模式
port trunk allow-pass vlan 2 to 4094  //允许所有vlan数据通过
stp edged-port disable  //当前接口关闭边缘端口(优先级高于全局边缘端口配置)
#
interface GigabitEthernet0/0/10
port link-type access  //接口设置为ACCESS模式
port default vlan 8  //接口允许vlan8数据通过
stp edged-port disable  //当前接口关闭边缘端口(优先级高于全局边缘端口配置)
#
interface GigabitEthernet0/0/11
port link-type access//接口设置为access模式
port default vlan 9  //端口允许vlan9数据通过
stp edged-port disable //当前接口关闭边缘端口(优先级高于全局边缘端口配置)
#
interface GigabitEthernet0/0/12
port link-type access  //端口模式为access
port default vlan 10  //端口允许vlan10 数据通过
stp edged-port disable //当前接口关闭边缘端口(优先级高于全局边缘端口配置)
SW4的配置
sysname SW4  //设备命名
#
vlan batch 20 30  //创建多个vlan
#
interface GigabitEthernet0/0/1   
port link-type access  //端口模式为ACCESS模式
port default vlan 20  //端口允许vlan20数据通过
#
interface GigabitEthernet0/0/2
port link-type access  //端口模式设置为access模式
port default vlan 30  //允许vlan30数据通过
interface GigabitEthernet0/0/10
port link-type trunk  //端口模式为trunk模式
port trunk allow-pass vlan 2 to 4094  //允许所有vlan数据通过
SW1的配置
sysname SW1  //设备命名
vlan batch 8 to 11  //配置多个vlan
#
interface GigabitEthernet0/0/1
port link-type access  端口模式为access
port default vlan 11  //允许vlan11数据通过
stp edged-port disable //当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
#
interface GigabitEthernet0/0/3
port link-type trunk  //端口模式为trunk模式
port trunk allow-pass vlan 2 to 4094  //允许所有vlan数据通过
stp edged-port disable   // 当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
SW2的配置
sysname SW2  //设备命名
vlan batch 8 to 10 12  //创建多个vlan
#
interface GigabitEthernet0/0/1
port link-type trunk  //端口模式为trunk模式
port trunk allow-pass vlan 8 to 10 //允许vlan 8 9 10数据通过
stp edged-port disable  //当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
#
interface GigabitEthernet0/0/2
port link-type access  端口模式为access模式
port default vlan 12  端口允许vlan12通过
stp edged-port disable  //当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
2.配置动态链路聚合LACP,并允许通过vlan
SW1
interface Eth-Trunk1  //创建eth-trunk1端口
port link-type trunk  //eth-trunk1端口模式为trunk模式
port trunk allow-pass vlan 8 to 10  //eth-trunk1端口允许vlan 8 9 10数据通过
stp edged-port disable  //当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
mode lacp-static  //链路聚合模式为LACP自动模式
lacp priority 0  //LACP优先级为0LACP优先级数值越低越优先)
SW2
interface Eth-Trunk1  //创建eth-trunk1端口
port link-type trunk  //eth-trunk1端口模式为trunk模式
port trunk allow-pass vlan 8 to 10端口允许vlan 8 9 10数据通过
stp edged-port disable  //当前端口关闭边缘端口(单个端口关闭优先级高于全局开启端口)
mode lacp-static  //链路聚合模式为LACP自动模式
lacp priority 32768  //LACP优先级为32768LACP优先级数值越低越优先)
3.STP配置分清根交换机,模式设置为rstp,配置好边缘端口,最后配置BPDU
SW1
stp edged-port default  //全局开启边缘端口
stp mode rstp  //STP模式为RSTP
stp priority 0  //优先级为0设置为根交换机(在stp生成树选举当中,设备的stp优先级月小越优先)
SW2
stp edged-port default  //全局开启边缘端口
stp mode rstp  //STP模式为RSTP
stp priority 4096  //优先级为4096设置为备用根交换机(在stp生成树选举当中,设备的stp优先级月小越优先)
SW3
stp edged-port default  //全局开启边缘端口
stp mode rstp  //STP 模式为RSTP模式
stp bpdu-protection  //启用BPDU,防止接入其他交换机(检测到接入的设备为交换机后2秒后端口状态为down
4.二层虚拟成三层,配置ip和网关
5.做好VRRP配置,分清masterbuckup关系,其中注意master和根交换是同一台交换机
SW1
interface Vlanif8   //创建虚拟三层端口
ip address 192.168.8.252 255.255.255.0  //配置三层虚拟端口ip
vrrp vrid 8 virtual-ip 192.168.8.254  //  vrid8VRID后面的数值需要与vlan相对应,vlanif通常用来充当网关)的VRRP配置共同的虚拟网关
vrrp vrid 8 priority 200 //VRRP优先级为200 vrrp优先值越大越优先,值大的为master
interface Vlanif9   //创建虚拟三层端口
ip address 192.168.9.252 255.255.255.0 //配置三层虚拟端口ip
vrrp vrid 9 virtual-ip 192.168.9.254  //VRID9vrid后面的数值需要与vlan相对应,vlanif通常充当网关)的vrrp配置共同的虚拟网关
vrrp vrid 9 priority 200  //VRRP优先级为200vrrp优先值越大越优先,值大的为master
interface Vlanif10 //创建虚拟三层端口
ip address 192.168.10.252 255.255.255.0  //配置三层虚拟端口ip
vrrp vrid 10 virtual-ip 192.168.10.254//VRID10vrid后面的数值需要与vlan相对应,vlanif通常充当网关)的vrrp配置共同的虚拟网关
vrrp vrid 10 priority 200//VRRP优先级为200vrrp优先值越大越优先,值大的为master
interface Vlanif11   //创建虚拟三层端口
ip address 192.168.11.2 255.255.255.0 //配置三层虚拟端口ip
SW2
interface Vlanif8  //创建三层虚拟接口
ip address 192.168.8.253 255.255.255.0  //配置三层虚拟接口ip
vrrp vrid 8 virtual-ip 192.168.8.254  //VRID8vrid后面的数值需要与vlan相对应,vlanif通常充当网关)的vrrp配置共同的虚拟网关
interface Vlanif9
ip address 192.168.9.253 255.255.255.0
vrrp vrid 9 virtual-ip 192.168.9.254
vrrp vrid 10 priority 100//VRRP优先级为100默认值(vrrp优先值越大越优先,值小的为buckup
interface Vlanif10  //创建三层虚拟接口
ip address 192.168.10.253 255.255.255.0//设置三层虚拟接口ip
vrrp vrid 10 virtual-ip 192.168.10.254//VRID8vrid后面的数值需要与vlan相对应,vlanif通常充当网关)的vrrp配置共同的虚拟网关
interface Vlanif12//创建三层虚拟接口
ip address 192.168.12.2 255.255.255.0  //配置三层虚拟接口ip
R1
interface Serial1/0/0
ip address 12.1.1.1 255.255.255.252  //端口配置ip
interface GigabitEthernet0/0/0
ip address 202.100.1.1 255.255.255.252  //端口配置ip
interface GigabitEthernet0/0/1
ip address 192.168.11.1 255.255.255.0  //端口配置ip
interface GigabitEthernet0/0/2
ip address 192.168.12.1 255.255.255.0  //端口配置ip
ISP
interface Serial1/0/0
ip address 12.1.1.2 255.255.255.252    //端口配置ip
interface GigabitEthernet0/0/0
ip address 202.100.1.2 255.255.255.252     //端口配置ip
interface GigabitEthernet0/0/1
ip address 61.128.1.2 255.255.255.252   //端口配置ip
6.配置好外网静态路由,和分公司的单臂路由
R1
ip route-static 61.128.1.0 255.255.255.252 202.100.1.2  //到分公司对端的静态路由
ip route-static 0.0.0.0 0.0.0.0 202.100.1.2  //浮动路由主出接口默认路由
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2   //浮动路由备用出接口默认路由
R3
interface GigabitEthernet0/0/0.20   //创建三层虚拟子接口
dot1q termination vid 20  剥离子接口vid 20vlan标志(在单臂路由中vlan数值与vid相同时,该接口收到报文后可以剥离vlantag标志)
ip address 192.168.20.254 255.255.255.0   //配置三层虚拟子接口ip
arp broadcast enable  //开启ARP广播报文功能(在华为设备单臂路由中,默认关闭ARP广播报文,需要手工开启)
#
interface GigabitEthernet0/0/0.30//创建三层虚拟子接口
dot1q termination vid 30剥离子接口vid 20vlan标志(在单臂路由中vlan数值与vid相同时,该接口收到报文后可以剥离vlantag标志)
ip address 192.168.30.254 255.255.255.0  //配置三层虚拟子接口ip
arp broadcast enable//开启ARP广播报文功能(在华为设备单臂路由中,默认关闭ARP广播报文,需要手工开启)
ip route-static 0.0.0.0 0.0.0.0 61.128.1.2   //配置到外网的默认路由
ip route-static 202.100.1.0 255.255.255.252 61.128.1.2 //配置到总公司的静态路由
7.配置好内网动态路由ospf,和出口的缺省路由
R1
ospf 10 router-id 1.1.1.1   //创建ospf进程为10 ,并创建RID1.1.1.1ospf当中RID必须是唯一的才能建立起邻居)
default-route-advertise //配置ospf10进程下全局出口的缺省路由
area 0.0.0.0 //ospf10下创建区域0
nterface Serial1/0/0
ospf enable 10 area 0.0.0.0 //接口宣告加入ospf 10的区域0
interface GigabitEthernet0/0/0
ip address 202.100.1.1 255.255.255.252
ospf enable 10 area 0.0.0.0  //接口宣告加入ospf 10的区域0
interface GigabitEthernet0/0/1
ip address 192.168.11.1 255.255.255.0
ospf enable 10 area 0.0.0.0   //接口宣告加入ospf 10的区域0
#
interface GigabitEthernet0/0/2
ip address 192.168.12.1 255.255.255.0
ospf enable 10 area 0.0.0.0    //接口宣告加入ospf 10的区域0
SW1
ospf 10 router-id 2.2.2.2  //创建ospf进程10 并创建RID2.2.2.2(在ospf当中RID必须是唯一的才能建立起邻居)
area 0.0.0.0  //ospf10进程中创建区域0
interface Vlanif8
ip address 192.168.8.252 255.255.255.0
vrrp vrid 8 virtual-ip 192.168.8.254
vrrp vrid 8 priority 200
ospf enable 10 area 0.0.0.0 //接口宣告加入ospf 10的区域0
#
interface Vlanif9
ip address 192.168.9.252 255.255.255.0
vrrp vrid 9 virtual-ip 192.168.9.254
vrrp vrid 9 priority 200
ospf enable 10 area 0.0.0.0 //接口宣告加入ospf 10的区域0
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 200
ospf enable 10 area 0.0.0.0  //接口宣告加入ospf 10的区域0
#
interface Vlanif11
ip address 192.168.11.2 255.255.255.0
ospf enable 10 area 0.0.0.0 //接口宣告加入ospf 10的区域0
SW2
ospf 10 router-id 3.3.3.3  //创建ospf 10进程,并创建RID3.3.3.3(ospf当中RID必须是唯一的才能建立起邻居)
area 0.0.0.0  // ospf10进程中创建区域0
interface Vlanif8
ip address 192.168.8.253 255.255.255.0
vrrp vrid 8 virtual-ip 192.168.8.254
ospf enable 10 area 0.0.0.0//接口宣告加入ospf 10的区域0
#
interface Vlanif9
ip address 192.168.9.253 255.255.255.0
vrrp vrid 9 virtual-ip 192.168.9.254
ospf enable 10 area 0.0.0.0//接口宣告加入ospf 10的区域0
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
ospf enable 10 area 0.0.0.0//接口宣告加入ospf 10的区域0
#
interface Vlanif12
ip address 192.168.12.2 255.255.255.0
ospf enable 10 area 0.0.0.0//接口宣告加入ospf 10的区域0
8.配置好两边公司的acl
R1总公司
acl number 2000  //创建基本acl 2000 访问控制
rule 5 permit source 192.168.8.0 0.0.0.255 //acl 2000访问控制下,设置默认规则允许源地址为192.168.8.0/24段数据通过(华为的规则号默认初始为5,步长为5
rule 10 permit source 192.168.9.0 0.0.0.255 //acl 2000访问控制下,设置默认规则允许源地址为192.168.9.0/24段数据通过(华为的规则号默认初始为5,步长为5
rule 15 permit source 192.168.10.0 0.0.0.255//acl 2000访问控制下,设置默认规则允许源地址为192.168.10.0/24段数据通过(华为的规则号默认初始为5,步长为5
R3分公司
acl number 2000  //创建基本acl 2000访问控制
rule 5 permit source 192.168.20.0 0.0.0.255 //acl 2000访问控制下,设置默认规则允许源地址为192.168.20.0/24段数据通过(华为的规则号默认初始为5,步长为5
rule 10 permit source 192.168.30.0 0.0.0.255//acl 2000访问控制下,设置默认规则允许源地址为192.168.20.0/24段数据通过(华为的规则号默认初始为5,步长为5
9、两边公司配置边界出口做好NAT
R1总公司
interface Serial1/0/0
link-protocol ppp
ip address 12.1.1.1 255.255.255.252
ospf enable 10 area 0.0.0.0
nat outbound 2000  //边界出接口调用acl 2000,进行nat地址转换(私网地址转换为出接口公网地址)
#
interface Serial1/0/1
link-protocol ppp
#
interface GigabitEthernet0/0/0
ip address 202.100.1.1 255.255.255.252
ospf enable 10 area 0.0.0.0
nat server protocol tcp global current-interface 2323 inside 192.168.11.2 telnet
nat outbound 2000  //边界出接口调用acl 2000,进行nat地址转换(私网地址转换为出接口公网地址)
R3分公司
interface GigabitEthernet0/0/1
ip address 61.128.1.1 255.255.255.252
nat outbound 2000  //边界出接口调用acl 2000,进行nat地址转换(私网地址转换为出接口公网地址)
10、两边公司配置模式为GRE的隧道配置
R1总公司
interface Tunnel0/0/0  //创建虚拟隧道的接口
ip address 20.1.1.1 255.255.255.252 //配置虚拟隧道接口ip
tunnel-protocol gre  //在虚拟隧道接口下配置模式为GRE模式
source 202.100.1.1  //虚拟隧道接口下配置源ip
destination 61.128.1.1  //虚拟隧道接口下配置目的ip(此项需要注意目的与描述的单词区别,防止出错)
ip route-static 192.168.20.0 255.255.255.0 20.1.1.2  //创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
ip route-static 192.168.30.0 255.255.255.0 20.1.1.2  //创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
R3分公司
ip route-static 192.168.8.0 255.255.255.0 20.1.1.1 //创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
ip route-static 192.168.9.0 255.255.255.0 20.1.1.1//创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
ip route-static 192.168.10.0 255.255.255.0 20.1.1.1//创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
R3分公司
interface Tunnel0/0/0  //创建虚拟隧道接口
ip address 20.1.1.2 255.255.255.252   //设置虚拟隧道接口ip
tunnel-protocol gre   //在虚拟隧道接口下配置模式为GRE模式
source 61.128.1.1 //在虚拟隧道接口下配置源ip
destination 202.100.1.1   //虚拟隧道接口下配置目的ip(此项需要注意目的与描述的单词区别,防止出错)
#
ip route-static 0.0.0.0 0.0.0.0 61.128.1.2
ip route-static 61.128.1.0 255.255.255.0 202.100.1.2 直连路由
ip route-static 192.168.8.0 255.255.255.0 20.1.1.1//创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
ip route-static 192.168.9.0 255.255.255.0 20.1.1.1//创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
ip route-static 192.168.10.0 255.255.255.0 20.1.1.1//创建一条到对端的明细路由,下一跳为对端的虚拟隧道出接口
11.SW1做好nat server以便能够从外网访问此设备。
R1的配置
interface GigabitEthernet0/0/0
nat server protocol tcp global current-interface 2323 inside 192.168.11.2 telnet //在出接口上配置nat server公网的ip和端口映射到内网的ip和端口
nat outbound 2000  //出接口调用acl 2000
SW1的配置
user-interface vty 0 4  //创建vty 0 4线路
[SW1-ui-vty0-4]authentication-mode password  //配置vty线路密码模式
[SW1-ui-vty0-4]set authentication  password simple qyt //配置vty线路密码qyt
[SW1-ui-vty0-4]user privilege level 15  //配置vty线路下用户权限
[SW1-ui-vty0-4]protocol  inbound telnet  //vty线路下开Telnet
acl 2000 inbound  //接口入方向调用acl 2000
实验验证
1、验证总公司二层是否有环路、BPDU是否有效、边缘端口是否有效
1.查看SW3mac地址表,然后关闭stp,在打开stp,发现SW1上的三个接有PC端口上的mac地址没有漂移,说明没有环路。
2、使用命令dis loop-detect查看是否有环路,反馈信息显示没有二层环路
图片3.png
3.SW3上接入一个交换机,开启后2秒发现接口转态改变为down状态,手工开启端口后2秒依然转变为down状态,说明BPDU已经配置正确
图片4.png
4.对同一vlan 8内的PC进行关闭,启动,发现可以马上进行通讯,说明边缘端口配置有效
图片5.png
2、验证总公司根交换机和VRRP主虚拟路由是否为同一台交换机
1.SW1上使用命令dis stp查看发现SW1位根桥
图片6.png
2.SW1上使用命令dis vrrp brief发现SW1即为主虚拟路由如下图
图片7.png
说明SW1配置上STP根桥和VRRP主虚拟路由均为同一台设备
3、验证总公司vrrp是否正常,验证lacp是否正常,验证ACCESStrunk模式与vlan是否正确
1.dowSW1上的2层接口,然后使用命令查看SW2VRRP状态,发现SW2的状态为主状态,此时PC应该能够通讯,说明配置正确
图片8.png
2.使用命令查看发现链路聚合状态下,链路接口的带宽为2G,关闭其中一个物理端口后状态变为1G说明能够正常使用。
图片9.png
3.变更PC1ip地址为vlan 9的地址和网关,发现无法ping通网关,说明access配置正确,pc之间相互ping发现可以正确通讯,说明trunkvlan配置正确
图片10.png
4、验证分公司单臂路由是否能够正常通讯
1.在接入交换机没有路由功能的情况下,路由器需要使用单臂路由功能做网关,使用电脑ping不同的网关及PC发现可以正常通讯,说明单臂路由能够正常通讯
图片11.png
5、验证总公司和分公司是否能够访问外网
1.使用总部任意一台pc访问网外地址,发现可以进行通讯
图片12.png
2.使用分公司任意一台电脑访问外网,发现可以通讯
图片13.png
说明2边公司配置正确,都能够访问外网
6、验证虚拟三层路由和出接口是否在同一个区域0内形成ospf邻居
1.使用命令dis ospf peer brief 查看邻居是否建立,发现三设备均已建立邻居关系
图片15.png
图片16.png
7、验证区域0内的设备路由是否有对外的缺省路由
使用命令dis ip routing-table2台交换机进行查看,发现均有对外的缺省路由
图片17.png
图片18.png
8.验证总公司和分公司是否可以正常通讯
1.查看2边的路由表发现相互之间已经有对端隧道ip的路由表,两端任意电脑可以进行通讯,说明隧道配置成功
图片19.png
图片20.png
图片21.png
9、验证NAT server 是否可以从外网访问到SW1
1.isptelnet到 交换机1发现可以通讯,说明验证成功
图片22.png
四、配置命令
SW3配置
其他相同配置不做解析
vlan batch 8 to 10  //配置多个vlan
#
stp edged-port default //全部设置边缘端口
stp mode rstp  //stp模式为rstp模式
stp bpdu-protection //开启BPDU保护,防止误接其他交换机
interface GigabitEthernet0/0/1
port link-type trunk  //接口设置为trunk模式
port trunk allow-pass vlan 2 to 4094  //接口允许所有vlan数据通过
stp edged-port disable  //当前接口关闭边缘端口
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
stp edged-port disable
interface GigabitEthernet0/0/4
port link-type access  //接口设置为access模式
port default vlan 8  //接口允许vlan 8数据通过
interface GigabitEthernet0/0/10
port link-type access
port default vlan 8
stp edged-port disable
#
interface GigabitEthernet0/0/11
port link-type access
port default vlan 9
stp edged-port disable
#
interface GigabitEthernet0/0/12
port link-type access
port default vlan 10
SW1配置
vlan batch 8 to 11  
#
stp edged-port default  
stp mode rstp
stp  priority 0  // 设置当前交换机最优权限,为根交换机
#
lacp priority 0  //设置当前交换机lacp最优权限,为主端口
interface Vlanif8  //创建三层虚拟子接口
ip address 192.168.8.252 255.255.255.0 //三层虚拟子接口配置ip
vrrp vrid 8 virtual-ip 192.168.8.254 //配置vrrp虚拟网关
vrrp vrid 8 priority 200 //配置vrrp权限(默认权限100,数值高的为主虚拟路由)
ospf enable 10 area 0.0.0.0 //当前接口宣告ospf进程10加入区域0
#
interface Vlanif9
ip address 192.168.9.252 255.255.255.0
vrrp vrid 9 virtual-ip 192.168.9.254
vrrp vrid 9 priority 200
ospf enable 10 area 0.0.0.0
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 200
ospf enable 10 area 0.0.0.0
#
interface Vlanif11
ip address 192.168.11.2 255.255.255.0
ospf enable 10 area 0.0.0.0
#
interface Eth-Trunk1  //创建链路聚合接口
port link-type trunk
port trunk allow-pass vlan 8 to 10
stp edged-port disable
mode lacp-static  //链路聚合模式为lacp自动模式
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 11
stp edged-port disable
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
stp edged-port disable
#
interface GigabitEthernet0/0/5
eth-trunk 1  //当前接口加入链路聚合端口
#
interface GigabitEthernet0/0/6
eth-trunk 1
ospf 10 router-id 2.2.2.2  //创建ospf进程10 ,路由ID2.2.2.2
area 0.0.0.0 //ospf进程下创建区域0
user-interfac vty 0 4  //创建远程线路
user privilege level 15  //远程线路用户权限为15
set authentication password simple qyt //vty 0 4用户密码为qyt
#
rotocol  inbound telnet  //vty线路下开Telnet
SW3配置
vlan batch 8 to 10 12
#
stp edged-port default
stp mode rstp
stp instance 0 priority 4096
#
interface Vlanif8
ip address 192.168.8.253 255.255.255.0
vrrp vrid 8 virtual-ip 192.168.8.254
ospf enable 10 area 0.0.0.0
#
interface Vlanif9
ip address 192.168.9.253 255.255.255.0
vrrp vrid 9 virtual-ip 192.168.9.254
ospf enable 10 area 0.0.0.0
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
ospf enable 10 area 0.0.0.0
#
interface Vlanif12
ip address 192.168.12.2 255.255.255.0
ospf enable 10 area 0.0.0.0
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 8 to 10
stp edged-port disable
mode lacp-static
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 8 to 10
stp edged-port disable
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 12
stp edged-port disable
interface GigabitEthernet0/0/5
eth-trunk 1
#
interface GigabitEthernet0/0/6
eth-trunk 1
#
ospf 10 router-id 3.3.3.3
area 0.0.0.0
R1配置
sysname R1
acl number 2000  //设置使用基础acl 2000
rule 5 permit source 192.168.8.0 0.0.0.255 //规则5运行源192.168.8.0/24网段数据通过
rule 10 permit source 192.168.9.0 0.0.0.255
rule 15 permit source 192.168.10.0 0.0.0.255
#
interface Serial1/0/0
link-protocol ppp
ip address 12.1.1.1 255.255.255.252
ospf enable 10 area 0.0.0.0
nat outbound 2000  //出接口nat地址转换调用acl 2000
interface GigabitEthernet0/0/0
ip address 202.100.1.1 255.255.255.252
ospf enable 10 area 0.0.0.0
nat server protocol tcp global current-interface 2323 inside 192.168.11.2 telne
t    //nat server 内网ip和端口转换为当前外网接口的ip和端口
nat outbound 2000  //出接口nat地址转换调用acl 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.11.1 255.255.255.0
ospf enable 10 area 0.0.0.0
#
interface GigabitEthernet0/0/2
ip address 192.168.12.1 255.255.255.0
ospf enable 10 area 0.0.0.0
#
#
interface Tunnel0/0/0  //创建虚拟隧道接口
ip address 20.1.1.1 255.255.255.252 //配置虚拟隧道接口ip
tunnel-protocol gre  //虚拟隧道模式为GRE模式
source 202.100.1.1  //虚拟隧道源地址
destination 61.128.1.1//虚拟隧道目的地址
#
ospf 10 router-id 1.1.1.1
default-route-advertise  //ospf 10进程下创建对外的默认路由
area 0.0.0.0
#
ip route-static 0.0.0.0 0.0.0.0 202.100.1.2  //到服务商的默认路由
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2    //到服务商的备份路线默认路由
ip route-static 61.128.1.0 255.255.255.252 202.100.1.2 //直连路由
ip route-static 192.168.20.0 255.255.255.0 20.1.1.2 //配置一条明细路由,下一跳是对端的隧道地址
ip route-static 192.168.30.0 255.255.255.0 20.1.1.2
ip route-static 202.100.1.0 255.255.255.0 61.128.1.2
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
ISP配置
nterface Serial1/0/0
link-protocol ppp
ip address 12.1.1.2 255.255.255.252   
#
interface GigabitEthernet0/0/0
ip address 202.100.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 61.128.1.2 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0  //创建环回接口
ip address 8.8.8.8 255.255.255.255  //设置环回接口ip
R3配置
sysname R3
acl number 2000  
rule 5 permit source 192.168.20.0 0.0.0.255
rule 10 permit source 192.168.30.0 0.0.0.255
#
interface GigabitEthernet0/0/0.20  //创建单臂路由虚拟子接口
dot1q termination vid 20  //虚拟纸接口vidvlan相对应
ip address 192.168.20.254 255.255.255.0  //设置虚拟子接口ip
arp broadcast enable  //开启虚拟子接口arp广播(华为默认在虚拟子接口应用中关闭arp需要手工开启)
#
interface GigabitEthernet0/0/0.30
dot1q termination vid 30
ip address 192.168.30.254 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/1
ip address 61.128.1.1 255.255.255.252
nat outbound 2000 //出接口地址转换调用acl 2000
#
interface Tunnel0/0/0
ip address 20.1.1.2 255.255.255.252
tunnel-protocol gre
source 61.128.1.1
destination 202.100.1.1
#
ip route-static 0.0.0.0 0.0.0.0 61.128.1.2  //到服务商的默认路由
ip route-static 61.128.1.0 255.255.255.0 202.100.1.2  //到总公司的静态路由
ip route-static 192.168.8.0 255.255.255.0 20.1.1.1  //一条明细路由,下一跳是对端的隧道地址
ip route-static 192.168.9.0 255.255.255.0 20.1.1.1
ip route-static 192.168.10.0 255.255.255.0 20.1.1.1
ip route-static 202.100.1.0 255.255.255.252 61.128.1.2
SW4的配置
<SW4>dis cu
#
sysname SW4
#
vlan batch 20 30
interface GigabitEthernet0/0/1
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 30
interface GigabitEthernet0/0/10
port link-type trunk
port trunk allow-pass vlan 2 to 4094

图片14.png
发表于 2023-5-23 15:31:59 | 显示全部楼层
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
板凳 2023-5-23 15:31:59 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2023-10-30 20:35:33 | 显示全部楼层
这个必须顶
6# 2023-10-30 20:35:33 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2024-3-12 16:05:20 | 显示全部楼层
7# 2024-3-12 16:05:20 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-5-22 10:15 , Processed in 0.070405 second(s), 9 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表