华为OSPF+下发默认路由+NAT+端口映射+策略路由配置案例-亲测ENSP

2023-09-21 02:24:32

一、实验结果:

1、 内网用户可以上外网(模拟ISP)。

2、 外网用户可以通过R1公网地址访问内网FTP、WWW服务器。

3、 内网所有路由器和网段通过OSPF路由协议通信。

4、 双出口数据分流,PC1 PC2出口默认通过2.1.1.1 ,PC3出口默认通过1.1.1.1实现数据向不同运营商分流 。

二、实验拓扑:

篇幅精力有限,仅提供重要配置信息R1、R4作为参考,如有需求留言我私发所有配置信息。

重点提供R1的配置信息,同时提供R4配置做为其他路由器配置代表。

R1配置信息

di cu

sysname R1

acl number 2000

rule 1 permit source 192.168.0.0 0.0.255.255 (定义NAT转换流量)

acl number 2002 (定义策略路由的流量)

rule 4 permit source 192.168.2.0 0.0.0.255

rule 5 permit source 192.168.1.0 0.0.0.255

acl number 2003 (定义策略路由的流量)

rule 4 permit source 192.168.3.0 0.0.0.255

#

traffic classifier FW12 operator or

if-match acl 2002 (流量分类)

traffic classifier FW3 operator or

if-match acl 2003 (定义流量分类)

#

traffic behavior liantong (定义流量流量行为)

redirect ip-nexthop 1.1.1.1

traffic behavior dianxin

redirect ip-nexthop 2.1.1.1

#

traffic policy P1 (定义流量策略)

classifier FW12 behavior dianxin

classifier FW3 behavior liantong

#

interface GigabitEthernet0/0/0

ip address 10.1.1.1 255.255.255.0

traffic-policy P1 inbound (策略路由应用至接口)

#

interface GigabitEthernet0/0/1

ip address 10.1.2.1 255.255.255.0

traffic-policy P1 inbound (策略路由应用至接口)

#

interface GigabitEthernet0/0/2

ip address 1.1.1.2 255.255.255.0

nat outbound 2000 (NAT应用)

#

interface GigabitEthernet2/0/0

ip address 2.1.1.2 255.255.255.0

nat outbound 2000(NAT应用)

#

ospf 1 (OSPF配置)

default-route-advertise

area 0.0.0.0

network 10.1.1.0 0.0.0.255

network 10.1.2.0 0.0.0.255

#

ip route-static 0.0.0.0 0.0.0.0 1.1.1.1 (出口默认路由)

ip route-static 0.0.0.0 0.0.0.0 2.1.1.1 (出口默认路由)

#

return


-------我-是-分-割-线----------

R4配置信息:

di cu

sysname R4

#

interface Ethernet0/0/0

ip address 10.1.6.1 255.255.255.0

#

interface Ethernet0/0/1

ip address 10.1.7.1 255.255.255.0

#

interface GigabitEthernet0/0/0

ip address 10.1.8.1 255.255.255.0

#

interface GigabitEthernet0/0/1

ip address 10.1.2.2 255.255.255.0

#

interface GigabitEthernet0/0/2

ip address 172.18.1.1 255.255.255.0

#

ospf 1 (OSPF配置)

area 0.0.0.0

network 10.1.8.0 0.0.0.255

network 172.18.1.0 0.0.0.255

network 10.1.2.0 0.0.0.255

network 10.1.6.0 0.0.0.255

network 10.1.7.0 0.0.0.255

return