玩转华为ENSP模拟器系列 | 配置PE与接入侧设备间路由交换

素材来源:华为路由器配置指南

一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全


目标

配置基于eBGP的PE和接入侧设备间的路由交换

组网模型

配置思路

  • 配置使能EVPN的基于IPv4的L3VPN实例。
  • 配置静态路由使两台PE的Loopback地址互通。
  • 创建一个BGP实例。
  • 配置iBGP对等体。
  • 配置基于IPv4的BGP-VPN。
  • 使能BGP的EVPN地址族。
  • 使能PE设备的MPLS LDP协议。
  • 配置CE和PE之间的BGP路由交换。

操作步骤

  1. PE1节点配置

配置使能EVPN的基于IPv4的L3VPN实例

PE1:
ip vpn-instance test
 ipv4-family
  route-distinguisher 100:1
  apply-label per-instance
  vpn-target 100:1 export-extcommunity evpn
  vpn-target 100:1 import-extcommunity evpn
  evpn mpls routing-enable
interface Ethernet1/0/0.1
 vlan-type dot1q 1
 ip binding vpn-instance test
 ip address 10.0.0.1 255.255.255.0

配置静态路由使两台PE的Loopback地址互通

PE1:
interface LoopBack1
 ip address 1.1.1.134 255.255.255.255
interface Ethernet1/0/1
 ip address 100.0.0.1 255.255.255.0
ip route-static 1.1.1.135 255.255.255.255 100.0.0.2

创建一个BGP实例

PE1:
bgp 65000

配置iBGP对等体

PE1:
bgp 65000
 peer 1.1.1.135 as-number 65000
 peer 1.1.1.135 connect-interface LoopBack1

配置基于IPv4的BGP-VPN

PE1:
bgp 65000
 ipv4-family vpn-instance test
  import-route direct
  advertise l2vpn evpn

使能BGP的EVPN地址族

PE1:
bgp 65000
 l2vpn-family evpn
  peer 1.1.1.135 enable

使能设备的MPLS LDP

PE1:
mpls lsr-id 1.1.1.134
mpls
mpls ldp
interface Ethernet1/0/1
 mpls
 mpls ldp

配置CE与PE之间的eBGP路由交换

PE1:
bgp 65000
 ipv4-family vpn-instance test
  peer 10.0.0.2 as-number 100
  1. PE2节点配置

配置使能EVPN的基于IPv4的L3VPN实例

PE2:
ip vpn-instance test
 ipv4-family
  route-distinguisher 100:1
  apply-label per-instance
  vpn-target 100:1 export-extcommunity evpn
  vpn-target 100:1 import-extcommunity evpn
  evpn mpls routing-enable
interface Ethernet1/0/1.1
 vlan-type dot1q 1
 ip binding vpn-instance test
 ip address 20.0.0.1 255.255.255.0

配置静态路由使两台PE的Loopback地址互通

PE2:
interface LoopBack1
 ip address 1.1.1.135 255.255.255.255
interface Ethernet1/0/0
 ip address 100.0.0.2 255.255.255.0
ip route-static 1.1.1.134 255.255.255.255 100.0.0.1

创建一个BGP实例

PE2:
bgp 65000

配置iBGP对等体

PE2:
bgp 65000
 peer 1.1.1.134 as-number 65000
 peer 1.1.1.134 connect-interface LoopBack1

配置基于IPv4的BGP-VPN

PE2:
bgp 65000
 ipv4-family vpn-instance test
  import-route direct
  advertise l2vpn evpn

使能BGP的EVPN地址族

PE2:
bgp 65000
 l2vpn-family evpn
  peer 1.1.1.134 enable

使能设备的MPLS LDP

PE2:
mpls lsr-id 1.1.1.135
mpls
mpls ldp
interface Ethernet1/0/0
 mpls
 mpls ldp

配置CE与PE之间的eBGP路由交换

PE2:
bgp 65000
 ipv4-family vpn-instance test
  import-route direct
  advertise l2vpn evpn
  peer 20.0.0.2 as-number 100
  1. 配置节点CE1

配置eBGP邻居

CE1:
interface Ethernet1/0/0.1
 vlan-type dot1q 1
 ip address 10.0.0.2 255.255.255.0
bgp 100
 peer 10.0.0.1 as-number 65000

创建Loopback10,将其路路由通告至BGP中

CE1:
interface LoopBack10
 ip address 30.1.1.1 255.255.255.255
bgp 100
 ipv4-family unicast
  network 30.1.1.1 255.255.255.255
  1. 配置节点CE2

