您的位置:首页 > 运维架构 > 网站架构

园区网架构设计 / 升级--2--汇聚层和核心层配置

2020-07-18 04:47 1011 查看


​接上次发布的配置:
实现内部核心层网络的通信和流量要求。

建立ospf区域来管理内部的路由,要求4个部门分别处于不同的区域

AR2

undo terminal monitor
system-view
sysname AR2
interface gig0/0/1
ip address 100.1.1.1 24
interface gig0/0/0
ip address 192.168.15.1 24
interface gig0/0/2
ip address 192.168.16.1 24
quit
ip route-static 0.0.0.0 0.0.0.0 100.1.1.3

ospf 1 router-id 1.1.1.1
area 0
network 192.168.15.0 0.0.0.255
network 192.168.16.0 0.0.0.255
quit
default-route-advertise
quit

SW5

ospf 1 router-id 5.5.5.5
area 0
network 192.168.15.0 0.0.0.255
quit
area 10
network 192.168.10.0 0.0.0.255
quit
area 20
network 192.168.20.0 0.0.0.255
quit
area 30
network 192.168.30.0 0.0.0.255
quit
area 40
network 192.168.40.0 0.0.0.255
quit
area 88
network 192.168.88.0 0.0.0.255
quit
quit

SW6

ospf 1 router-id 6.6.6.6
area 0
network 192.168.16.0 0.0.0.255
quit
area 10
network 192.168.10.0 0.0.0.255
quit
area 20
network 192.168.20.0 0.0.0.255
quit
area 30
network 192.168.30.0 0.0.0.255
quit
area 40
network 192.168.40.0 0.0.0.255
quit
area 66
network 192.168.66.0 0.0.0.255
quit
quit

AR3

undo terminal monitor
system-view
sysname AR3
interface gi0/0/1
ip address 100.1.1.3  24
quit

此时,再去查看 SW5/6 ,就能看到 OSPF 默认路由。

如果SW5连接R2的线路故障,会出现什么问题,有哪几个解决方案?

如果SW6连接R2的线路故障,会出现什么问题,有哪几个解决方案?

如果SW5与R2断开:

那么SW5就无法学习默认路由,所以VLAN10/20的主机访问外网时,就会受到影响。因为 SW5 是 vlan10/20 的主网关。

解决方案1:即在SW5上配置 VRRP 链路跟踪

SW5:

interface vlanif 10
vrrp vrid 10 track interface gi0/0/1  reduced  110
quit
interface vlanif 20
vrrp vrid 20 track interface gi0/0/1  reduced  110
quit

