用于设置和管理路由的路由器配置示例Router configuration samples to setup and manage routing

本页提供处理 ExpressRoute 时适用于 Cisco IOS XE 和 Juniper MX 系列路由器的接口与路由配置示例。This page provides interface and routing configuration samples for Cisco IOS-XE and Juniper MX series routers when working with ExpressRoute. 这些示例仅供指导,不能按原样使用。These are intended to be samples for guidance only and must not be used as is. 可以与供应商合作,以便为网络指定适当的配置。You can work with your vendor to come up with appropriate configurations for your network.

重要

本页中的示例仅供指导。Samples in this page are intended to be purely for guidance. 必须与供应商的销售/技术团队和网络团队合作,以便指定符合需要的适当配置。You must work with your vendor's sales / technical team and your networking team to come up with appropriate configurations to meet your needs. 对于本页中所列配置的相关问题,Microsoft 不提供支持。Microsoft will not support issues related to configurations listed in this page. 有关支持问题,必须与设备供应商联系。You must contact your device vendor for support issues.

路由器接口上的 MTU 和 TCP MSS 设置MTU and TCP MSS settings on router interfaces

  • ExpressRoute 接口的 MTU 为 1500,即路由器上以太网接口的典型默认 MTU。The MTU for the ExpressRoute interface is 1500, which is the typical default MTU for an Ethernet interface on a router. 默认情况下,除非路由器具有不同 MTU,否则无需在路由器接口上指定值。Unless your router has a different MTU by default, there is no need to specify a value on the router interface.
  • 与 Azure VPN 网关不同,不需要为 ExpressRoute 线路指定 TCP MSS。Unlike an Azure VPN Gateway, the TCP MSS for an ExpressRoute circuit does not need to be specified. 以下路由器配置示例适用于所有对等互连。Router configuration samples below apply to all peerings. 有关路由的更多详细信息,请查看 ExpressRoute 对等互连ExpressRoute 路由要求Review ExpressRoute peerings and ExpressRoute routing requirements for more details on routing.

基于 Cisco IOS-XE 的路由器Cisco IOS-XE based routers

本部分中的示例适用于任何运行 IOS-XE OS 系列的路由器。The samples in this section apply for any router running the IOS-XE OS family.

1.配置接口和子接口1. Configuring interfaces and sub-interfaces

在连接到 Microsoft 的每个路由器中,针对每个对等互连都需要有一个子接口。You will require a sub interface per peering in every router you connect to Microsoft. 子接口可使用 VLAN ID 或一对堆叠的 VLAN ID 和 IP 地址来标识。A sub interface can be identified with a VLAN ID or a stacked pair of VLAN IDs and an IP address.

Dot1Q 接口定义Dot1Q interface definition

本示例针对包含单个 VLAN ID 的子接口提供子接口定义。This sample provides the sub-interface definition for a sub-interface with a single VLAN ID. 在每个对等互连中,VLAN ID 是唯一的。The VLAN ID is unique per peering. IPv4 地址的最后一个八位字节将始终是奇数。The last octet of your IPv4 address will always be an odd number.

interface GigabitEthernet<Interface_Number>.<Number>
 encapsulation dot1Q <VLAN_ID>
 ip address <IPv4_Address><Subnet_Mask>

QinQ 接口定义QinQ interface definition

本示例针对包含两个 VLAN ID 的子接口提供子接口定义。This sample provides the sub-interface definition for a sub-interface with a two VLAN IDs. 外部 VLAN ID (s-tag)(如果使用)在所有对等互连中保持不变。The outer VLAN ID (s-tag), if used remains the same across all the peerings. 在每个对等互连中,内部 VLAN ID (c-tag) 是唯一的。The inner VLAN ID (c-tag) is unique per peering. IPv4 地址的最后一个八位字节将始终是奇数。The last octet of your IPv4 address will always be an odd number.

interface GigabitEthernet<Interface_Number>.<Number>
 encapsulation dot1Q <s-tag> seconddot1Q <c-tag>
 ip address <IPv4_Address><Subnet_Mask>

2.设置 eBGP 会话2. Setting up eBGP sessions

必须针对每个对等互连设置与 Microsoft 的 BGP 会话。You must setup a BGP session with Microsoft for every peering. 以下示例可让你设置与 Microsoft 的 BGP 会话。The sample below enables you to setup a BGP session with Microsoft. 如果对子接口使用的 IPv4 地址是 a.b.c.d,则 BGP 邻居 (Microsoft) 的 IP 地址将是 a.b.c.d+1。If the IPv4 address you used for your sub interface was a.b.c.d, the IP address of the BGP neighbor (Microsoft) will be a.b.c.d+1. BGP 邻居的 IPv4 地址的最后一个八位字节将始终是偶数。The last octet of the BGP neighbor's IPv4 address will always be an even number.

router bgp <Customer_ASN>
 bgp log-neighbor-changes
 neighbor <IP#2_used_by_Azure> remote-as 12076
 !        
 address-family ipv4
 neighbor <IP#2_used_by_Azure> activate
 exit-address-family
!

3.设置要通过 BGP 会话播发的前缀3. Setting up prefixes to be advertised over the BGP session

可以配置路由器,以将所选前缀播发给 Microsoft。You can configure your router to advertise select prefixes to Microsoft. 可以使用以下示例来执行此操作。You can do so using the sample below.

router bgp <Customer_ASN>
 bgp log-neighbor-changes
 neighbor <IP#2_used_by_Azure> remote-as 12076
 !        
 address-family ipv4
  network <Prefix_to_be_advertised> mask <Subnet_mask>
  neighbor <IP#2_used_by_Azure> activate
 exit-address-family
