本文檔介紹如何通過介面Null0在IPv6中配置黑洞。通過動態地將流量路由到死介面或收集資訊以供調查的主機,黑洞路由允許管理員阻止不想要的流量(如來自非法來源的流量或由拒絕服務(DoS)攻擊生成的流量),從而減輕攻擊對網路的影響。
嘗試此組態之前,請確保符合以下要求:
瞭解BGP路由協定及其操作
瞭解IPv6編址方案
本檔案中的資訊是根據使用Cisco IOS®軟體版本15.0(1)的Cisco 7200系列路由器。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本節提供用於設定本文件中所述功能的資訊。
註:使用Command Lookup Tool(僅限註冊客戶)可以查詢有關本文檔中使用的命令的詳細資訊。
本檔案會使用以下網路設定:
在此網路中,路由器與R1和R2之間形成eBGP關係。路由器使用OSPFv3進行內部通訊。在路由器R1中,通過配置Null0來實現黑洞,這樣,源地址為20:20::20/128的所有資料包都將指向Null0。換句話說,所有路由到Null0的流量都會被丟棄。
本檔案會使用以下設定:
| 路由器R1 |
|---|
! hostname R1 ! no ip domain lookup ip cef ipv6 unicast-routing ipv6 cef ! ! interface Loopback1 no ip address ipv6 address AA::1/128 ipv6 enable ipv6 ospf 10 area 0 ! interface Loopback10 no ip address ipv6 address AA:10::10/128 ipv6 enable ! interface FastEthernet1/0 no ip address speed auto duplex auto ipv6 address 2012:AA::1/64 ipv6 enable ipv6 ospf 10 area 0 ! router bgp 6501 bgp router-id 1.1.1.1 bgp log-neighbor-changes no bgp default ipv4-unicast neighbor BB::1 remote-as 6502 neighbor BB::1 ebgp-multihop 2 neighbor BB::1 update-source Loopback1 ! address-family ipv4 exit-address-family ! address-family ipv6 redistribute static network AA:10::10/128 neighbor BB::1 activate exit-address-family ! ipv6 route 20:20::20/128 Null0 ipv6 router ospf 10 router-id 1.1.1.1 ! end |
| 路由器R2 |
|---|
! hostname R2 ! ipv6 unicast-routing ipv6 cef ! ! interface Loopback1 no ip address ipv6 address BB::1/128 ipv6 enable ipv6 ospf 10 area 0 ! interface Loopback20 no ip address ipv6 address 20:20::20/128 ipv6 enable ! interface FastEthernet1/0 no ip address speed auto duplex auto ipv6 address 2012:AA::2/64 ipv6 enable ipv6 ospf 10 area 0 ! router bgp 6502 bgp router-id 2.2.2.2 bgp log-neighbor-changes no bgp default ipv4-unicast neighbor AA::1 remote-as 6501 neighbor AA::1 ebgp-multihop 2 neighbor AA::1 update-source Loopback1 ! address-family ipv4 exit-address-family ! address-family ipv6 network 20:20::20/128 neighbor AA::1 activate exit-address-family ! ipv6 router ospf 10 router-id 2.2.2.2 ! end |
使用本節內容,確認您的組態是否正常運作。
輸出直譯器工具(僅供已註冊客戶使用)(OIT)支援某些show命令。使用OIT檢視show命令輸出的分析。
若要驗證eBGP配置,請在路由器R1中使用show ipv6 route bgp 和show bgp ipv6 unicast 命令。
| 路由器R1 |
|---|
show ipv6 route R1#show ipv6 route bgp
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
D - EIGRP, EX - EIGRP external, ND - Neighbor Discovery
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
!--- The router R2 advertises the network 20:20::20/128, !--- but still the routing table is empty.
要檢查BGP接收的路由是什麼,請使用show bgp ipv6 unicast命令。 R1#show bgp ipv6 unicast
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, I - internal,
r RIB-failure, S Stale
Origin codes: I - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 20:20::20/128 BB::1 0 0 6502 I
*> :: 0 32768 ?
*> AA:10::10/128 :: 0 32768 I
!--- Note that the route 20:20::20/128 is received, !--- but it is not installed in the routing table.
|
使用源作為環回介面20,嘗試從路由器R2 ping路由器R1。
R2#ping ipv6 AA:10::10 source lo20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to AA:10::10, timeout is 2 seconds: Packet sent with a source address of 20:20::20 ..... Success rate is 0 percent (0/5) !--- The reason is the ICMP packet reaches !--- router R1 with source address as !--- 20:20::20/128 and therefore gets dropped.
嘗試在不使用環回介面作為源的情況下,從路由器R2 ping路由器R1。
R2#ping AA:10::10 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to AA:10::10, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/61/180 ms !--- In this case, the ICMP packet has !--- the source address as BB::1.
如果從路由器R1上刪除了ipv6 route 20:20::20/128 Null0語句,則路由器R2通告的路由20:20::20/128將安裝到路由器R1的路由表中。以下是示例輸出:
| 在路由器R1中 |
|---|
R1(config)#no ipv6 route 20:20::20/128 Null0
!--- The Null0 command in removed from router R1.
R1#show bgp ipv6 unicast
BGP table version is 7, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, I - internal,
r RIB-failure, S Stale
Origin codes: I - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 20:20::20/128 :: 0 32768 ?
* BB::1 0 0 6502 I
*> AA:10::10/128 :: 0 32768 I
!--- After the removal of the statement, !--- the route 20:20::20/128 is shown as best route.
R1#show ipv6 route bgp
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
D - EIGRP, EX - EIGRP external, ND - Neighbor Discovery
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
B 20:20::20/128 [20/0]
via BB::1
!--- You can see that the route is displayed in routing table.
|
現在嘗試從路由器R2 ping路由器R1,將源介面作為環回介面Lo 20。
R2#ping ipv6 AA:10::10 source lo20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to AA:10::10, timeout is 2 seconds: Packet sent with a source address of 20:20::20 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 0/54/140 ms !--- You can see that the ping is successful.
| 修訂 | 發佈日期 | 意見 |
|---|---|---|
1.0 |
30-Jul-2012
|
初始版本 |