满天星 发表于 2010-9-5 18:13:52

在Cisco路由器上配置IPv6 Over IPv4 GRE隧道

在Cisco路由器上配置IPv6 Over IPv4 GRE隧道
   下面我们将以Cisco路由器为例来演示如何在Cisco路由器上配置IPv6 Over IPv4 GRE隧道,本次实验采用三台Router,router1.ipv6bbs.cn、router2.ipv6bbs.cn、router3.ipv6bbs.cn均通过IPv4网络互联,运行OSPF协议模拟IPv4 Internet。router1.ipv6bbs.cn、router3.ipv6bbs.cn这二台路由器均为双栈路由器。router1.ipv6bbs.cn、router3.ipv6bbs.cn通过router2.ipv6bbs.cn建立6Over4的GRE隧道,连接二边的IPv6网络。实验中我们未在二边的IPv6网络放置PC机,因此各在二台设备上建立一个loopback接口,与隧道一起运行OSPFv3路由协议,验证将二边的IPv6网络通过6Over4 GRE隧道进行互联互通。具体的组网图如下所示:
   
实验组网图与IPv4、IPv6地址分配

    各设备的接口IPv4、IPv6地址地址与接口编号请对照下图查看:
   



配置思路与流程说明:


[*]在每台设备上配置IPv4地址并通过ospf路由协议将IPv4网络连通
[*]在第一与第三台路由器上开启IPV6功能:ipv6 unicast-routing
[*]在每台设备上创建OSPFv3进程与loopback接口地址并使能OSPFv3路由协议
[*]建立隧道,并配置隧道模式为6over4 GRE 隧道:tunnel mode gre ip
[*]配置6over4 GRE隧道的源IPv4地址与隧道对端的目的IPv4地址tunnel source    tunneldestination
[*]配置隧道的IPv6地址并使能OSPFv3路由协议,将二边的IPv6网络通过隧道连通



router1.ipv6bbs.cn的配置步骤:



步骤一:配置IPv4网络互通

router1.ipv6bbs.cn con0 is now available
Press RETURN to get started.
router1.ipv6bbs.cn>enable
router1.ipv6bbs.cn#config t
Enter configuration commands, one per line.End with CNTL/Z.
router1.ipv6bbs.cn(config)#interface gigabitEthernet 0/0
router1.ipv6bbs.cn(config-if)#ip address 1.2.0.1 255.255.255.0
router1.ipv6bbs.cn(config-if)#no shutdown
router1.ipv6bbs.cn(config-if)#exit
router1.ipv6bbs.cn(config)#
*Sep5 11:43:19.907: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep5 11:43:20.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router1.ipv6bbs.cn(config)#router ospf 100
router1.ipv6bbs.cn(config-router)#router-id 1.1.1.1
router1.ipv6bbs.cn(config-router)#network1.2.0.00.0.0.255 area 0
router1.ipv6bbs.cn(config-router)#exit
router1.ipv6bbs.cn(config)#

步骤二:配置IPv6隧道与IPv6网络互通
router1.ipv6bbs.cn(config)#
router1.ipv6bbs.cn(config)#ipv6 unicast-routing
router1.ipv6bbs.cn(config)#
router1.ipv6bbs.cn(config)#ipv6 router ospf 100
router1.ipv6bbs.cn(config-rtr)#router-id1.1.1.1
router1.ipv6bbs.cn(config-rtr)#exit
router1.ipv6bbs.cn(config)#
router1.ipv6bbs.cn(config)#interfaceloopback1
router1.ipv6bbs.cn(config-if)#
*Sep5 11:50:24.455: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router1.ipv6bbs.cn(config-if)#ipv6 enable
router1.ipv6bbs.cn(config-if)#ipv6 address 1::1/128
router1.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router1.ipv6bbs.cn(config-if)#exit
router1.ipv6bbs.cn(config)#
router1.ipv6bbs.cn(config)#interfacetunnel0
router1.ipv6bbs.cn(config-if)#tunnelmodegreip
router1.ipv6bbs.cn(config-if)#tunnelsource1.2.0.1
router1.ipv6bbs.cn(config-if)#tunneldestination2.3.0.2
router1.ipv6bbs.cn(config-if)#
*Sep5 11:58:26.307: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
router1.ipv6bbs.cn(config-if)#ipv6 enable
router1.ipv6bbs.cn(config-if)#ipv6 address1003::1/64
router1.ipv6bbs.cn(config-if)#ipv6 ospf100 area 0
router1.ipv6bbs.cn(config-if)#exit
router1.ipv6bbs.cn(config)#exit
router1.ipv6bbs.cn#



