科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网网络频道bgp-control inbound traffic(第1部分)

bgp-control inbound traffic(第1部分)

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

要求:对于as2内部的用户,去往1.1.0.0/24和1.1.2.0/24默认从r2走,去往1.1.2.0/24和1.1.3.0/24默认从r3走,并且保证r2或r3任意一台down掉,网络仍然那保持连通性。

作者:论坛整理 来源:zdnet网络安全 2008年3月25日

关键字: BGP bgp协议 路由协议 边界网关协议

  • 评论
  • 分享微博
  • 分享邮件

bgp-control inbound traffic(第1部分)

  要求:对于as2内部的用户,去往1.1.0.0/24和1.1.2.0/24默认从r2走,去往1.1.2.0/24和1.1.3.0/24默认从r3走,并且保证r2或r3任意一台down掉,网络仍然那保持连通性。

  option 1就是使用最长匹配的原则。r1往r3宣告一条关于1.1.0.0/24和1.1.1.0/24的汇总1.1.0.0/23,那么as 2内的用户去往1.1.0.0/24和1.1.1.0/24默认就会走r2了。

  R1

  hostname R1

  !

  interface Loopback0

  ip address 1.1.0.1 255.255.255.0

  !

  interface Loopback1

  ip address 1.1.1.1 255.255.255.0

  !

  interface Loopback2

  ip address 1.1.2.1 255.255.255.0

  !

  interface Loopback3

  ip address 1.1.3.1 255.255.255.0

  !

  interface FastEthernet0/0

  ip address 192.168.12.1 255.255.255.0

  speed 100

  full-duplex

  !

  interface FastEthernet0/1

  ip address 192.168.13.1 255.255.255.0

  speed 100

  full-duplex

  !

  router bgp 10

  no synchronization

  bgp router-id 1.1.1.1

  bgp log-neighbor-changes

  network 1.1.0.0 mask 255.255.255.0

  network 1.1.1.0 mask 255.255.255.0

  network 1.1.2.0 mask 255.255.255.0

  network 1.1.3.0 mask 255.255.255.0

  aggregate-address 1.1.0.0 255.255.254.0

  aggregate-address 1.1.2.0 255.255.254.0

  neighbor 192.168.12.2 remote-as 20

  neighbor 192.168.12.2 soft-reconfiguration inbound

  neighbor 192.168.12.2 route-map r2 out

  neighbor 192.168.13.3 remote-as 20

  neighbor 192.168.13.3 soft-reconfiguration inbound

  neighbor 192.168.13.3 route-map r3 out

  no auto-summary

  !

  ip prefix-list detail1 seq 5 permit 1.1.0.0/24

  ip prefix-list detail1 seq 10 permit 1.1.1.0/24

  !

  ip prefix-list detail2 seq 5 permit 1.1.2.0/24

  ip prefix-list detail2 seq 10 permit 1.1.3.0/24

  !

  ip prefix-list summary1 seq 5 permit 1.1.0.0/23

  !

  ip prefix-list summary2 seq 5 permit 1.1.2.0/23

  !

  route-map r2 deny 10

  match ip address prefix-list detail2

  !

  route-map r2 deny 20

  match ip address prefix-list summary1

  !

  route-map r2 permit 30

  !

  route-map r3 deny 10

  match ip address prefix-list detail1

  !

  route-map r3 deny 20

  match ip address prefix-list summary2

  !

  route-map r3 permit 30

  !

  end

  R2

  hostname R2

  !

  interface Loopback0

  ip address 2.2.2.2 255.255.255.255

  !

  interface FastEthernet0/0

  ip address 192.168.12.2 255.255.255.0

  speed 100

  full-duplex

  !

  interface FastEthernet0/1

  ip address 192.168.23.2 255.255.255.0

  speed 100

  full-duplex

  !

  router bgp 20

  no synchronization

  bgp router-id 2.2.2.2

  bgp log-neighbor-changes

  network 192.168.23.0

  neighbor 192.168.12.1 remote-as 10

  neighbor 192.168.12.1 soft-reconfiguration inbound

  neighbor 192.168.23.3 remote-as 20

  neighbor 192.168.23.3 next-hop-self

  neighbor 192.168.23.3 soft-reconfiguration inbound

  no auto-summary

  !

  end

  R3

  hostname R3

  !

  interface Loopback0

  ip address 3.3.3.3 255.255.255.255

  !

  interface FastEthernet0/0

  ip address 192.168.13.3 255.255.255.0

  speed 100

  full-duplex

  !

  interface FastEthernet0/1

  ip address 192.168.23.3 255.255.255.0

  speed 100

  full-duplex

  !

  router bgp 20

  no synchronization

  bgp router-id 3.3.3.3

  bgp log-neighbor-changes

  network 192.168.23.0

  neighbor 192.168.13.1 remote-as 10

  neighbor 192.168.13.1 soft-reconfiguration inbound

  neighbor 192.168.23.2 remote-as 20

  neighbor 192.168.23.2 next-hop-self

  neighbor 192.168.23.2 soft-reconfiguration inbound

  no auto-summary

  !

  end

  verification

  R2#sho ip route 1.1.3.0

  Routing entry for 1.1.3.0/24

  Known via "bgp 20", distance 200, metric 0

  Tag 10, type internal

  Last updatefrom 192.168.23.3 00:33:57 ago

  Routing Descriptor Blocks:

  * 192.168.23.3, from 192.168.23.3, 00:33:57 ago

  Route metric is 0, traffic share count is 1

  AS Hops 1

  Route tag 10

  R2#tra

  R2#traceroute 1.1.3.1 pro

  R2#traceroute 1.1.3.1 probe 1

  Type escape sequence to abort.

  Tracing the route to 1.1.3.1

  1 192.168.23.3 128 msec

  2 192.168.13.1 300 msec

  R3#sho ip route 1.1.1.0

  Routing entry for 1.1.1.0/24

  Known via "bgp 20", distance 200, metric 0

  Tag 10, type internal

  Last update from 192.168.23.2 00:33:49 ago

  Routing Descriptor Blocks:

  * 192.168.23.2, from 192.168.23.2, 00:33:49 ago

  Route metric is 0, traffic share count is 1

  AS Hops 1

  Route tag 10

  R3#tra

  R3#traceroute 1.1.1.1 pro

  R3#traceroute 1.1.1.1 probe 1

  Type escape sequence to abort.

  Tracing the route to 1.1.1.1

  1 192.168.23.2 48 msec

  2 192.168.12.1 360 msec

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章