首页
学习
活动
专区
工具
TVP
发布

华为交换机配置通过VPN实例转发流量

适用产品和版本

CE12800/CE6800/CE5800系列产品V100R001C00或更高版本,CE7800系列产品V100R003C00或更高版本,CE8800系列产品V100R006C00或更高版本,CE12800E系列产品V200R002C50或更高版本。

组网需求

如图2-49所示,某公司由于业务需要,业务区的服务器有访问Internet的需求。业务区的数据服务器和视频服务器通过接入层交换机SwitchB和核心层交换机SwitchA接入出口网关Router与Internet进行通信。

为了保证服务器到Internet和Internet到服务器的流量的安全性,在核心交换机SwitchA旁挂一个防火墙,将所有流经SwitchA的流量通过VPN实例重定向到防火墙,防火墙对流量进行过滤从而保证公司内外网络的安全性。

图2-49 配置通过VPN实例转发流量组网图

表2-11列出了图2-49上设备的基本网络规划情况

配置思路

采用如下思路配置:

出于安全性考虑,在SwitchA上旁挂一台核心防火墙Firewall,对流量进行安全过滤。

配置VPN实例vrf1,并和相应的接口绑定,使得所有访问Internet的流量通过vrf1来传输。

通过路由方式,将从Internet到服务器的全部流量定向到防火墙。

操作步骤

创建VLAN并配置各接口,保证二层互通

# 在SwitchB上创建VLAN 100。

system-view

[~HUAWEI] sysname SwitchB

[*HUAWEI] commit

[~SwitchB] vlan batch 100

[*SwitchB] commit

# 将SwitchB接口10GE1/0/1、10GE1/0/2和10GE1/0/3加入VLAN100。

[~SwitchB] interface 10ge 1/0/1

[~SwitchB-10GE1/0/1] port link-type trunk

[*SwitchB-10GE1/0/1] port trunk allow-pass vlan 100

[*SwitchB-10GE1/0/1] quit

[*SwitchB] interface 10ge 1/0/2

[*SwitchB-10GE1/0/2] port link-type access

[*SwitchB-10GE1/0/2] port default vlan 100

[*SwitchB-10GE1/0/2] quit

[*SwitchB] interface 10ge 1/0/3

[*SwitchB-10GE1/0/3] port link-type access

[*SwitchB-10GE1/0/3] port default vlan 100

[*SwitchB-10GE1/0/3] quit

[*SwitchB] commit

# 在SwitchA上创建VLAN100(连接SwitchB)、VLAN101(连接网关Router)、VLAN102(连接Firewall)和VLAN103(连接Firewall)。

system-view

[~HUAWEI] sysname SwitchA

[*HUAWEI] commit

[~SwitchA] vlan batch 100 to 103

[*SwitchA] commit

# 配置SwitchA上接口10GE1/0/1、10GE2/0/2和10GE3/0/3的接口类型为trunk,并加入VLAN。

[~SwitchA] interface 10ge 1/0/1

[~SwitchA-10GE1/0/1] port link-type trunk

