首页 科技问答 48Bba,求防火墙,策略路由配置案例,命令行。

48Bba,求防火墙,策略路由配置案例,命令行。

科技问答 175
1679584756,CRM论坛(CRMbbs.com)——一个让用户更懂CRM的垂直性行业内容平台,CRM论坛致力于互联网、客户管理、销售管理、SCRM私域流量内容输出5年。 如果您有好的内容,欢迎向我们投稿,共建CRM多元化生态体系,创建CRM客户管理一体化生态解决方案。内容来源:知了社区

问题描述:

公司现在有两条动态公网分别是在1口和2口,想把VLAN1 网段的用户,指向1口,VLAN2网段用户,指向2口。请问命令怎么配呢?谢谢老师

组网及组网描述:


10小时前提问

IPv4策略路由配置举例

4.1  组网需求

如图1所示,缺省情况下,Device的VLAN接口2上收到的所有访问Server的报文根据路由表转发的下一跳均为10.4.1.2。

现要求在Device上配置IPv4策略路由,对于访问Server的报文实现如下要求:

      首先匹配Vlan-interface2上收到的源IP地址为10.2.1.1的报文,将该报文的下一跳重定向到10.5.1.2;

      其次匹配Vlan-interface2上收到的HTTP报文,将该报文的下一跳重定向到10.3.1.2。

图1 IPv4策略路由特性典型配置组网图

 

4.2  配置思路

·              为了确保能同时满足对于两种不同类型的报文重定向到不同的下一跳,需要配置两个访问控制列表,一个用于匹配Vlan-interface2上收到的源IP地址为10.2.1.1的报文,另一个用于匹配Vlan-interface2上收到的HTTP报文,并在策略路由中创建两个节点,分别对匹配上的报文进行重定向;

·              同一条策略路由中,创建的节点编号越小,优先级越高。为了确保Vlan-interface2上收到源IP地址为10.2.1.1的HTTP报文下一跳能优先被重定向到10.5.1.2,需要在策略路由中配置该策略使用较小的节点编号(本例中使用0号节点,另一策略使用1号节点)。

4.3  配置步骤

#配置Vlan-interface2的IP地址。

<Device> system-view

[Device] interface vlan-interface 2

[Device-Vlan-interface2] ip address 10.1.2.1 255.255.255.0

[Device-Vlan-interface2] quit

#请参考以上方法配置图1中其它接口的IP地址,配置步骤这里省略。

# 配置静态路由,保证三条路径都可达,并且缺省下一跳为10.4.1.2。

[Device] ip route-static 192.168.1.0 24 10.3.1.2

[Device] ip route-static 192.168.1.0 24 10.4.1.2 preference 40

[Device] ip route-static 192.168.1.0 24 10.5.1.2

# 定义访问控制列表ACL 3005,用于匹配源IP地址为10.2.1.1的报文。

[Device] acl advanced 3005

[Device-acl-ipv4-adv-3005] rule 0 permit ip source 10.2.1.1 0

[Device-acl-ipv4-adv-3005] quit

# 定义访问控制列表ACL 3006,用于匹配HTTP报文。

[Device] acl advanced 3006

[Device-acl-ipv4-adv-3006] rule 0 permit tcp destination-port eq www

[Device-acl-ipv4-adv-3006] quit

# 创建策略路由pbr1的0号节点,将匹配ACL 3005的报文下一跳重定向到10.5.1.2。

[Device] policy-based-route pbr1 permit node 0

[Device-pbr-pbr1-0] if-match acl 3005

[Device-pbr-pbr1-0] apply next-hop 10.5.1.2

[Device-pbr-pbr1-0] quit

# 创建策略路由pbr1的1号节点,将匹配ACL 3006的报文下一跳重定向到10.3.1.2。

[Device] policy-based-route pbr1 permit node 1

[Device-pbr-pbr1-1] if-match acl 3006

[Device-pbr-pbr1-1] apply next-hop 10.3.1.2

[Device-pbr-pbr1-1] quit

# 在Device的接口Vlan-interface2上应用策略。

[Device] interface vlan-interface 2

[Device-Vlan-interface2] ip policy-based-route pbr1

[Device-Vlan-interface2] quit

4.4  验证配置

通过display ip policy-based-route命令可以查看到当前策略路由配置已经配置成功:

[Device] display ip policy-based-route policy pbr1

Policy name: pbr1

  node 0 permit:

    if-match acl 3005

    apply next-hop 10.5.1.2

  node 1 permit:

    if-match acl 3006

    apply next-hop 10.3.1.2

# 通过tracert命令查看以下报文的转发路径(使用Tracert功能需要在中间设备上开启ICMP超时报文发送功能,在目的端开启ICMP目的不可达报文发送功能):

源IP为10.1.1.1的非HTTP报文,重定向到10.4.1.2进行转发。

<Switch> tracert -a 10.1.1.1 192.168.1.1

traceroute to 192.168.1.1 (192.168.1.1) from 10.1.1.1, 30 hops at most, 40 bytes

 each packet, press CTRL_C to break

 1  10.1.2.1 (10.1.2.1)  2.178 ms  1.364 ms  1.058 ms

 2  10.4.1.2 (10.4.1.2)  1.548 ms  1.248 ms  1.112 ms

 3  192.168.1.1 (192.168.1.1)  1.594 ms  1.3

源IP为10.2.1.1的报文,重定向到10.5.1.2进行转发。

<Switch> tracert -a 10.2.1.1 192.168.1.1

traceroute to 192.168.1.1 (192.168.1.1) from 10.2.1.1, 30 hops at most, 40 bytes

 each packet, press CTRL_C to break

 1  10.1.2.1 (10.1.2.1)  1.7

 2  10.5.1.2 (10.5.1.2)  4.494 ms  1.385 ms  1.170 ms

 3  192.168.1.1 (192.168.1.1)  1.448 ms  1.304 ms  1.093 ms

4.5  配置文件

#

vlan 1

#

vlan 2 to 5

#

policy-based-route pbr1 permit node 0

 if-match acl 3005

 apply next-hop 10.5.1.2

#

policy-based-route pbr1 permit node 1

 if-match acl 3006

 apply next-hop 10.3.1.2

#

interface Vlan-interface2

 ip address 10.1.2.1 255.255.255.0

 ip policy-based-route pbr1

#

interface Vlan-interface3

 ip address 10.3.1.1 255.255.255.0

#

interface Vlan-interface4

 ip address 10.4.1.1 255.255.255.0

#

interface Vlan-interface5

 ip address 10.5.1.1 255.255.255.0

#

interface Ten-GigabitEthernet3/0/1

 port link-mode bridge

 port access vlan 2

#

interface Ten-GigabitEthernet3/0/3

 port link-mode bridge

 port access vlan 3

#

interface Ten-GigabitEthernet3/0/4

 port link-mode bridge

 port access vlan 4

#

interface Ten-GigabitEthernet3/0/5

 port link-mode bridge

 port access vlan 5

#

 ip route-static 192.168.1.0 24 10.3.1.2

 ip route-static 192.168.1.0 24 10.4.1.2 preference 40

 ip route-static 192.168.1.0 24 10.5.1.2

#

acl advanced 3005

 rule 0 permit ip source 10.2.1.1 0

#

acl advanced 3006

 rule 0 permit tcp destination-port eq www

#

10小时前回答

请问如果我是动态的IP,要怎么配置呢?

1、命令行

https://www.h3c.com/cn/d_


2、web

https://www.h3c.com/cn/d_

9小时前回答

你正在,求防火墙,策略路由配置案例,命令行。