[扩展】如果该问题发生在 SW6 上,那么解决办法类似:

SW6:

interface vlanif 30
vrrp vrid 30 track interface gi0/0/1  reduced  110
quit
interface vlanif 40
vrrp vrid 40 track interface gi0/0/1  reduced  110
quit

解决方案2:即在 SW5/6 之间,建立一个新的网段,然后建立 OSPF 邻接关系。

SW5:

vlan 56
quit
interface vlanif 56
ip address  192.168.56.5 24
quit
ospf 1
area 0
network 192.168.56.0 0.0.0.255
quit
quit

SW6:

vlan 56
quit
interface vlanif 56
ip address  192.168.56.6 24
quit
ospf 1
area 0
network 192.168.56.0 0.0.0.255
quit
quit

SW1/2/3/4:

vlan  56
quit


需要实现内网中的PC(除了vlan40)可以ping通 Server2(123.1.1.1/24)

因为外网是模拟,所以呀进行模拟配置。

AR3:

undo terminal monitor
system-view
interface gi0/0/0
ip address  123.1.1.254  24
quit

SW10:

undo terminal monitor
system-view
sysname SW10
port-group group-member gi0/0/1 to gi0/0/3
port link-type  access
port default vlan  1
quit

Server2:

123.1.1.1
255.255.255.0
123.1.1.254

Client2:

123.1.1.2
255.255.255.0
123.1.1.254

AR2:配置公司边界设备的 NAT (EasyIP)

undo terminal monitor
system-view
acl 2000
rule 10 deny   source  192.168.40.0  0.0.0.255
rule 20 permit source any
interface gi0/0/1
nat  outbound  2000

经过上述配置之后,内网PC可以正常访问外部服务器 server 2 。

AR2:
需求1:为了实现外网设备 Client1 访问内网的 Web 服务器 (server1),我们在边界设备上配置 NAT Server 。【需要额外购买公网IP地址】

interface gi0/0/1
nat  server  protocol tcp  global 100.1.1.11 80 inside 192.168.88.1  80
quit

需求2:配置 NAT server ,实现外网设备 SW10(123.1.1.10/24) 可以远程登录内网设备

SW1(192.168.199.1/24),用户名/密码:HuaWei/HCIE
SW2(192.168.199.2/24),用户名/密码:HuaWei/HCIE
SW3(192.168.199.3/24),用户名/密码:HuaWei/HCIE
SW4(192.168.199.4/24),用户名/密码:HuaWei/HCIE
并且,外网登陆时,使用的公网IP地址是:100.1.1.11 。

@配置外网设备SW10

interface vlanif 1
ip address 123.1.1.10  24
quit

ip route-static 0.0.0.0  0  123.1.1.254

@配置边界设备(AR2)上的 nat server

interface gi0/0/1
nat server protocol tcp global 100.1.1.11  2001  inside 192.168.199.1 23
nat server protocol tcp global 100.1.1.11  2002  inside 192.168.199.2 23
nat server protocol tcp global 100.1.1.11  2003  inside 192.168.199.3 23
nat server protocol tcp global 100.1.1.11  2004  inside 192.168.199.4 23
quit

为了让 R1 获得 VLAN 199 网段的路由,我们在 SW5/6 上配置并宣告 VLAN 199

SW5:

vlan 199
quit
interface vlanif 199
ip address 192.168.199.251  24
quit
ospf  1
area  199
network 192.168.199.0  0.0.0.255
quit
quit

SW6:

vlan 199
quit
interface vlanif 199
ip address 192.168.199.252  24
quit
ospf  1
area  199
network 192.168.199.0  0.0.0.255
quit
quit

为了能够让外部设备远程登陆 SW1/2/3/4 ,所以为它们配置地址和 telnet 服务。

SW1:

vlan 199
quit
interface vlanif 199
ip address 192.168.199.1  24
quit
user-interface vty  0 4
authentication-mode  aaa
quit
aaa
local-user  HuaWei  password  cipher  HCIE
local-user  HuaWei  service-type  telnet
quit

SW2

vlan 199
quit
interface vlanif 199
ip address 192.168.199.2  24
quit
user-interface vty  0 4
authentication-mode  aaa
quit
aaa
local-user  HuaWei  password  cipher  HCIE
local-user  HuaWei  service-type  telnet
quit

SW3

vlan 199
quit
interface vlanif 199
ip address 192.168.199.3  24
quit
user-interface vty  0 4
authentication-mode  aaa
quit
aaa
local-user  HuaWei  password  cipher  HCIE
local-user  HuaWei  service-type  telnet
quit

SW4

vlan 199
quit
interface vlanif 199
ip address 192.168.199.4  24
quit
user-interface vty  0 4
authentication-mode  aaa
quit
aaa
local-user  HuaWei  password  cipher  HCIE
local-user  HuaWei  service-type  telnet
quit

此时:
外网的 telnet 请求可以发送到内网的 SW1/2/3/4 ,
但是:SW1/2/3/4 没有办法给 SW10 返回一个数据包,
因为:SW1/2/3/4 没有去往 SW10所在的外网的路由条目;
所以,我们需要为 VLAN 199 创建一个网关,并且为了更加的可靠和冗余,
我们建议为 VLAN 199 部署 VRRP ,并且 SW5 是主网关,SW6是备份网关。
虚拟网关IP地址是: 192.168.199.254

SW5:

interface vlanif 199
vrrp vrid  199  virtual-ip  192.168.199.254
vrrp vrid  199  priority   200
quit
SW6:
interface vlanif 199
vrrp vrid  199  virtual-ip  192.168.199.254
vrrp vrid  199  priority   150
quit

SW1/2/3/4 添加一个静态的默认路由,下一跳IP地址为 192.168.199.254

ip route-static   0.0.0.0  0   192.168.199.254

测试:
telnet 100.1.1.11 2001 ----> 应该访问到 SW1 ;
但是,经过上述的配置后,测试是不成功的。

因为:

边界设备(R2)在将外网的流量通过 nat server 转发到内网的时,

要求数据包进入到内网,和从内网发送到外网时,所使用的转发端口

得是相同的。

如果不相同,就直接将数据包丢弃,导致“外网访问内网失败”。

所以:

我们在 R2上连接 SW6 的接口上(gi0/0/2),修改 OSPF 的 cost 为 2 .

从而确保R2去往 vlan 199 网段时,下一跳肯定为 SW5 。

【因为 SW5 是 vlan 199 的 主网关,所以SW1/2/3/4返回数据包时】

【肯定走 SW5 。所以我们通过上述的方法,确保R2进入 vlan 199 】

【使用的下一跳也是 SW5 】

配置命令如下:
AR2:—> 连接 SW6 的接口上

interface gi0/0/2
ospf cost  2

【做完配置,验证完成,必须保存】

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