[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 100

[*SwitchA-10GE1/0/1] quit

[*SwitchA] interface 10ge 2/0/2

[*SwitchA-10GE2/0/2] port link-type trunk

[*SwitchA-10GE2/0/2] port trunk allow-pass vlan 102 to 103

[*SwitchA-10GE2/0/2] quit

[*SwitchA] interface 10ge 3/0/3

[*SwitchA-10GE3/0/3] port link-type trunk

[*SwitchA-10GE3/0/3] port trunk allow-pass vlan 101

[*SwitchA-10GE3/0/3] quit

[*SwitchA] commit

# 创建VLANIF100~103,假设Firewall上对应的VLANIF102和VLANIF103的IP地址为192.168.10.2/24和192.168.11.2/24。

[~SwitchA] interface vlanif 100

[*SwitchA-Vlanif100] ip address 10.10.10.1 24

[*SwitchA-Vlanif100] quit

[*SwitchA] interface vlanif 101

[*SwitchA-Vlanif101] ip address 202.10.20.193 24

[*SwitchA-Vlanif101] quit

[*SwitchA] interface vlanif 102

[*SwitchA-Vlanif102] ip address 192.168.10.1 24

[*SwitchA-Vlanif102] quit

[*SwitchA] interface vlanif 103

[*SwitchA-Vlanif102] ip address 192.168.11.1 24

[*SwitchA-Vlanif102] quit

[*SwitchA] commit

配置VPN实例vrf1,并和相应的接口绑定,使得所有访问Internet的流量通过vrf1来传输

# 创建VPN实例vrf1。

[~SwitchA] ip vpn-instance vrf1

[*SwitchA-vpn-instance-vrf1] description YeWu

[*SwitchA-vpn-instance-vrf1] ipv4-family

[*SwitchA-vpn-instance-vrf1-af-ipv4] route-distinguisher 100:1

[*SwitchA-vpn-instance-vrf1-af-ipv4] vpn-target 100:1 both

[*SwitchA-vpn-instance-vrf1-af-ipv4] quit

[*SwitchA-vpn-instance-vrf1] quit

[*SwitchA] commit

# 将VLANIF100、VLANIF102和VPN实例绑定,接入VPN用户。

[~SwitchA] interface vlanif 100

[~SwitchA-Vlanif100] ip binding vpn-instance vrf1

[*SwitchA-Vlanif100] quit

[*SwitchA] interface vlanif 102

[*SwitchA-Vlanif102] ip binding vpn-instance vrf1

[*SwitchA-Vlanif102] quit

[*SwitchA] commit

# 配置静态路由。

[~SwitchA] ip route-static vpn-instance vrf1 0.0.0.0 0.0.0.0 192.168.10.2

[*SwitchA] commit

通过路由方式(静态路由或OSPF等),将从Internet到服务器的全部流量定向到防火墙。本例中以静态路由为例。

[~SwitchA] ip route-static 10.10.10.0 255.255.255.0 192.168.11.2

[*SwitchA] commit

验证

执行命令display ip vpn-instance vrf1查看配置的VPN实例的信息。

[~SwitchA] display ip vpn-instance vrf1

VPN-Instance Name RD Address-family

vrf1 100:1 IPv4

执行命令display ip vpn-instance interface查看绑定了VPN实例的接口信息。

[~SwitchA] display ip vpn-instance interface

Total VPN-Instances configured : 1

Total IPv4 VPN-Instances configured : 1

Total IPv6 VPN-Instances configured : 0

VPN-Instance Name and ID : vrf1, 50

Interface Number : 2

Interface list : Vlanif100,

Vlanif102

配置文件

SwitchB的配置文件

#

sysname SwitchB

#

vlan batch 100

#

interface 10GE1/0/1

port link-type trunk

port trunk allow-pass vlan 100

#

interface 10GE1/0/2

port default vlan 100

#

interface 10GE1/0/3

port default vlan 100

#

return

SwitchA的配置文件

#

sysname SwitchA

#

vlan batch 100 to 102

#

ip vpn-instance vrf1

description YeWu

ipv4-family

route-distinguisher 100:1

vpn-target 100:1 export-extcommunity

vpn-target 100:1 import-extcommunity

#

interface Vlanif100

ip binding vpn-instance vrf1

ip address 10.10.10.1 255.255.255.0

#

interface Vlanif101

ip address 202.10.20.193 255.255.255.0

#

interface Vlanif102

ip binding vpn-instance vrf1

ip address 192.168.10.1 255.255.255.0

#

interface Vlanif103

ip address 192.168.11.1 255.255.255.0

#

interface 10GE1/0/1

port link-type trunk

port trunk allow-pass vlan 100

#

interface 10GE2/0/2

port link-type trunk

port trunk allow-pass vlan 101

#

interface 10GE3/0/3

port link-type trunk

port trunk allow-pass vlan 102 to 103

#

ip route-static 10.10.10.0 255.255.255.0 192.168.11.2

ip route-static vpn-instance vrf1 0.0.0.0 0.0.0.0 192.168.10.2

#

return

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180713A15A1L00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券