配置eBGP邻居

CE2:
interface Ethernet1/0/0.1
 vlan-type dot1q 1
 ip address 20.0.0.2 255.255.255.0
bgp 100
 peer 20.0.0.1 as-number 65000

创建Loopback10,将其路路由通告至BGP中

CE2:
interface LoopBack10
 ip address 40.1.1.1 255.255.255.255
bgp 100
 ipv4-family unicast
  network 40.1.1.1 255.255.255.255
  1. 配置验证

查看PE1的L3VPN实例的路由表

[~PE1]dis ip routing-table vpn-instance test
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole
 route
------------------------------------------------------------------------------
Routing Table : test
         Destinations : 8        Routes : 8         
Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface
       10.0.0.0/24  Direct  0    0             D   10.0.0.1        Ethernet1/0/0
.1
       10.0.0.1/32  Direct  0    0             D   127.0.0.1       Ethernet1/0/0
.1
     10.0.0.255/32  Direct  0    0             D   127.0.0.1       Ethernet1/0/0
.1
       20.0.0.0/24  IBGP    255  0             RD  1.1.1.135       Ethernet1/0/1
       30.1.1.1/32  EBGP    255  0             RD  10.0.0.2        Ethernet1/0/0
.1
       40.1.1.1/32  IBGP    255  0             RD  1.1.1.135       Ethernet1/0/1
      127.0.0.0/8   Direct  0    0             D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0
[~PE1]

查看PE1的EVPN前缀路由表

[~PE1]dis bgp evpn all routing-table prefix-route 
 Local AS number : 65000
 BGP Local router ID is 1.1.1.134
 Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 EVPN address family:
 Number of Ip Prefix Routes: 4
 Route Distinguisher: 100:1
       Network(EthTagId/IpPrefix/IpPrefixLen)                 NextHop
 *>    0:10.0.0.0:24                                          0.0.0.0
 *>i   0:20.0.0.0:24                                          1.1.1.135
 *>    0:30.1.1.1:32                                          0.0.0.0
 *>i   0:40.1.1.1:32                                          1.1.1.135
 EVPN-Instance __RD_1_100_1__:
 Number of Ip Prefix Routes: 4
       Network(EthTagId/IpPrefix/IpPrefixLen)                 NextHop
 *>    0:10.0.0.0:24                                          0.0.0.0
 *>i   0:20.0.0.0:24                                          1.1.1.135
 *>    0:30.1.1.1:32                                          0.0.0.0
 *>i   0:40.1.1.1:32                                          1.1.1.135
[~PE1] 

查看PE2的L3VPN实例的路由表

[~PE2-bgp]dis ip routing-table vpn-instance test
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole
 route
------------------------------------------------------------------------------
Routing Table : test
         Destinations : 8        Routes : 8         
Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface
       10.0.0.0/24  IBGP    255  0             RD  1.1.1.134       Ethernet1/0/0
       20.0.0.0/24  Direct  0    0             D   20.0.0.1        Ethernet1/0/1
.1
       20.0.0.1/32  Direct  0    0             D   127.0.0.1       Ethernet1/0/1
.1
     20.0.0.255/32  Direct  0    0             D   127.0.0.1       Ethernet1/0/1
.1
       30.1.1.1/32  IBGP    255  0             RD  1.1.1.134       Ethernet1/0/0
       40.1.1.1/32  EBGP    255  0             RD  20.0.0.2        Ethernet1/0/1
.1
      127.0.0.0/8   Direct  0    0             D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0
[~PE2-bgp] 

查看PE2的EVPN前缀路由表

[~PE2-bgp] dis bgp evpn all routing-table prefix-route 
 Local AS number : 65000
 BGP Local router ID is 1.1.1.135
 Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete
 EVPN address family:
 Number of Ip Prefix Routes: 4
 Route Distinguisher: 100:1
       Network(EthTagId/IpPrefix/IpPrefixLen)                 NextHop
 *>i   0:10.0.0.0:24                                          1.1.1.134
 *>    0:20.0.0.0:24                                          0.0.0.0
 *>i   0:30.1.1.1:32                                          1.1.1.134
 *>    0:40.1.1.1:32                                          0.0.0.0
 EVPN-Instance __RD_1_100_1__:
 Number of Ip Prefix Routes: 4
       Network(EthTagId/IpPrefix/IpPrefixLen)                 NextHop
 *>i   0:10.0.0.0:24                                          1.1.1.134
 *>    0:20.0.0.0:24                                          0.0.0.0
 *>i   0:30.1.1.1:32                                          1.1.1.134
 *>    0:40.1.1.1:32                                          0.0.0.0