router2.ipv6bbs.cn的配置步骤:



router2.ipv6bbs.cn为纯IPv4网络,因此只需配置IPv4网络互通即可

router2.ipv6bbs.cn con0 is now available
Press RETURN to get started.
router2.ipv6bbs.cn>en
router2.ipv6bbs.cn#conf t
Enter configuration commands, one per line.End with CNTL/Z.
router2.ipv6bbs.cn(config)#interface gigabitEthernet0/0
router2.ipv6bbs.cn(config-if)#ip address1.2.0.2 255.255.255.0
router2.ipv6bbs.cn(config-if)#no shutdown
router2.ipv6bbs.cn(config-if)#exit
router2.ipv6bbs.cn(config)#
*Sep5 11:46:02.707: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep5 11:46:03.707: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router2.ipv6bbs.cn(config)#
router2.ipv6bbs.cn(config)#interfacegigabitEthernet 1/0
router2.ipv6bbs.cn(config-if)#ip address2.3.0.1 255.255.255.0
router2.ipv6bbs.cn(config-if)#no shutdown
router2.ipv6bbs.cn(config-if)#
*Sep5 11:46:32.599: %LINK-3-UPDOWN: Interface GigabitEthernet1/0, changed state to up
*Sep5 11:46:33.599: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0, changed state to up
router2.ipv6bbs.cn(config-if)#exit
router2.ipv6bbs.cn(config)#router ospf 100
router2.ipv6bbs.cn(config-router)#router-id 2.2.2.2
router2.ipv6bbs.cn(config-router)#
router2.ipv6bbs.cn(config-router)#network 1.2.0.0 0.0.0.255 area 0
router2.ipv6bbs.cn(config-router)#
*Sep5 11:47:42.675: %OSPF-5-ADJCHG: Process 100, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router2.ipv6bbs.cn(config-router)#
router2.ipv6bbs.cn(config-router)#network 2.3.0.0 0.0.0.255 area 0
router2.ipv6bbs.cn(config-router)#




router3.ipv6bbs.cn的配置步骤:


步骤一:配置IPv4网络互通
router3.ipv6bbs.cn con0 is now available
Press RETURN to get started.
router3.ipv6bbs.cn>en
router3.ipv6bbs.cn#conf t
Enter configuration commands, one per line.End with CNTL/Z.
router3.ipv6bbs.cn(config)#interfacegigabitEthernet 0/0
router3.ipv6bbs.cn(config-if)#ip address2.3.0.2 255.255.255.0
router3.ipv6bbs.cn(config-if)#no shutdown
router3.ipv6bbs.cn(config-if)#
*Sep5 11:47:40.159: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep5 11:47:41.159: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router3.ipv6bbs.cn(config-if)#exit
router3.ipv6bbs.cn(config)#router ospf 100
router3.ipv6bbs.cn(config-router)#router-id 3.3.3.3
router3.ipv6bbs.cn(config-router)#network 2.3.0.0 0.0.0.255 area 0
router3.ipv6bbs.cn(config-router)#
*Sep5 11:48:09.379: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router3.ipv6bbs.cn(config-router)#exit

步骤二:配置IPv6隧道与IPv6网络互通

