ѧϰ-MPLS-VPN
2007-06-24 20:48:22
°æÈ¨ÉùÃ÷£ºÔ´´×÷Æ·£¬ÔÊÐí×ªÔØ£¬×ªÔØÊ±ÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕ Ôʼ³ö´¦ ¡¢×÷ÕßÐÅÏ¢ºÍ±¾ÉùÃ÷¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£http://skyyue.blog.51cto.com/159530/31537 |
![]() ÔÚMPLS-VPNÖÐ R1 R5·Ö±ðΪCE-1 CE-2 R2 R3 R4ΪMPLSºËÐÄÍø
Ò».ÅäÖ÷ֽâ
1.»ù±¾ÅäÖÃ
R1 ΪCE-1 VPNA ¿Í»§ interface Loopback0 ip address 1.1.1.1 255.255.255.0 ip ospf network point-to-point ! interface Serial1/0 ip address 12.1.1.1 255.255.255.0 ! router ospf 2 log-adjacency-changes network 1.1.1.0 0.0.0.255 area 0 network 12.1.1.0 0.0.0.255 area 0 //ÎÒÃÇÔÚÁ½¸öVPN¿Í»§Ö®¼äÔËÐж¯Ì¬Â·ÓÉÐÒéOSPF ¿ÉÒÔ¼Ó¿ìÍøÂçµÄÊÕÁ²ºÍÍøÂ簲ȫ¿É¿¿ R5ΪCE-2 VPNA ¿Í»§
interface Loopback0 ip address 5.5.5.5 255.255.255.0 ip ospf network point-to-point ! interface Serial1/0 no ip address shutdown serial restart-delay 0 ! interface Serial1/1 ip address 45.1.1.5 255.255.255.0 ! router ospf 2 network 5.5.5.0 0.0.0.255 area 0 network 45.1.1.0 0.0.0.255 area 0 R2 ΪPE-1 MPLS-VPN ºËÐÄÍø±ßÔµ½ÓÈëÉ豸
interface Loopback0 ip address 2.2.2.2 255.255.255.0 ! interface Serial1/0 ip address 12.1.1.2 255.255.255.0 ! interface Serial1/1 ip address 23.1.1.2 255.255.255.0 ! router ospf 1 router-id 2.2.2.2 network 2.2.2.0 0.0.0.255 area 0 network 23.1.1.0 0.0.0.255 area 0 R4 ΪPE-2 MPLS-VPN ºËÐÄÍø±ßÔµ½ÓÈëÉ豸
nterface Loopback0 ip address 4.4.4.4 255.255.255.0 ! interface Serial1/0 ip address 34.1.1.4 255.255.255.0 ! interface Serial1/1 ip address 45.1.1.4 255.255.255.0 router ospf 1 router-id 4.4.4.4 network 4.4.4.0 0.0.0.255 area 0 network 34.1.1.0 0.0.0.255 area 0 R3 ΪP MPLS-VPN ºËÐÄÉ豸
interface Loopback0 ip address 3.3.3.3 255.255.255.0 ! interface Serial1/0 ip address 34.1.1.3 255.255.255.0 ! interface Serial1/1 ip address 23.1.1.3 255.255.255.0 ! router ospf 1 router-id 3.3.3.3 log-adjacency-changes network 3.3.3.0 0.0.0.255 area 0 network 23.1.1.0 0.0.0.255 area 0 network 34.1.1.0 0.0.0.255 area 0 //MPLS ºËÐÄÔËÐÐOSPFÐÒé,ÔÚMPLS IP ³ÇÇøÓòÍøÖÐ,Ò²¿ÉÒÔ²ÉÓÃIS-ISÐÒé.ÒòΪIS-ISÍøÂç¾ßÓиüºÃµÄ¿ÉÀ©Õ¹ÐÔ 2.MPLSÍøÂçÅäÖÃ
ÒòΪR2-R3-R4ΪMPLSÍøÂç,ËùÒÔÒªÔÚËûÃÇÉÏÆôÓÃMPLS IP.²¢ÇÒÖ»ÄÜÔÚÊôÓÚMPLS IP½Ó¿ÚÉÏÆôÓÃMPLS IP R2ÉÏÅäÖà ip cef int s1/1 mpls label protocol ldp mpls ip ÆôÓÃMPLS //mpls label pro LDP | TDP | both LDP Êǹú¼Ê±ê×¼,ÏÖÔÚÓõÄ×î¹ã TDP ÊÇCISCO˽ÓÐÐÒé BOTH ±íʾÔÚMPLSÍøÂç¿ÉÒÔÖ§³ÖÁ½ÖÖÐÒé R3ÉÏÅäÖÃ
ip cef int s1/1 mpls label protocol ldp mpls ip int s1/0 mpls label protocol ldp mpls ip R4ÉÏÅäÖÃ
int s1/0 mpls label protocol ldp mpls ip R3#sh mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 18 Pop tag 2.2.2.0/24 4680 Se1/1 point2point 19 Pop tag 4.4.4.0/24 5475 Se1/0 point2point //PÉÏ»ùÓÚlabel ת·¢,ÒòΪ23.1.1.0/24 Óë34.1.1.0/24ÊÇÖ±Á¬µÄÍøÂç,ËùÒÔ²»»á´òÉÏlabel,Èç¹ûÊÇ/32µÄλÖ÷»ú·ÓÉ,Õâ²»»á´òÉÏtag ,ËùÔÚÒªÔÚR2ÓëR4 µÄ»·»Ø¿ÚʹÓà ip os network point-to-point R2#sh mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface 16 Pop tag 34.1.1.0/24 0 Se1/1 point2point 17 Untagged 1.1.1.0/24[V] 2080 Se1/0 point2point 18 Aggregate 12.1.1.0/24[V] 0 19 Pop tag 3.3.3.0/24 0 Se1/1 point2point 20 19 4.4.4.0/24 0 Se1/1 point2point //ÕâÊÇÎÒÃÇÕû¸ö·½°¸ÅäÖÃÍêºó,R2ÉÏMPLS IPת·¢±í,ÎÒÃǵÄFLIB ÊǸù¾ÝFIB+LIBÉú³ÉµÄ. ÅäÖÃÍê³Éºó,ÎÒÃÇ¿ÉÒÔ¿´µ½MPLS ÁÚ¾Ó
R2#sh mpls ldp nei Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0 TCP connection: 3.3.3.3.30806 - 2.2.2.2.646 State: Oper; Msgs sent/rcvd: 93/92; Downstream Up time: 01:03:43 LDP discovery sources: Serial1/1, Src IP addr: 23.1.1.3 Addresses bound to peer LDP Ident: 34.1.1.3 23.1.1.3 3.3.3.3 //´ÓÉÏ¿ÉÒÔ¿´ÊÇ»ùÓÚTCPÁ¬½Ó ±¾µØ¶Ë¿Ú646 3.ÅäÖÃPE-1ÓëPE-2µÄBGP R2ÉÏÅäÖà router bgp 1 bgp router-id 2.2.2.2 nei 4.4.4.4 remot 1 nei 4.4.4.4 updata lo0 R4ÉÏÅäÖà router bgp 1 bgp router-id 4.4.4.4 neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 update-source Loopback0 //½¨Á¢BGP¶ÔµÈÌå ²ÉÓû·»Ø¿Ú×÷Ϊ¸üÐÂÔ´ ÅäÖÃÍê³Éºó,²é¿´BGPÁÚ¾ÓÊÇ·ñ½¨Á¢³É¹¦
R2#sh ip bgp nei BGP neighbor is 4.4.4.4, remote AS 1, internal link BGP version 4, remote router ID 4.4.4.4 BGP state = Established, up for 01:01:55 Last read 00:00:04, hold time is 180, keepalive interval is 60 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received 4.ÔÚBGP·ÓÉÉÏ,Ö§³ÖMP-BGPÐÒé,ÒòΪBGPĬÈÏÖ§³ÖIPV4-uncast .ÎÒÃÇÈÃÆäÖ§³ÖVPNV4 µØÖ·
R2ÉÏÅäÖà router bgp 1 no bgp default ipv4-unicast address-family vpnv4 neighbor 4.4.4.4 activate R4ÉÏÅäÖà router bgp 1 no bgp default ipv4-unicast address-family vpnv4 neighbor 2.2.2.2 activate ÅäÖÃÍê³Éºó,ÎÒÃÇÓÃshow ip bgp nei ²é¿´
R2#sh ip bgp nei BGP neighbor is 4.4.4.4, remote AS 1, internal link BGP version 4, remote router ID 4.4.4.4 BGP state = Established, up for 01:01:55 Last read 00:00:04, hold time is 180, keepalive interval is 60 seconds Neighbor capabilities: Route refresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Address family VPNv4 Unicast: advertised and received //´ÓÉÏÃæºìÉ«×ÖÌå¿´³ö,ÄܽÓÊÜÓë·¢ËÍVPNv4µØÖ· 5.ÔÚPE-1ºÍPE-2ÉϽ¨Á¢VPNµÄ·ÓÉת·¢±í,¼´ip vrf
R2ºÍR4ÉÏÅäÖà ip vrf vpna rd 1:100 route-target export 1:100 route-target import 1:100 //rd ÊÇΪÀ´Çø·Ö²»Í¬VPN¿Í»§Ö®¼äʹÓÃÏàͬ˽ÓеØÖ·Ê±Óõ½µÄ. route-target export | import Êǵ±Á½¸ö ²»Í¬µÄVPN¿Í»§Ö®¼äҪͨÐÅʱ,½«²»Í¬VPNAµÄת·¢±íµ¼³ö»òµ¼Èë. ½«PE-1 Óë PE-2¶ÔÓ¦µÄ½Ó¿ÚIP·Åµ½VRFת·¢±íÖÐ
R2 ÓëR4µÄÅäÖÃ
router os 2 vrf vpna net 12.1.1.0 255.255.255.0 a 0 router os 2 vrf vpna net 45.1.1.0 255.255.255.0 a 0 ½«×ª·¢±íÓ¦Óõ½VPNÓû§½Ó·Å¶Ë¿ÚÉÏ
R2 Óë R4 ·Ö±ðÊÇS1/0 S1/1 int s/0 s1/0 ip vrf forwarding vpna ÐèÒª½Ó¿ÚÖØÐÂÅäÖÃIP µØÖ· 6.½«MP-BGP Óë ip vrf forwarding ·ÓɱíÖ®¼ä½øÐÐÖØ·Ö²¼,VRFÐÅÏ¢ÊÇͨ¹ýMP-BGPÔÚMPLS ºËÐÄÍøÉÏ´«ÊäµÄ
R2ºÍR4ÉÏÅäÖà router os 2 vrf vpna redistribute bgp 1 metric 10 subnets router bgp 1 address-family ipv4 vrf vpna redistribute ospf 2 metric 10 ÅäÖÃÍê³Éºó,ÔÚR1ÓëR5ÉÏÓÃshwo ip route
R1#sh ip rou 1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0 5.0.0.0/24 is subnetted, 1 subnets O IA 5.5.5.0 [110/74] via 12.1.1.2, 01:12:29, Serial1/0 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial1/0 45.0.0.0/24 is subnetted, 1 subnets O IA 45.1.1.0 [110/74] via 12.1.1.2, 01:12:29, Serial1/0 //³É¹¦Ñ§µ½Á˶ԶËVPNAµÄ·ÓÉÐÅÏ¢ R2#sh ip rou vrf vpna 1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 12.1.1.1, 01:16:21, Serial1/0 5.0.0.0/24 is subnetted, 1 subnets B 5.5.5.0 [200/10] via 4.4.4.4, 01:09:23 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial1/0 45.0.0.0/24 is subnetted, 1 subnets B 45.1.1.0 [200/0] via 4.4.4.4, 01:13:16 //¿ÉÒÔ¿´³öVRFÊÇͨ¹ýBGP´«ÊäµÄ R2#ping vrf vpna 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 288/592/1476 ms R1#ping 5.5.5.5 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 288/572/1312 ms //OK,Á½¸öVPN¿Í»§Ö®¼äÄÜPING ͨ ¶þ.ÍêÕûÅäÖÃ
R1#sh run
Building configuration... Current configuration : 1020 bytes
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R1 ! boot-start-marker boot-end-marker ! no aaa new-model ip subnet-zero ! ip cef ! interface Loopback0 ip address 1.1.1.1 255.255.255.0 ip ospf network point-to-point ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface Serial1/0 ip address 12.1.1.1 255.255.255.0 serial restart-delay 0 ! interface Serial1/1 no ip address shutdown serial restart-delay 0 ! interface Serial1/2 no ip address shutdown serial restart-delay 0 ! interface Serial1/3 no ip address shutdown serial restart-delay 0 ! router ospf 2 log-adjacency-changes network 1.1.1.0 0.0.0.255 area 0 network 12.1.1.0 0.0.0.255 area 0 ! ip classless no ip http server no ip http secure-server gatekeeper shutdown ! ! line con 0 exec-timeout 0 0 logging synchronous stopbits 1 line aux 0 stopbits 1 line vty 0 4 ! ! end R2#sh run
Building configuration... Current configuration : 1816 bytes
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R2 ! boot-start-marker boot-end-marker ! no aaa new-model ip subnet-zero ! ip vrf vpna
rd 1:100 route-target export 1:100 route-target import 1:100 ! ip cef ! interface Loopback0 ip address 2.2.2.2 255.255.255.0 ip ospf network point-to-point ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface Serial1/0 ip vrf forwarding vpna ip address 12.1.1.2 255.255.255.0 serial restart-delay 0 ! interface Serial1/1 ip address 23.1.1.2 255.255.255.0 mpls label protocol ldp tag-switching ip serial restart-delay 0 ! interface Serial1/2 no ip address shutdown serial restart-delay 0 ! interface Serial1/3 no ip address shutdown serial restart-delay 0 ! router ospf 1 router-id 2.2.2.2 log-adjacency-changes network 2.2.2.0 0.0.0.255 area 0 network 23.1.1.0 0.0.0.255 area 0 ! router ospf 2 vrf vpna log-adjacency-changes redistribute bgp 1 metric 10 subnets network 12.1.1.0 0.0.0.255 area 0 ! router bgp 1 bgp router-id 2.2.2.2 no bgp default ipv4-unicast bgp log-neighbor-changes neighbor 4.4.4.4 remote-as 1 neighbor 4.4.4.4 update-source Loopback0 ! address-family ipv4 neighbor 4.4.4.4 activate no auto-summary no synchronization exit-address-family ! address-family vpnv4 neighbor 4.4.4.4 activate neighbor 4.4.4.4 send-community extended exit-address-family ! address-family ipv4 vrf vpna redistribute ospf 2 no auto-summary no synchronization exit-address-family ! ip classless no ip http server no ip http secure-server ! gatekeeper shutdown ! ! line con 0 exec-timeout 0 0 logging synchronous stopbits 1 line aux 0 stopbits 1 line vty 0 4 ! ! end R3#sh run
Building configuration... Current configuration : 1170 bytes
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R3 ! boot-start-marker boot-end-marker ! ! no aaa new-model ip subnet-zero ! ! ! ip cef ! interface Loopback0 ip address 3.3.3.3 255.255.255.0 ip ospf network point-to-point ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface Serial1/0 ip address 34.1.1.3 255.255.255.0 mpls label protocol ldp tag-switching ip serial restart-delay 0 ! interface Serial1/1 ip address 23.1.1.3 255.255.255.0 mpls label protocol ldp tag-switching ip serial restart-delay 0 ! interface Serial1/2 no ip address shutdown serial restart-delay 0 ! interface Serial1/3 no ip address shutdown serial restart-delay 0 ! router ospf 1 router-id 3.3.3.3 log-adjacency-changes network 3.3.3.0 0.0.0.255 area 0 network 23.1.1.0 0.0.0.255 area 0 network 34.1.1.0 0.0.0.255 area 0 ! ip classless no ip http server no ip http secure-server ! gatekeeper
shutdown ! ! line con 0 exec-timeout 0 0 logging synchronous stopbits 1 line aux 0 stopbits 1 line vty 0 4 ! ! end R4#sh run
Building configuration... Current configuration : 1826 bytes
! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R4 ! boot-start-marker boot-end-marker ! no aaa new-model ip subnet-zero ! ip vrf vpna rd 1:100 route-target export 1:100 route-target import 1:100 ! ip cef ! interface Loopback0 ip address 4.4.4.4 255.255.255.0 ip ospf network point-to-point ! interface FastEthernet0/0 no ip address shutdown duplex half ! interface Serial1/0 ip address 34.1.1.4 255.255.255.0 mpls label protocol ldp tag-switching ip serial restart-delay 0 ! interface Serial1/1 ip vrf forwarding vpna ip address 45.1.1.4 255.255.255.0 serial restart-delay 0 ! interface Serial1/2 no ip address shutdown serial restart-delay 0 ! interface Serial1/3 no ip address shutdown serial restart-delay 0 ! router ospf 1 router-id 4.4.4.4 log-adjacency-changes network 4.4.4.0 0.0.0.255 area 0 network 34.1.1.0 0.0.0.255 area 0 ! router ospf 2 vrf vpna log-adjacency-changes redistribute bgp 1 metric 10 subnets network 45.1.1.0 0.0.0.255 area 0 ! router bgp 1 bgp router-id 4.4.4.4 no bgp default ipv4-unicast bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 update-source Loopback0 ! address-family ipv4 neighbor 2.2.2.2 activate no auto-summary no synchronization exit-address-family ! address-family vpnv4 neighbor 2.2.2.2 activate neighbor 2.2.2.2 send-community extended exit-address-family ! address-family ipv4 vrf vpna redistribute ospf 2 metric 10 no auto-summary no synchronization exit-address-family ! ip classless no ip http server no ip http secure-server ! gatekeeper shutdown ! ! line con 0 exec-timeout 0 0 logging synchronous stopbits 1 line aux 0 stopbits 1 line vty 0 4 end R5(config-if)#end
R5#sh run Building configuration... *Jun 24 15:40:05.831: %SYS-5-CONFIG_I: Configured from console by console Current configuration : 1020 bytes ! version 12.3 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname R5 ±¾Îijö×Ô ¡°skyyue¡± ²©¿Í£¬ÇëÎñ±Ø±£Áô´Ë³ö´¦http://skyyue.blog.51cto.com/159530/31537 ±¾Îijö×Ô 51CTO.COM¼¼Êõ²©¿Í |



skyyue
²©¿Íͳ¼ÆÐÅÏ¢
ÈÈÃÅÎÄÕÂ
×îÐÂÆÀÂÛ
ÓÑÇéÁ´½Ó