[~PE2-bgp]   

 

?PCA login: root ;使用root用户 password: linux ;口令是linux # shutdown -h now ;关机 # init 0 ;关机 # logout # login # ifconfig ;显示IP地址 # ifconfig eth0 netmask ;设置IP地址 # ifconfig eht0 netmask down ; 删除IP地址 # route add 0.0.0.0 gw # route del 0.0.0.0 gw # route add default gw ;设置网关 # route del default gw ;删除网关 # route ;显示网关 # ping # telnet ;建议telnet之前先ping一下 ---------------------------------------- 交换机命令 ~~~~~~~~~~ [Quidway]super password 修改特权用户密码 [Quidway]sysname 交换机命名 [Quidway]interface ethernet 0/1 进入接口视图 [Quidway]interface vlan x 进入接口视图 [Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 [Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 静态路由=网关 [Quidway]user-interface vty 0 4 [S3026-ui-vty0-4]authentication-mode password [S3026-ui-vty0-4]set authentication-mode password simple 222 [S3026-ui-vty0-4]user privilege level 3 [Quidway-Ethernet0/1]duplex {half|full|auto} 配置端口双工工作状态 [Quidway-Ethernet0/1]speed {10|100|auto} 配置端口工作速率 [Quidway-Ethernet0/1]flow-control 配置端口流控 [Quidway-Ethernet0/1]mdi {across|auto|normal} 配置端口MDI/MDIX状态平接或扭接 [Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} 设置接口工作模式 [Quidway-Ethernet0/1]shutdown 关闭/重起接口 [Quidway-Ethernet0/2]quit 退出系统视图 [Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式 [Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 在当前VLAN增加/删除以太网接口 [Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定VLAN [Quidway-Ethernet0/2]port trunk permit vlan {ID|All} 设trunk允许的VLAN [Quidway-Ethernet0/2]port trunk pvid vlan 3 设置trunk端口的PVID [Quidway]monitor-port 指定和清除镜像端口 [Quidway]port mirror 指定和清除被镜像端口 [Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像 [Quidway]description string 指定VLAN描述字符 [Quidway]description 删除VLAN描述字符 [Quidway]display vlan [vlan_id] 查看VLAN设置 [Quidway]stp {enable|disable} 开启/关闭生成树,默认关闭 [Quidway]stp priority 4096 设置交换机的优先级 [Quidway]stp root {primary|secondary} 设置交换机为根或根的备份 [Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费 作者:Vision_Klaus 2006-8-20 11:07   回复此发言 -------------------------------------------------------------------------------- 2 华为路由交换的基本命令 [SwitchA-vlanx]isolate-user-vlan enable 设置主vlan [SwitchA]Isolate-user-vlan secondary 设置主vlan包括的子vlan [Quidway-Ethernet0/2]port hybrid pvid vlan 设置vlan的pvid [Quidway-Ethernet0/2]port hybrid pvid 删除vlan的pvid [Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 设置无标识的vlan 如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。 所以设置PVID为所属vlan id, 设置可以互通的vlan为untagged. ---------------------------------------- 路由器命令 ~~~~~~~~~~ [Quidway]display version 显示版本信息 [Quidway]display current-configuration 显示当前配置 [Quidway]display interfaces 显示接口信息 [Quidway]display ip route 显示路由信息 [Quidway]sysname aabbcc 更改主机名 [Quidway]super passwrod 123456 设置口令 [Quidway]interface serial0 进入接口 [Quidway-serial0]ip address [Quidway-serial0]undo shutdown 激活端口 [Quidway]link-protocol hdlc 绑定hdlc协议 [Quidway]user-interface vty 0 4 [Quidway-ui-vty0-4]authentication-mode password [Quidway-ui-vty0-4]set authentication-mode password simple 222 [Quidway-ui-vty0-4]user privilege level 3 [Quidway-ui-vty0-4]quit [Quidway]debugging hdlc all serial0 显示所有信息 [Quidway]debugging hdlc event serial0 调试事件信息 [Quidway]debugging hdlc packet serial0 显示包的信息 静态路由: [Quidway]ip route-static {interface number|nexthop}[value][reject|blackhole] 例如: [Quidway]ip route-static 129.1.0.0 16 10.0.0.2 [Quidway]ip route-static 129.1.0.0 255.255.0.0 10.0.0.2 [Quidway]ip route-static 129.1.0.0 16 Serial 2 [Quidway]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2 动态路由: [Quidway]rip [Quidway]rip work [Quidway]rip input [Quidway]rip output [Quidway-rip]network 1.0.0.0 ;可以all [Quidway-rip]network 2.0.0.0 [Quidway-rip]peer ip-address [Quidway-rip]summary [Quidway]rip version 1 [Quidway]rip version 2 multicast [Quidway-Ethernet0]rip split-horizon ;水平分隔 [Quidway]router id A.B.C.D 配置路由器的ID [Quidway]ospf enable 启动OSPF协议 [Quidway-ospf]import-route direct 引入直联路由 [Quidway-Serial0]ospf enable area 配置OSPF区域 标准访问列表命令格式如下: acl [match-order config|auto] 默认前者顺序匹配。 rule [normal|special]{permit|deny} [source source-addr source-wildcard|any] 例: [Quidway]acl 10 [Quidway-acl-10]rule normal permit source 10.0.0.0 0.0.0.255 [Quidway-acl-10]rule normal deny source any 扩展访问控制列表配置命令 配置TCP/UDP协议的扩展访问列表: rule {normal|special}{permit|deny}{tcp|udp}source {|any}destination |any} [operate] 配置ICMP协议的扩展访问列表: rule {normal|special}{permit|deny}icmp source {|any]destination {|any] 作者:Vision_Klaus 2006-8-20 11:07   回复此发言 -------------------------------------------------------------------------------- 3 华为路由交换的基本命令 [icmp-code] [logging] 扩展访问控制列表操作符的含义 equal portnumber 等于 greater-than portnumber 大于 less-than portnumber 小于 not-equal portnumber 不等 range portnumber1 portnumber2 区 扩展访问控制列表举例 [Quidway]acl 101 [Quidway-acl-101]rule deny souce any destination any [Quidway-acl-101]rule permit icmp source any destination any icmp-type echo [Quidway-acl-101]rule permit icmp source any destination any icmp-type echo-reply [Quidway]acl 102 [Quidway-acl-102]rule permit ip source 10.0.0.1 0.0.0.0 destination 202.0.0.1 0.0.0.0 [Quidway-acl-102]rule deny ip source any destination any [Quidway]acl 103 [Quidway-acl-103]rule permit tcp source any destination 10.0.0.1 0.0.0.0 destination-port equal ftp [Quidway-acl-103]rule permit tcp source any destination 10.0.0.2 0.0.0.0 destination-port equal www [Quidway]firewall enable [Quidway]firewall default permit|deny [Quidway]int e0 [Quidway-Ethernet0]firewall packet-filter 101 inbound|outbound 地址转换配置举例 [Quidway]firewall enable [Quidway]firewall default permit [Quidway]acl 101 [Quidway-acl-101]rule deny ip source any destination any [Quidway-acl-101]rule permit ip source 129.38.1.4 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.1 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.2 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.3 0 destination any [Quidway]acl 102 [Quidway-acl-102]rule permit tcp source 202.39.2.3 0 destination 202.38.160.1 0 [Quidway-acl-102]rule permit tcp source any destination 202.38.160.1 0 destination-port great-than 1024 [Quidway-Ethernet0]firewall packet-filter 101 inbound [Quidway-Serial0]firewall packet-filter 102 inbound [Quidway]nat address-group 202.38.160.101 202.38.160.103 pool1 [Quidway]acl 1 [Quidway-acl-1]rule permit source 10.110.10.0 0.0.0.255 [Quidway-acl-1]rule deny source any [Quidway-acl-1]int serial 0 [Quidway-Serial0]nat outbound 1 address-group pool1 [Quidway-Serial0]nat server global 202.38.160.101 inside 10.110.10.1 ftp tcp [Quidway-Serial0]nat server global 202.38.160.102 inside 10.110.10.2 www tcp [Quidway-Serial0]nat server global 202.38.160.102 8080 inside 10.110.10.3 www tcp [Quidway-Serial0]nat server global 202.38.160.103 inside 10.110.10.4 smtp udp PPP验证: 主验方:pap|chap [Quidway]local-user u2 password {simple|cipher} aaa [Quidway]interface serial 0 [Quidway-serial0]ppp authentication-mode {pap|chap} [Quidway-serial0]ppp chap user u1 //pap时,不用此句 pap被验方: [Quidway]interface serial 0 [Quidway-serial0]ppp pap local-user u2 password {simple|cipher} aaa chap被验方: [Quidway]interface serial 0 [Quidway-serial0]ppp chap user u1 [Quidway-serial0]local-user u2 password {simple|cipher} aaa 只找到这个,哪位有好点的分享下谢谢
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值