在Cisco路由器上配置IPv6 Over IPv4 GRE隧道
下面我们将以Cisco路由器为例来演示如何在Cisco路由器上配置IPv6 Over IPv4 GRE隧道,本次实验采用三台Router,router1.ipv6s.com、router2.ipv6s.com、router3.ipv6s.com均通过IPv4网络互联,运行OSPF协议模拟IPv4 Internet。router1.ipv6s.com、router3.ipv6s.com这二台路由器均为双栈路由器。router1.ipv6s.com、router3.ipv6s.com通过router2.ipv6s.com建立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 tunnel destination
- 配置隧道的IPv6地址并使能OSPFv3路由协议,将二边的IPv6网络通过隧道连通
router1.ipv6s.com的配置步骤:
步骤一:配置IPv4网络互通
router1.ipv6s.com con0 is now available
Press RETURN to get started.
router1.ipv6s.com>
enable
router1.ipv6s.com#
config t
Enter configuration commands, one per line. End with CNTL/Z.
router1.ipv6s.com(config)#
interface gigabitEthernet 0/0
router1.ipv6s.com(config-if)#
ip address 1.2.0.1 255.255.255.0
router1.ipv6s.com(config-if)#
no shutdown
router1.ipv6s.com(config-if)#
exit
router1.ipv6s.com(config)#
*Sep 5 11:43:19.907: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep 5 11:43:20.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router1.ipv6s.com(config)#
router ospf 100
router1.ipv6s.com(config-router)#
router-id 1.1.1.1
router1.ipv6s.com(config-router)#
network 1.2.0.0 0.0.0.255 area 0
router1.ipv6s.com(config-router)#
exit
router1.ipv6s.com(config)#步骤二:配置IPv6隧道与IPv6网络互通
router1.ipv6s.com(config)#
router1.ipv6s.com(config)#
ipv6 unicast-routing
router1.ipv6s.com(config)#
router1.ipv6s.com(config)#
ipv6 router ospf 100
router1.ipv6s.com(config-rtr)#
router-id 1.1.1.1
router1.ipv6s.com(config-rtr)#
exit
router1.ipv6s.com(config)#
router1.ipv6s.com(config)#
interface loopback 1
router1.ipv6s.com(config-if)#
*Sep 5 11:50:24.455: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router1.ipv6s.com(config-if)#
ipv6 enable
router1.ipv6s.com(config-if)#
ipv6 address 1::1/128
router1.ipv6s.com(config-if)#
ipv6 ospf 100 area 0
router1.ipv6s.com(config-if)#
exit
router1.ipv6s.com(config)#
router1.ipv6s.com(config)#
interface tunnel 0
router1.ipv6s.com(config-if)#
tunnel mode gre ip
router1.ipv6s.com(config-if)#
tunnel source 1.2.0.1
router1.ipv6s.com(config-if)#
tunnel destination 2.3.0.2
router1.ipv6s.com(config-if)#
*Sep 5 11:58:26.307: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
router1.ipv6s.com(config-if)#
ipv6 enable
router1.ipv6s.com(config-if)#
ipv6 address 1003::1/64
router1.ipv6s.com(config-if)#
ipv6 ospf 100 area 0
router1.ipv6s.com(config-if)#
exit
router1.ipv6s.com(config)#
exit
router1.ipv6s.com#
router2.ipv6s.com的配置步骤:
router2.ipv6s.com为纯IPv4网络,因此只需配置IPv4网络互通即可
router2.ipv6s.com con0 is now available
Press RETURN to get started.
router2.ipv6s.com>
en
router2.ipv6s.com#
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router2.ipv6s.com(config)#
interface gigabitEthernet 0/0
router2.ipv6s.com(config-if)#
ip address 1.2.0.2 255.255.255.0
router2.ipv6s.com(config-if)#
no shutdown
router2.ipv6s.com(config-if)#
exit
router2.ipv6s.com(config)#
*Sep 5 11:46:02.707: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep 5 11:46:03.707: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router2.ipv6s.com(config)#
router2.ipv6s.com(config)#
interface gigabitEthernet 1/0
router2.ipv6s.com(config-if)#
ip address 2.3.0.1 255.255.255.0
router2.ipv6s.com(config-if)#
no shutdown
router2.ipv6s.com(config-if)#
*Sep 5 11:46:32.599: %LINK-3-UPDOWN: Interface GigabitEthernet1/0, changed state to up
*Sep 5 11:46:33.599: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0, changed state to up
router2.ipv6s.com(config-if)#
exit
router2.ipv6s.com(config)#
router ospf 100
router2.ipv6s.com(config-router)#
router-id 2.2.2.2
router2.ipv6s.com(config-router)#
router2.ipv6s.com(config-router)#
network 1.2.0.0 0.0.0.255 area 0
router2.ipv6s.com(config-router)#
*Sep 5 11:47:42.675: %OSPF-5-ADJCHG: Process 100, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router2.ipv6s.com(config-router)#
router2.ipv6s.com(config-router)#
network 2.3.0.0 0.0.0.255 area 0
router2.ipv6s.com(config-router)#
router3.ipv6s.com的配置步骤:
步骤一:配置IPv4网络互通
router3.ipv6s.com con0 is now available
Press RETURN to get started.
router3.ipv6s.com>
en
router3.ipv6s.com#
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router3.ipv6s.com(config)#
interface gigabitEthernet 0/0
router3.ipv6s.com(config-if)#
ip address 2.3.0.2 255.255.255.0
router3.ipv6s.com(config-if)#
no shutdown
router3.ipv6s.com(config-if)#
*Sep 5 11:47:40.159: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Sep 5 11:47:41.159: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router3.ipv6s.com(config-if)#
exit
router3.ipv6s.com(config)#
router ospf 100
router3.ipv6s.com(config-router)#
router-id 3.3.3.3
router3.ipv6s.com(config-router)#
network 2.3.0.0 0.0.0.255 area 0
router3.ipv6s.com(config-router)#
*Sep 5 11:48:09.379: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router3.ipv6s.com(config-router)#
exit步骤二:配置IPv6隧道与IPv6网络互通
router3.ipv6s.com(config)#
router3.ipv6s.com(config)#
ipv6 unicast-routing
router3.ipv6s.com(config)#
router3.ipv6s.com(config)#
ipv6 router ospf 100
router3.ipv6s.com(config-rtr)#
router-id 3.3.3.3
router3.ipv6s.com(config-rtr)#
exit
router3.ipv6s.com(config)#
interface loopback 1
router3.ipv6s.com(config-if)#
*Sep 5 11:58:27.947: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router3.ipv6s.com(config-if)#
ipv6 enable
router3.ipv6s.com(config-if)#
ipv6 address 3::3/128
router3.ipv6s.com(config-if)#
ipv6 ospf 100 area 0
router3.ipv6s.com(config-if)#
exit
router3.ipv6s.com(config)#
interface tunnel 0
router3.ipv6s.com(config-if)#
tunnel mode gre ip
router3.ipv6s.com(config-if)#
tunnel source 2.3.0.2
router3.ipv6s.com(config-if)#
tunnel destination 1.2.0.1
router3.ipv6s.com(config-if)#
*Sep 5 11:59:16.051: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up
router3.ipv6s.com(config-if)#
ipv6 enable
router3.ipv6s.com(config-if)#
ipv6 address 1003::2/64
router3.ipv6s.com(config-if)#
ipv6 ospf 100 area 0
router3.ipv6s.com(config-if)#
*Sep 5 11:59:39.431: %OSPFv3-5-ADJCHG: Process 100, Nbr 1.1.1.1 on Tunnel0 from LOADING to FULL, Loading Done
router3.ipv6s.com(config-if)#
exit
router3.ipv6s.com(config)#
exit
router3.ipv6s.com#
查看各设备OSPF与OSPFv3邻居、IPv6路由表
所有设备之间的IPv4、IPv6路由协议已按照组网图配置完毕,我们可以在router1.ipv6s.com上查看OSPF、OSPFv3的邻居
并查看IPv6路由表,隧道接口的IPv6地址信息。
并ping router3.ipv6s.com上面的loopback接口ipv6地址,均能正常通讯
router1.ipv6s.com#
*Sep 5 12:00:36.607: %OSPFv3-5-ADJCHG: Process 100, Nbr 3.3.3.3 on Tunnel0 from LOADING to FULL, Loading Done
router1.ipv6s.com#
router1.ipv6s.com#
show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:36 1.2.0.2 GigabitEthernet0/0
router1.ipv6s.com#
show ipv6 ospf neighborNeighbor ID Pri State Dead Time Interface ID Interface
3.3.3.3 0 FULL/ – 00:00:33 7 Tunnel0
router1.ipv6s.com#
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
LC 1::1/128 [0/0]
via Loopback1, receive
O 3::3/128 [110/1000]
via FE80::203:2, Tunnel0
C 1003::/64 [0/0]
via Tunnel0, directly connected
L 1003::1/128 [0/0]
via Tunnel0, receive
L FF00::/8 [0/0]
via Null0, receive
router1.ipv6s.com#
router1.ipv6s.com#
show ipv6 interface tunnel 0
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.ipv6s.com#
router1.ipv6s.com#
show interfaces tunnel 0
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.ipv6s.com#
router1.ipv6s.com#
traceroute ipv6 3::3Type escape sequence to abort.
Tracing the route to 3::31 1003::2 148 msec 144 msec 188 msec
router1.ipv6s.com#
router1.ipv6s.com#
ping ipv6 1003::2Type 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.ipv6s.com#
ping ipv6 3::3Type 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.ipv6s.com#
router1.ipv6s.com#
查看router2.ipv6s.com上面的OSPF邻居:
router2.ipv6s.com#
show ip ospf neighborNeighbor 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.ipv6s.com#
查看router3.ipv6s.com上面的的OSPF、OSPFv3、IPv6路由表、Tunnel接口IPv6地址信息:
router3.ipv6s.com#
show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:30 2.3.0.1 GigabitEthernet0/0
router3.ipv6s.com#
show ipv6 ospf neighborNeighbor ID Pri State Dead Time Interface ID Interface
1.1.1.1 0 FULL/ – 00:00:30 7 Tunnel0
router3.ipv6s.com#
router3.ipv6s.com#
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 [110/1000]
via FE80::102:1, Tunnel0
LC 3::3/128 [0/0]
via Loopback1, receive
C 1003::/64 [0/0]
via Tunnel0, directly connected
L 1003::2/128 [0/0]
via Tunnel0, receive
L FF00::/8 [0/0]
via Null0, receive
router3.ipv6s.com#
ping ipv6 1::1Type 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.ipv6s.com#
show ipv6 interface tunnel 0
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.ipv6s.com#
router3.ipv6s.com#
show interfaces tunnel 0
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.ipv6s.com#
原创文章,作者:中国IPv6网,如若转载,请注明出处:https://www.ipv6s.com/basis/tunnel/20100905518.html