router3.ipv6bbs.cn(config)#
router3.ipv6bbs.cn(config)#ipv6 unicast-routing
router3.ipv6bbs.cn(config)#
router3.ipv6bbs.cn(config)#ipv6 router ospf 100
router3.ipv6bbs.cn(config-rtr)#router-id3.3.3.3
router3.ipv6bbs.cn(config-rtr)#exit
router3.ipv6bbs.cn(config)#interfaceloopback1
router3.ipv6bbs.cn(config-if)#
*Sep5 11:58:27.947: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router3.ipv6bbs.cn(config-if)#ipv6enable
router3.ipv6bbs.cn(config-if)#ipv6address3::3/128
router3.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router3.ipv6bbs.cn(config-if)#exit
router3.ipv6bbs.cn(config)#interfacetunnel0
router3.ipv6bbs.cn(config-if)#tunnelmodegreip
router3.ipv6bbs.cn(config-if)#tunnelsource2.3.0.2
router3.ipv6bbs.cn(config-if)#tunneldestination 1.2.0.1
router3.ipv6bbs.cn(config-if)#
*Sep5 11:59:16.051: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
router3.ipv6bbs.cn(config-if)#ipv6 enable
router3.ipv6bbs.cn(config-if)#ipv6 address 1003::2/64
router3.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router3.ipv6bbs.cn(config-if)#
*Sep5 11:59:39.431: %OSPFv3-5-ADJCHG: Process 100, Nbr 1.1.1.1 on Tunnel0 from LOADING to FULL, Loading Done
router3.ipv6bbs.cn(config-if)#exit
router3.ipv6bbs.cn(config)#exit
router3.ipv6bbs.cn#



查看各设备OSPF与OSPFv3邻居、IPv6路由表

所有设备之间的IPv4、IPv6路由协议已按照组网图配置完毕,我们可以在router1.ipv6bbs.cn上查看OSPF、OSPFv3的邻居
并查看IPv6路由表,隧道接口的IPv6地址信息。
并pingrouter3.ipv6bbs.cn上面的loopback接口ipv6地址,均能正常通讯



router1.ipv6bbs.cn#
*Sep5 12:00:36.607: %OSPFv3-5-ADJCHG: Process 100, Nbr 3.3.3.3 on Tunnel0 from LOADING to FULL, Loading Done
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#show ip ospf neighbor

Neighbor ID   Pri   State         Dead Time   Address         Interface
2.2.2.2         1   FULL/BDR      00:00:36    1.2.0.2         GigabitEthernet0/0
router1.ipv6bbs.cn#show ipv6 ospfneighbor

Neighbor ID   Pri   State         Dead Time   Interface ID    Interface
3.3.3.3         0   FULL/-      00:00:33    7               Tunnel0
router1.ipv6bbs.cn#show ipv6 route
IPv6 Routing Table - default - 5 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, M - MIPv6, 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
LC1::1/128
   via Loopback1, receive
O   3::3/128
   via FE80::203:2, Tunnel0
C   1003::/64
   via Tunnel0, directly connected
L   1003::1/128
   via Tunnel0, receive
L   FF00::/8
   via Null0, receive
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#show ipv6 interfacetunnel0
Tunnel0 is up, line protocol is up
IPv6 is enabled, link-local address is FE80::C80E:BFF:FE48:6
No Virtual link-local address(es):
Global unicast address(es):
    1003::1, subnet is 1003::/64
Joined group address(es):
    FF02::1
    FF02::2
    FF02::5
    FF02::1:FF00:1
    FF02::1:FF48:6
MTU is 1476 bytes
ICMP error messages limited to one every 100 milliseconds
ICMP redirects are enabled
ICMP unreachables are sent
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds (using 30000)
Hosts use stateless autoconfig for addresses.
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#show interfacestunnel0
Tunnel0 is up, line protocol is up
Hardware is Tunnel
MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec,
   reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel source 1.2.0.1, destination 2.3.0.2
Tunnel protocol/transport GRE/IP
    Key disabled, sequencing disabled
    Checksumming of packets disabled
Tunnel TTL 255, Fast tunneling enabled
Tunnel transport MTU 1476 bytes
Tunnel transmit bandwidth 8000 (kbps)
Tunnel receive bandwidth 8000 (kbps)
Last input 00:00:05, output 00:00:03, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
   39 packets input, 4468 bytes, 0 no buffer
   Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
   0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
   45 packets output, 5024 bytes, 0 underruns
   0 output errors, 0 collisions, 0 interface resets
   0 unknown protocol drops
   0 output buffer failures, 0 output buffers swapped out
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#tracerouteipv6 3::3