!

4.路由映射4. Route maps

可以使用路由映射和前缀列表来筛选已传播到网络中的前缀。You can use route-maps and prefix lists to filter prefixes propagated into your network. 可以使用以下示例来完成此任务。You can use the sample below to accomplish the task. 确保已设置适当的前缀列表。Ensure that you have appropriate prefix lists setup.

router bgp <Customer_ASN>
 bgp log-neighbor-changes
 neighbor <IP#2_used_by_Azure> remote-as 12076
 !        
 address-family ipv4
  network <Prefix_to_be_advertised> mask <Subnet_mask>
  neighbor <IP#2_used_by_Azure> activate
  neighbor <IP#2_used_by_Azure> route-map <MS_Prefixes_Inbound> in
 exit-address-family
!
route-map <MS_Prefixes_Inbound> permit 10
 match ip address prefix-list <MS_Prefixes>
!

Juniper MX 系列路由器Juniper MX series routers

本部分中的示例适用于所有 Juniper MX 系列路由器。The samples in this section apply for any Juniper MX series routers.

1.配置接口和子接口1. Configuring interfaces and sub-interfaces

Dot1Q 接口定义Dot1Q interface definition

本示例针对包含单个 VLAN ID 的子接口提供子接口定义。This sample provides the sub-interface definition for a sub-interface with a single VLAN ID. 在每个对等互连中,VLAN ID 是唯一的。The VLAN ID is unique per peering. IPv4 地址的最后一个八位字节将始终是奇数。The last octet of your IPv4 address will always be an odd number.

interfaces {
    vlan-tagging;
    <Interface_Number> {
        unit <Number> {
            vlan-id <VLAN_ID>;
            family inet {
                address <IPv4_Address/Subnet_Mask>;
            }
        }
    }
}

QinQ 接口定义QinQ interface definition

本示例针对包含两个 VLAN ID 的子接口提供子接口定义。This sample provides the sub-interface definition for a sub-interface with a two VLAN IDs. 外部 VLAN ID (s-tag)(如果使用)在所有对等互连中保持不变。The outer VLAN ID (s-tag), if used remains the same across all the peerings. 在每个对等互连中,内部 VLAN ID (c-tag) 是唯一的。The inner VLAN ID (c-tag) is unique per peering. IPv4 地址的最后一个八位字节将始终是奇数。The last octet of your IPv4 address will always be an odd number.

interfaces {
    <Interface_Number> {
        flexible-vlan-tagging;
        unit <Number> {
            vlan-tags outer <S-tag> inner <C-tag>;
            family inet {
                address <IPv4_Address/Subnet_Mask>;
            }                           
        }                               
    }                                   
}                           

2.设置 eBGP 会话2. Setting up eBGP sessions

必须针对每个对等互连设置与 Microsoft 的 BGP 会话。You must setup a BGP session with Microsoft for every peering. 以下示例可让你设置与 Microsoft 的 BGP 会话。The sample below enables you to setup a BGP session with Microsoft. 如果对子接口使用的 IPv4 地址是 a.b.c.d,则 BGP 邻居 (Microsoft) 的 IP 地址将是 a.b.c.d+1。If the IPv4 address you used for your sub interface was a.b.c.d, the IP address of the BGP neighbor (Microsoft) will be a.b.c.d+1. BGP 邻居的 IPv4 地址的最后一个八位字节将始终是偶数。The last octet of the BGP neighbor's IPv4 address will always be an even number.

routing-options {
    autonomous-system <Customer_ASN>;
}
}
protocols {
    bgp { 
        group <Group_Name> { 
            peer-as 12076;              
            neighbor <IP#2_used_by_Azure>;
        }                               
    }                                   
}

3.设置要通过 BGP 会话播发的前缀3. Setting up prefixes to be advertised over the BGP session

可以配置路由器,以将所选前缀播发给 Microsoft。You can configure your router to advertise select prefixes to Microsoft. 可以使用以下示例来执行此操作。You can do so using the sample below.

policy-options {
    policy-statement <Policy_Name> {
        term 1 {
            from protocol OSPF;
    route-filter <Prefix_to_be_advertised/Subnet_Mask> exact;
            then {
                accept;
            }
        }
    }
}
protocols {
    bgp { 
        group <Group_Name> { 
            export <Policy_Name>
            peer-as 12076;              
            neighbor <IP#2_used_by_Azure>;
        }                               
    }                                   
}

4.路由映射4. Route maps

可以使用路由映射和前缀列表来筛选已传播到网络中的前缀。You can use route-maps and prefix lists to filter prefixes propagated into your network. 可以使用以下示例来完成此任务。You can use the sample below to accomplish the task. 确保已设置适当的前缀列表。Ensure that you have appropriate prefix lists setup.

policy-options {
    prefix-list MS_Prefixes {
        <IP_Prefix_1/Subnet_Mask>;
        <IP_Prefix_2/Subnet_Mask>;
    }
    policy-statement <MS_Prefixes_Inbound> {
        term 1 {
            from {
    prefix-list MS_Prefixes;
            }
            then {
                accept;
            }
        }
    }
}
protocols {
    bgp { 
        group <Group_Name> { 
            export <Policy_Name>
            import <MS_Prefixes_Inbound>
            peer-as 12076;              
            neighbor <IP#2_used_by_Azure>;
        }                               
    }                                   
}

后续步骤Next Steps

有关更多详细信息,请参阅 ExpressRoute 常见问题解答See the ExpressRoute FAQ for more details.