7.在公司内部运行 OSPF ,确保不同 VLAN 之间是互通的。 不同的 VLAN 属于不同的区域。
同时保护 web 和 dhcp 服务器所在的区域不受到外部链路以及其他区域 的不稳定的链路的影响。
8.公司的出口路由器为 R2 和 R4 ,但是永远将 R2 作为主出口,出现故障 后,出网流量才会自动的切换到 R4 。修复以后,会再次从 R2 转发。
9.内网大量主机都存在访问 Internet的需求,要求使用最节省IP地址的 方式实现内网主机上网,但是 vlan 40 属于机密部分,不能访问外网。
10.外网的用户(client-1),可以访问内部的 web 服务器。
11.外网的用户(SW10),可以远程控制内网的交换机网络设备(不包括R2/R4), 远程访问密码均设置为 HCIE 。 (内网中每个设备的管理IP地址,属于管理 VLAN 199)
AR3:
undo terminal monitor system-view interface gig0/0/2 ip address 200.1.1.3 24 quitAR4
undo terminal monitor system-view sysname AR4 interface gig0/0/1 ip address 200.1.1.1 24 interface gig0/0/0 ip address 192.168.25.4 24 interface gig0/0/2 ip address 192.168.26.4 24 quit ip route-static 0.0.0.0 0.0.0.0 200.1.1.3 ospf 1 route-id 4.4.4.4 area 0 network 192.168.25.0 0.0.0.255 network 192.168.26.0 0.0.0.255 quit default-route-advertise cost 2 quit acl 2000 rule 10 deny source 192.168.40.0 0.0.0.255 rule 20 permit source any quit interface gig0/0/2 nat outbound 2000 quitSW5
undo terminal monitor system-view vlan 25 quit interface gig 0/0/2 port link-type access port default vlan 25 quit interface vlanif 25 ip address 192.168.25.5 24 quit ospf 1 area 0 network 192.168.25.0 0.0.0.255 quit quitSW6
undo terminal monitor system-view vlan 26 quit interface gig 0/0/2 port link-type access port default vlan 26 quit interface vlanif 26 ip address 192.168.26.6 24 quit ospf 1 area 0 network 192.168.26.0 0.0.0.255 quit quit到此,内网的设备都可以通过 R4 去访问外网 将R1的 gi0/0/1 断开,然后用内网 PC 访问 外网的 Server2
原因:
在边界 R4 上,去往内网 SW1/2/3/4 的管理IP地址(vlanif 199),存在两个路由条目。导致:
SW1/2/3/4 返回给外网设备数据的时候,返回路径与进入内网的路径,有可能不一致;所有,我们使用下面的解决办法:
R4:【让R4去往 vlan199 时,仅仅存在一个路径,下一跳IP为 SW5】vlan199的主网关在SW5. interface gi0/0/2 ospf cost 10 quit-SW5:
ospf 1 area 88 stub no-summary quit-SW6:
ospf 1 area 66 stub no-summary quit-R2:
interface gi0/0/0 ospf network-type p2p quit interface gi0/0/2 ospf network-type p2p quit-R4:
interface gi0/0/0 ospf network-type p2p quit interface gi0/0/1 ospf network-type p2p quit-SW5:
interface vlanif 15 ospf network-type p2p quit interface vlanif 25 ospf network-type p2p quit-SW6:
interface vlanif 16 ospf network-type p2p quit interface vlanif 26 ospf network-type p2p quitlldp enable {在互联的设备上都开启} display lldp neighbor brief
[R4] lldp enable //全局开启 LLDP 功能; [SW5] lldp enable //全局开启 LLDP 功能; [SW5]display lldp neighbor brief // 查看 LLDP 邻居关系Local Intf — Neighbor Dev ---- Neighbor Intf ---- Exptime
GE0/0/2 --------- R2 ------------------ GE0/0/0 ---------- 119
@Local Intf ,设备本地的接口,即 SW5 的 gi0/0/2 @Neighbor Dev ,邻居设备的名字,即 R4 @Neighbor Intf,邻居设备的接口,即 Gi0/0/0
综合描述为:
SW5的 gi0/0/2 ,连接着 R4 的 gi0/0/0分析: 如果需要对远程登陆的设备进行流量控制,则必须在 SW1/2/3/4 的 vty 虚拟线路下面 配置 ACL,并且仅仅允许 “指定”的 源IP地址。 虽然外网的公网IP地址是固定的,不变的; 但是内网的PC2是通过 DHCP 自动获取IP地址,所以不容易控制。
为了实现需求, 我们必须“让DHCP服务器每次给 PC2 自动分配IP地址时,总是分配相同的IP地址,比如20.22”
配置:
AR1-dhcp
ip pool VLAN20 static-bind ip-address 192.168.20.22 mac-address 5489-9823-2b6f quit分析:
PC的IP地址,与主机的网关IP地址,都是同一个网段; PC去往自己的网关时,中间经过的是“交换”链路; 交换链路的路径选择,是由 STP 协议决定。 为了确保每个主机去往主机网关时,所走的路径是最优的,
我们需要:
将每个VLAN的根交换机与主网关,放在同一个设备上。 所以,我们需要在每个交换机上配置 MSTP
配置命令:
SW1/2/3/4/5/6:
stp mode mstp stp region-configuration region-name HCIE instance 1 vlan 10 instance 2 vlan 20 instance 3 vlan 30 instance 4 vlan 40 instance 6 vlan 66 instance 8 vlan 88 instance 9 vlan 199 active region-configuration quitSW5:
stp instance 1 priority 0 stp instance 2 priority 0 stp instance 3 priority 4096 stp instance 4 priority 4096SW6:
stp instance 3 priority 0 stp instance 4 priority 0 stp instance 1 priority 4096 stp instance 2 priority 4096流程:
1.PC8的IP地址属于 vlan 30,比如:192.168.30.250/24 并且需要访问的目标IP地址是:123.1.1.1 (server2) 所以,可以判断两个IP地址不是同一个网段; 所以,PC8 就会将数据包发送给主机的网关(192.168.30.254,即 vrrp 30 的主网关 SW6)
2.SW4 在 gi0/0/8 接口收到 PC8 发送的数据,首先为该数据打标签 vlan 30 , 因为PC8属于 vlan 30,所以SW4 会首先查看一下 vlan 30 属于哪个 mstp (instance 3) 并且基于 MSTP instance 3 的配置,来判断 SW4 上的哪个链路是互通的:
<SW4>display stp instance 3 briefMSTID Port Role STP State Protection
3 GigabitEthernet0/0/8 DESI FORWARDING NONE 3 GigabitEthernet0/0/14 ALTE DISCARDING NONE 3 GigabitEthernet0/0/24 ROOT FORWARDING NONE
查看该端口对端的设备:
<SW4>display lldp neighbor briefLocal Intf Neighbor Dev Neighbor Intf Exptime
GE0/0/14 SW5 GE0/0/14 111 GE0/0/24 SW6 GE0/0/24 93
通过以上信息显示,我们得知,SW4 将PC8 的数据,发送给了 SW6 。
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 192.168.16.1 Vlanif16Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 100.1.1.3 GigabitEthernet0/0/1通过以上信息显示,我们得知,R2 将数据包转发给了 R3。 但是,我们在该接口(gi0/0/1)上配置了 EasyIP ,并且该转发的数据包的源IP地址是 192.168.30.250,符合 ACL 2000 的要求,允许进行 NAT 转换,
所以,从该接口(gi0/0/1)出去的时候,将源IP地址 192.168.30.250 转换成了:100.1.1.1。 并且在 R2 的 nat 表,形成了对应的转换条目,比如: 192.168.30.250:随机 ------ 100.1.1.1:随机端口号
Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.30.0/24 OSPF 10 2 D 192.168.15.5 GigabitEthernet0/0/0
通过以上信息显示,我们得知,R2 将数据包转发给了 SW5 。
因为,我们通过配置 MSTP,将 SW6 配置为 vlan 30 的根交换机,SW5是备份的根交换机 所以,针对 VLAN 30 而言, SW5到SW4之间的链路是堵塞的, 所以,SW5将数据包发送给PC8 时,数据转发路径为:
SW5 ---- SW6 — SW4 — PC8
总结:
IP/DHCP vlan trunk access:没问题 stp: vlanif: vrrp : ospf : 默认路由: easyIP: nat server: acl:
----------------lldp --------------------------------
display lldp neighbor brief --> 查看 LLDP 邻居表的信息;