Type escape sequence to abort.
Tracing the route to 3::3

1 1003::2 148 msec 144 msec 188 msec
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#ping ipv6 1003::2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1003::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/176/208 ms
router1.ipv6bbs.cn#ping ipv6 3::3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 160/177/196 ms
router1.ipv6bbs.cn#
router1.ipv6bbs.cn#


查看router2.ipv6bbs.cn上面的OSPF邻居:



router2.ipv6bbs.cn#show ip ospfneighbor

Neighbor ID   Pri   State         Dead Time   Address         Interface
3.3.3.3         1   FULL/BDR      00:00:31    2.3.0.2         GigabitEthernet1/0
1.1.1.1         1   FULL/DR         00:00:31    1.2.0.1         GigabitEthernet0/0
router2.ipv6bbs.cn#


查看router3.ipv6bbs.cn上面的的OSPF、OSPFv3、IPv6路由表、Tunnel接口IPv6地址信息:


router3.ipv6bbs.cn#showip ospfneighbor

Neighbor ID   Pri   State         Dead Time   Address         Interface
2.2.2.2         1   FULL/DR         00:00:30    2.3.0.1         GigabitEthernet0/0
router3.ipv6bbs.cn#show ipv6 ospfneighbor

Neighbor ID   Pri   State         Dead Time   Interface ID    Interface
1.1.1.1         0   FULL/-      00:00:30    7               Tunnel0
router3.ipv6bbs.cn#
router3.ipv6bbs.cn#show ipv6 route
IPv6 Routing Table - default - 5 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, M - MIPv6, 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
O   1::1/128
   via FE80::102:1, Tunnel0
LC3::3/128
   via Loopback1, receive
C   1003::/64
   via Tunnel0, directly connected
L   1003::2/128
   via Tunnel0, receive
L   FF00::/8
   via Null0, receive
router3.ipv6bbs.cn#ping ipv6 1::1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 136/172/216 ms
router3.ipv6bbs.cn#show ipv6 interfacetunnel0
Tunnel0 is up, line protocol is up
IPv6 is enabled, link-local address is FE80::C810:BFF:FE94:6
No Virtual link-local address(es):
Global unicast address(es):
    1003::2, subnet is 1003::/64
Joined group address(es):
    FF02::1
    FF02::2
    FF02::5
    FF02::1:FF00:2
    FF02::1:FF94:6
MTU is 1476 bytes
ICMP error messages limited to one every 100 milliseconds
ICMP redirects are enabled
ICMP unreachables are sent
ND DAD is enabled, number of DAD attempts: 1
ND reachable time is 30000 milliseconds (using 30000)
Hosts use stateless autoconfig for addresses.
router3.ipv6bbs.cn#
router3.ipv6bbs.cn#show interfacestunnel0
Tunnel0 is up, line protocol is up
Hardware is Tunnel
MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec,
   reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel source 2.3.0.2, destination 1.2.0.1
Tunnel protocol/transport GRE/IP
    Key disabled, sequencing disabled
    Checksumming of packets disabled
Tunnel TTL 255, Fast tunneling enabled
Tunnel transport MTU 1476 bytes
Tunnel transmit bandwidth 8000 (kbps)
Tunnel receive bandwidth 8000 (kbps)
Last input 00:00:08, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
   71 packets input, 7940 bytes, 0 no buffer
   Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
   0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
   82 packets output, 9040 bytes, 0 underruns
   0 output errors, 0 collisions, 0 interface resets
   0 unknown protocol drops
   0 output buffer failures, 0 output buffers swapped out
router3.ipv6bbs.cn#

vjer 发表于 2013-7-4 18:09:27

感谢楼主分享,好教材的
页: [1]
查看完整版本: 在Cisco路由器上配置IPv6 Over IPv4 GRE隧道