赞
踩
笔记本电脑,配置如下:Windows10企业版,32GB内存
eNSP1.3.00
0、总体拓扑如下:
1、2台PC,1台代表教学楼的网络,1台代表宿舍楼的网络。
2、2台交换机,1台为接入交换机acsw,1台为核心交换机(网关)coresw。
3、3台路由器,1台为出口路由器,1台代表电信服务器,1台代表联通服务器。
4、启动设备。
1、PC1和PC2配置使用DHCP
2、出口路由器配置IP
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname router
[router]int g0/0/0
[router-GigabitEthernet0/0/0]ip add 12.1.1.3 24
[router-GigabitEthernet0/0/0]int g0/0/1
[router-GigabitEthernet0/0/1]ip add 192.168.30.3 24
[router-GigabitEthernet0/0/1]int g0/0/2
[router-GigabitEthernet0/0/2]ip add 23.1.1.3 24
[router-GigabitEthernet0/0/2]quit
[router]display ip interface brief
3、电信路由器配置IP,并且配置完成后ping,ping是一个好习惯,确保每步配置都是正确的,防止到最后一步才发现错了,难以定位问题。
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname DIANXIN
[DIANXIN]int g0/0/0
[DIANXIN-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[DIANXIN-GigabitEthernet0/0/0]int g0/0/1
[DIANXIN-GigabitEthernet0/0/1]ip add 100.1.1.1 24
[DIANXIN-GigabitEthernet0/0/1]quit
[DIANXIN]int LoopBack 0
[DIANXIN-LoopBack0]ip add 1.1.1.1 24
[DIANXIN-LoopBack0]quit
[DIANXIN]ping 12.1.1.3
4、联通路由器配置IP,配置环回口地址,并且配置完成后ping。
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname LIANTONG
[LIANTONG]int g0/0/0
[LIANTONG-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[LIANTONG-GigabitEthernet0/0/0]int g0/0/1
[LIANTONG-GigabitEthernet0/0/1]ip add 100.1.1.2 24
[LIANTONG-GigabitEthernet0/0/1]int LoopBack 0
[LIANTONG-LoopBack0]ip add 2.2.2.2 24
[LIANTONG-GigabitEthernet0/0/1]ping 23.1.1.3
[LIANTONG-GigabitEthernet0/0/1]ping 100.1.1.1
5、接入交换机改名
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname acsw
6、核心交换机改名
<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname coresw
1、进入接入交换机CLI,先创建两个VLAN:
<acsw>system-view
Enter system view, return user view with Ctrl+Z.
[acsw]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
2、配置access口:将接口1绑定到VLAN 10,port的link-type有四种类型,其中access用于接用户,trunk接交换机,hybrid混合,QinQ用于城域网(将用户的VLAN封装到城域网的VLAN)
[acsw]int g0/0/1
[acsw-GigabitEthernet0/0/1]port link-type access
[acsw-GigabitEthernet0/0/1]port default vlan 10
3、配置access口:同理配置接口2和VLAN 20:
[acsw]int g0/0/2
[acsw-GigabitEthernet0/0/2]port link-type access
[acsw-GigabitEthernet0/0/2]port default vlan 20
[acsw-GigabitEthernet0/0/2]quit
4、配置trunk口:配置接口3为trunk口,并允许所有vlan通过:
[acsw]int g0/0/3
[acsw-GigabitEthernet0/0/3]port link-type trunk
[acsw-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[acsw-GigabitEthernet0/0/3]quit
1、进入coresw的CLI,先创建VLAN
<coresw>system-view
[coresw]vlan batch 10 20 30
2、配置下行接口为trunk口,并允许VLAN10和20通过:
[coresw]int g0/0/2
[coresw-GigabitEthernet0/0/2]port link-type trunk
[coresw-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20
[coresw-GigabitEthernet0/0/2]quit
3、配置网关:配置VLAN10和20的两个VLANIF,这样才能做网关。
[coresw]interface vlanif 10
[coresw-Vlanif10]ip add 192.168.10.254 24
[coresw-Vlanif10]interface vlanif 20
[coresw-Vlanif20]ip add 192.168.20.254 24
[coresw-Vlanif20]quit
4、启动DHCP
[coresw]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
5、先配置IP地址池
[coresw]ip pool 10
Info:It's successful to create an IP address pool.
[coresw-ip-pool-10]network 192.168.10.0 mask 24
[coresw-ip-pool-10]gateway-list 192.168.10.254
[coresw-ip-pool-10]dns-list 8.8.8.8
[coresw-ip-pool-10]lease day 3
[coresw-ip-pool-10]excluded-ip-address 192.168.10.2 192.168.10.253
[coresw-ip-pool-10]quit
6、然后在VLANIF接口上配置DHCP,使用global时,会根据VLAN分配与VLAN接口相同网段的地址池
[coresw]int vlanif 10
[coresw-Vlanif10]dhcp select global
7、查看PC1(VLAN 10系)的IP配置,果然已经分配到地址:
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fece:10eb
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.254
Physical address..................: 54-89-98-CE-10-EB
DNS server........................: 8.8.8.8
8、同理配置VLAN20的地址池和DHCP,然后查看PC2,已获得IP地址192.168.20.1
[coresw-Vlanif10]ip pool 20
[coresw-ip-pool-20]network 192.168.30.0 mask 24
[coresw-ip-pool-20]undo network
[coresw-ip-pool-20]network 192.168.20.0 mask 24
[coresw-ip-pool-20]gateway-list 192.168.20.254
[coresw-ip-pool-20]dns-list 114.114.114.114
[coresw-ip-pool-20]lease day 3
[coresw-ip-pool-20]excluded-ip-address 192.168.20.2 192.168.20.253
[coresw-ip-pool-20]quit
[coresw]interface vlanif 20
[coresw-Vlanif20]dhcp select global
9、从PC1 ping PC2,发现可以Ping通,tracert可以看到路由情况。因为PC2不在PC1的网段,所以会把包扔给网关。而在网关上可以看到20网段的路由。这样就用三层交换机实现了跨VLAN的通信。
PC>tracert 192.168.20.1
traceroute to 192.168.20.1, 8 hops max
(ICMP), press Ctrl+C to stop
1 192.168.10.254 47 ms 47 ms 47 ms
2 192.168.20.1 78 ms 94 ms 93 ms
1、本来可以再核心交换机和出口路由器的端口上配置IP即可。但eNSP上华为的三层交换机不能直接给接口配IP。所以只能先配置VLAN,然后VLANIF绑定IP。
2、在coresw上配置VLAN,再通过VLAN绑定IP:
[coresw]int vlanif 30
[coresw-Vlanif30]ip add 192.168.30.254 24
[coresw-Vlanif30]quit
[coresw]int g0/0/1
[coresw-GigabitEthernet0/0/1]port link-type access
[coresw-GigabitEthernet0/0/1]port default vlan 30
[coresw-GigabitEthernet0/0/1]quit
3、在出口路由器上的端口上直接配置IP,然后发觉可以ping同192.168.30.254即核心交换机了。
[router]int g0/0/1
[router-GigabitEthernet0/0/1]ip add 192.168.30.3 24
[router-GigabitEthernet0/0/1]quit
[router]ping 192.168.30.254
1、其实现在PC ping出口路由器,出口路由器已经能收到IICMP包,但无法回包,因为路由器上没有回10网段或20网段的路由。
1、最简单的简单方法就是在路由器上写静态路由。
[router]ip route-static 192.168.10.0 255.255.255.0 192.168.30.254
[router]ip route-static 192.168.20.0 255.255.255.0 192.168.30.254
1、先在出口路由器上删除静态路由:
[router]undo ip route-static 192.168.10.0 255.255.255.0 192.168.30.254
[router]undo ip route-static 192.168.20.0 255.255.255.0 192.168.30.254
2、在出口路由器上配置RIP:
[router]rip
[router-rip-1]version 2
[router-rip-1]network 192.168.30.0
[router-rip-1]quit
3、在核心交换机上配置RIP:
[coresw]rip
[coresw-rip-1]version 2
[coresw-rip-1]network 192.168.10.0
[coresw-rip-1]network 192.168.20.0
[coresw-rip-1]network 192.168.30.0
4、这时PC和路由器又可以互通了。
1、先在路由器和核心交换机上删除RIP
[coresw]undo rip 1
Warning: The RIP process will be deleted. Continue?[Y/N]y
[router]undo rip 1
Warning: The RIP process will be deleted. Continue?[Y/N]y
2、在核心交换机上配置OSPF:
[coresw]ospf 1
[coresw-ospf-1]area 0
[coresw-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[coresw-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[coresw-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
3、在出口路由器上配置OSPF:
[router]ospf 1
[router-ospf-1]area 0
[router-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
4、在路由器上可以看到通过OSPF学到了10和20网段的路由:
5、而且这时PC和路由器可以互通了。
1、在电信服务器上配置RIP,注意RIP只宣告网络号:
[DIANXIN]rip 1
[DIANXIN-rip-1]network 100.0.0.0
[DIANXIN-rip-1]network 12.0.0.0
[DIANXIN-rip-1]network 1.0.0.0
[DIANXIN-rip-1]quit
2、在联通服务器上配置RIP:
[LIANTONG]rip 1
[LIANTONG-rip-1]network 100.0.0.0
[LIANTONG-rip-1]network 23.0.0.0
[LIANTONG-rip-1]network 2.0.0.0
[LIANTONG-rip-1]quit
3、这时在电信服务器可以ping通联通服务器的环回口2.2.2.2了。
1、在出口路由器上先配置ACL:
[router]acl 2000
[router-acl-basic-2000]rule 10 permit source 192.168.10.0 0.0.0.255
[router-acl-basic-2000]rule 20 permit source 192.168.20.0 0.0.0.25
[router-acl-basic-2000]quit
2、在到电信的接口上配置easyIP:
[router]int g0/0/0
[router-GigabitEthernet0/0/0]nat outbound 2000
[router-GigabitEthernet0/0/0]quit
3、在到联通的接口上配置easyIP:
[router]int g0/0/2
[router-GigabitEthernet0/0/2]nat outbound 2000
[router-GigabitEthernet0/0/2]quit
4、这时在PC1上ping 电信服务器,仍然ping不通。这时查看核心路由器即默认网关,发觉没有默认路由:
1、在核心路由器上配置默认路由,发觉PC可以ping通电信和联通服务器了。
[coresw]ip route-static 0.0.0.0 0.0.0.0 192.168.30.3
1、在出口路由器上配置RIP,然后发现PC可以ping通电信和联通的环回口(用来模拟其服务器)了。
[router]rip 1
[router-rip-1]network 12.0.0.0
[router-rip-1]network 23.0.0.0
1、先在出口路由器删除RIP
[router]undo rip 1
Warning: The RIP process will be deleted. Continue?[Y/N]y
2、这时发觉PC就ping不通电信和联通了。
3、在出口路由器上配置默认路由,其中到电信的默认路由优先级调整为50(默认路由的优先级默认为60),50比60小,因此50优先级的默认路由器优先级更高。
[router]ip route-static 0.0.0.0 0 12.1.1.1 preference 50
[router]ip route-static 0.0.0.0 0 23.1.1.2
4、可以看到现在在出口路由器上起作用的默认路由指向电信:
5、在PC上ping联通的2.2.2.2,可以通。通过tracert发觉虽然ping的事联通服务器,却会经过电信服务器,就是因为默认路由的配置的优先级的关系。
BFD是一种双向转发检测机制,可以提供毫秒级的检测,可以实现链路的快速检测,BFD通过与上层路由协议联动,可以实现路由的快速收敛,确保业务的永续性。BFD Echo报文采用UDP封装,目的端口号为3784
1、在路由器上先把默认路由删除:
[router]undo ip route-static 0.0.0.0 0 12.1.1.1 preference 50
[router]undo ip route-static 0.0.0.0 0 23.1.1.2
1、在路由器做BFD配置:
[router]bfd
[router-bfd]bfd dianxin bind peer-ip 12.1.1.1 source-ip 12.1.1.3 auto
[router-bfd-session-dianxin]quit
2、在电信服务器上配置BFD:
[DIANXIN]bfd
[DIANXIN-bfd]bfd dianxin bind peer-ip 12.1.1.3 source-ip 12.1.1.1 auto
[DIANXIN-bfd-session-dianxin]quit
3、可以通过display bfd session all
命令查看BFD session
1、在出口路由器配置第一条默认路由,优先级为50,跟踪BFD,BFD连通了才生效。
[router]ip route-static 0.0.0.0 0 12.1.1.1 preference 50 track bfd-session dianxin
2、再配置一条默认路由指向联通:
[router]ip route-static 0.0.0.0 0 23.1.1.2
3、通过display ip routing-table
查看当前生效路由:
4、通过display current-configuration
可以看到实际配了两条静态路由:
1、关闭电信g0/0/0端口
[DIANXIN]int g0/0/0
[DIANXIN-GigabitEthernet0/0/0]shutdown
2、发觉PC仍然可以ping通2.2.2.2。然后display看到已切换到联通默认路由
3、重新打开电信g0/0/0端口
[DIANXIN]int g0/0/0
[DIANXIN-GigabitEthernet0/0/0]undo shutdown
4、这时发觉又会切回电信默认路由
1、在路由器上先把默认路由删除:
[router]undo ip route-static 0.0.0.0 0 12.1.1.1 preference 50
[router]undo ip route-static 0.0.0.0 0 23.1.1.2
2、配置ACL,匹配流量
[router]acl 2010
[router-acl-basic-2010]rule 10 permit source 192.168.10.0 0.0.0.255
[router-acl-basic-2010]acl 2020
[router-acl-basic-2020]rule 10 permit source 192.168.20.0 0.0.0.255
[router-acl-basic-2020]quit
3、配置流分类
[router]traffic classifier jiaoxue
[router-classifier-jiaoxue]if-match acl 2010
[router-classifier-jiaoxue]traffic classifier tushuguan
[router-classifier-tushuguan]if-match acl 2020
[router-classifier-tushuguan]quit
4、配置流行为
[router]traffic behavior re-dianxin
[router-behavior-re-dianxin]redirect ip-nexthop 12.1.1.1
[router-behavior-re-dianxin]traffic behavior re-liantong
[router-behavior-re-liantong]redirect ip-nexthop 23.1.1.2
[router-behavior-re-liantong]quit
5、配置流策略,将流分类和刘行为绑定
[router]traffic policy p
[router-trafficpolicy-p]classifier jiaoxue behavior re-dianxin
[router-trafficpolicy-p]classifier tushuguan behavior re-liantong
[router-trafficpolicy-p]quit
6、在入接口应用流策略。注意一定要在入接口应用。
[router]int g0/0/1
[router-GigabitEthernet0/0/0]traffic-policy p inbound
7、在教学楼区域的PC1上tracert,发觉走的是电信服务器
8、在图书馆区域的PC2上tracert,发觉走的是联通服务器
方法和策略路由二差不多,只不过要修改ACL,之前匹配的是源,现在要改的是匹配的是目标。
1、配置ACL,注意要用3000以上序号:
[router]acl 3010
[router-acl-adv-3010]rule 10 permit ip source any destination 1.1.1.0 0.255.255.255
[router-acl-adv-3010]acl 3020
[router-acl-adv-3020]rule 10 permit ip source any destination 2.2.2.0 0.255.255.255
[router-acl-adv-3020]quit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。