IPv6(RIP、OSPF、EIGRP、DHCP、双栈、隧道)

本篇博客介绍了Ipv6 的各种基本配置,也是本学期本门课的一个总结,使用Cisco Packet Tracer7.0 和GNS3 0.8 模拟器进行的以下实验 ,路由器选型为cisco 2911,Gns3中是c2691。

实验一 IPv6 IP地址配置方法(2911)

设备 接口 IP地址
 Router0   g0/0     2001:0db8:cafe:A001::2/64  
 g0/1   2001:0db8:cafe:A002::2/64
 g0/2   2001:0db8:cafe:0002::1/64
 Router1  g0/0   2001:0db8:cafe:A001::1/64
   g0/1   2001:0db8:cafe:A003::1/64
   g0/2   2001:0db8:cafe:0001::1/64
 Router2  g0/0   2001:0db8:cafe:A003::2/64
   g0/1   2001:0db8:cafe:A002::1/64
   g0/2   2001:0db8:feed:0001::1/64
 Router3  g0/0   2001:0db8:feed:0001::2/64
   g0/1   2001:0db8:face:c0de::1/64
 PC 0     2001:0db8:cafe:0001::2/64
 PC 1     2001:0db8:face:c0de::2/64
 PC2     2001:0db8:cafe:0002::2/64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Route1
Router>enable
Router#config terminal
Router(config)#ipv6 unicast-routing // 开启 IPV6流量转发
Router(config)#int g0/0
Router(config)#no shutdown
Router(config-if)#ipv6 add 2001:0db8:cafe:A001::1/64 //前64位为网络地址;后64位为主机位
Router#show ipv6 interface brief

使用EUI-64格式配置静态地址:
Router(config)#int g0/1
Router(config)#no shutdown
Router(config-if)#ipv6 address 2001:0db8:cafe:A003::1/64 eu
Router(config-if)#ipv6 address 2001:0db8:cafe:A003::1/64 eui-64

仅启用接口IPv6功能
Router#conf t
Router(config)#int g0/2
Router(config)#no shutdown
Router(config-if)#ipv
Router(config-if)#ipv6 enable //会自动分配Ipv6地址


配置无编号地址
Router(config)#interface f0/3/0
Router(config)#no shutdown
Router(config-if)#ipv6 unnumbered g0/0 // 结果显示为接口f0/3/0借用g0/0的地址

实验二 静态路由配置

1. 直连静态路由

1
2
r1(config)#ipv6 route 2022:2:2:22::/64 e1/1
到达目标网络2022:2:2:22::/64 的数据包从接口e1/1发出去

2.递归静态路由

1
2
r1(config)#ipv6 route 2022:2:2:22::/64 2012:1:1:11::2 
到达目标网络2022:2:2:22::/64 的数据包发给下一跳地址2012:1:1:11::2

3.完全静态路由

1
2
r1(config)#ipv6 route 2022:2:2:22::/64 f0/0 2012:1:1:11::2  
到达目标网络2022:2:2:22::/64 的数据包从接口F0/0发出去,并且交给下一跳地址2012:1:1:11::2
1
2
3
4
5
6
7
8
9
10
11
配置递归路由(pc0 ping  pc1)
pc0至pc1
Router1(config)#ipv6 unicast-routing
Router1(config)#ipv6 route 2001:0db8:face:c0de::/64(pc1网段) 2001:0db8:cafe:A003::2(Route2g0/0)
Router2(config)#ipv6 unicast-routing
Router2(config)#ipv6 route 2001:0db8:face:c0de::/64(pc1网段) 2001:0db8:feed:0001::2(Route3g0/0)
pc1 至PC0
Router3(config)#ipv6 unicast-routing
Router3(config)#ipv6 route 2001:0db8:cafe:1::/64(pc0网段) 2001:0db8:feed:0001::1(Route2g0/2)
Router3(config)#ipv6 unicast-routing
Router(config)#ipv6 route 2001:0db8:cafe:1::/64(pc0网段) 2001:0db8:cafe:A003::1(Route1g0/1)**

PC0 ping PC1

实验三 IPv6 RIP (RIPng)基础实验

以Route2为例

1
2
3
4
5
6
7
8
9
10
11
12
13
Router2>en
Router2#conf t
Router1(config)#ipv6 unicast-routing // 开启IPv6路由转发
Router2(config)#ipv6 router rip test //启动IPv6 RIPng进程,RIP进程名字为test
Router2(config-rtr)#int g0/0
Router2(config-if)#no shutdown
Router2(config-if)#ipv6 rip test enable
Router2(config-if)#int g0/1
Router2(config-if)#no shutdown
Router2(config-if)#ipv6 rip test enable
Router2(config-if)#int g0/2
Router2(config-if)#no shutdown
Router2(config-if)#ipv rip test enable

所有路由器的所有接口都要进行配置!

下面查看Route2的RIP数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Router2#show ipv6 rip database  //查看IPv6数据库
RIP process "test" local RIB
2001:DB8:CAFE:1::/64, metric 2, installed // 路由条目装入路由表
GigabitEthernet0/0/FE80::2E0:F7FF:FE48:CB02, expires in 151 sec
2001:DB8:CAFE:2::/64, metric 2, installed
GigabitEthernet0/1/FE80::2E0:8FFF:FE67:C502, expires in 161 sec
2001:DB8:CAFE:A001::/64, metric 2, installed
GigabitEthernet0/0/FE80::2E0:F7FF:FE48:CB02, expires in 151 sec
2001:DB8:CAFE:A001::/64, metric 2, installed
GigabitEthernet0/0/FE80::2E0:F7FF:FE48:CB02, expires in 151 sec2, installed
GigabitEthernet0/1/FE80::2E0:8FFF:FE67:C502, expires in 161 sec
2001:DB8:CAFE:A002::/64, metric 2
GigabitEthernet0/1/FE80::2E0:8FFF:FE67:C502, expires in 161 sec
2001:DB8:CAFE:A003::/64, metric 2
GigabitEthernet0/0/FE80::2E0:F7FF:FE48:CB02, expires in 151 sec
2001:DB8:FACE:C0DE::/64, metric 2, installed
GigabitEthernet0/2/FE80::2D0:BAFF:FE71:9201, expires in 166 sec
2001:DB8:FEED:1::/64, metric 2
GigabitEthernet0/2/FE80::2D0:BAFF:FE71:9201, expires in 166 sec
Router2#

在Pc0上进行检测

实验四 OSPFv3基础实验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
以Route1为例
Router1>en
Router1#conf t
Router1(config)#ipv6 unicast-routing // 开启Ipv6路由转发
Router1(config)#ipv6 router ospf 2 // 启动OSPFv3进程
%OSPFv3-4-NORTRID: OSPFv3 process 2 could not pick a router-id,please configure manually //要求手工指定router-id
Router1(config-rtr)#router-id 1.1.1.1 //给OSPF路由器指定身份,每个路由器的route-id都是唯一的
Router1(config-rtr)#int g0/0
Router1(config-if)#no shutdown
Router1(config-if)#ipv6 ospf 2 area 0
Router1(config-if)#int g0/1
Router1(config-if)#no shutdown
Router1(config-if)#ipv6 ospf 2 area 0
Router1(config-if)#int g0/2
Router1(config-if)#no shutdown
Router1(config-if)#ipv6 ospf 2 area 0
在Route 0 路由器
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#ipv6 router ospf 2
%OSPFv3-4-NORTRID: OSPFv3 process 2 could not pick a router-id,please configure manually
Router(config-rtr)#router-id 4.4.4.4
Router(config-rtr)#int g0/0
Router(config-if)#no shutdown
Router(config-if)#ipv6 ospf 2 area 0
Router(config-if)#int g0/1
Router(config-if)#no shutdown
Router(config-if)#ipv6 ospf 2 area 0
Router(config-if)#int g0/2
Router(config-if)#no shutdown
Router(config-if)#ipv6 ospf 2 area 0

Route2,Route3同理

实验五 IPv6 EIGRP实验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
R1  // R2 同理,此处不再进行配置演示
R1#conf t // R1初始配置
R1(config)#ipv6 unicast-routing
R1(config)#int g0/0
R1(config-if)#no shutdown
R1(config-if)#ipv6 add 2012:1:1:11::1/64
R1(config-if)#exit
R1(config)#int loopback 1
R1(config-if)#no shutdown
R1(config-if)#ipv6 add 3001:1:1:11::1/64
R1(config-if)#exit
R1(config)#int loopback 2
R1(config-if)#no shutdown
R1(config-if)#ipv6 add 3002:1:1:11::1/64
R1(config-if)#exit
R1(config)#int loopback 3
R1(config-if)#no sh
R1(config-if)#ipv6 add 3003:1:1:11::1/64
R1#show ipv6 interface bri
FastEthernet0/0 [up/up]
FE80::C204:8FF:FEB8:0
2012:1:1:11::1
FastEthernet0/1 [administratively down/down]
unassigned
Loopback1 [up/up]
FE80::C204:8FF:FEB8:0
3001:1:1:11::1
Loopback2 [up/up]
FE80::C204:8FF:FEB8:0
3002:1:1:11::1
Loopback3 [up/up]
FE80::C204:8FF:FEB8:0
3003:1:1:11::1
R1(config)#ipv6 router eigrp 10 // 在R1上启动EIGRP v6进程
R1(config-rtr)#no shutdown //EIGRP v6进程默认是shutdown的,必须手工开启
R1(config-rtr)#eigrp router-id 1.1.1.1
R1(config)#int g0/0 //将 R1上的接口放进EIGRP v6进程
R1(config-if)#ipv6 eigrp 10
R1(config-if)#exit
R1(config)#int loopback 1
R1(config-if)#ipv6 eigrp 10

重分布IPv6网段

将R1上的剩余网段重分布进EIGRP v6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
r1(config)#route-map con permit 10  //在R1上配置重分布剩余网段进EIGRP v6
r1(config-route-map)#match interface loopback 2
r1(config-route-map)#exit
r1(config)#route-map con permit 20
r1(config-route-map)#match interface loopback 3
r1(config)#ipv6 router eigrp 10
r1(config-rtr)#redistribute connected route-map con
r1(config-rtr)#exit
在R2上查看重分布进EIGRP v6的剩余网段
r2#sh ipv6 route eigrp
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
D - EIGRP, EX - EIGRP external
D 3001:1:1:11::/64 [90/409600]
via FE80::C200:9FF:FE54:0, FastEthernet0/0
EX 3002:1:1:11::/64 [170/409600]
via FE80::C200:9FF:FE54:0, FastEthernet0/0
EX 3003:1:1:11::/64 [170/409600]
via FE80::C200:9FF:FE54:0, FastEthernet0/0
r2#

过滤IPv6路由

在R2上过滤掉IPv6路由,只留想要的网段,使用distribute-list过滤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
r2(config)#ipv6 prefix-list abc permit 3002:1:1:11::/64  //配置只留3002:1:1:11::/64网段
r2(config)#ipv6 router eigrp 10
r2(config-rtr)#distribute-list prefix-list abc in f0/0
r2#sh ipv6 route eigrp
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
D - EIGRP, EX - EIGRP external
EX 3002:1:1:11::/64 [170/409600]
via FE80::C200:9FF:FE54:0, FastEthernet0/0
r2#

实验七 IPv6地址SLAAC与有状态自动配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
1.配置无状态自动获得IP地址(SLAAC)

R1
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#int g0/0
Router(config-if)#ipv6 address 2023::2/64
Router(config-if)#no shutdown

R2
Router>en
Router#conf t
Router(config)#int g0/0
Router(config-if)#ipv6 address autoconfig
Router(config-if)#no sh
Router#show ipv6 int g0/0
GigabitEthernet0/0 is up, line protocol is up
IPv6 is enabled, link-local address is FE80::230:F2FF:FEC9:1D01
No Virtual link-local address(es):
Global unicast address(es):
2023::230:F2FF:FEC9:1D01, subnet is 2023::/64
Joined group address(es):
FF02::1
FF02::1:FFC9:1D01
MTU is 1500 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
Router#

2.调整ND
Router1:
interface g0/0
ipv6 address 2023::2/64
no shutdown
ipv6 nd ra-interval 5 //每5s通告一次RA
ipv6 nd ra-lifetime 1000 //RA的lifetime
ipv6 nd prefix 2023::/64 5000 4000 //修改valid time和preferred time

3.不希望SLAAC
抑制RA消息:
ipv6 nd ra suppress //对IOS版本有要求

实验八.DHCPv6分配

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
1.无状态自动配置
注:此时地址是EUI/64获取的,而其他信息是由DHCP获取的
Router1:
Ipv6 unicast-routing
ipv6 dhcp pool cafe-1
dns-server 2022::2
domain-name www.heuet.edu.cn
interface G0/0
ipv6 address 2023::2/64
ipv6 dhcp server café-1
ipv6 nd other-config-flag //O置位

Router2:
interface g0/0
ipv6 address autoconfig

2.有状态自动配置
Router1:
Ipv6 unicast-route
ipv6 dhcp pool cafe-1
dns-server 2022::2
domain-name www.heuet.edu.cn
address prefix 2023:2323::/64
interface g0/0
ipv6 address 2023::2/64
ipv6 dhcp server cafe-1
ipv6 nd other-config-flag
ipv6 nd managed-config-flag //M置位

Router2:
interface g0/0
ipv6 enable //让接口获得link-local地址作为DHCP源来发送DHCP报文
ipv6 address dhcp

查看:
Router1#sh ipv6 dhcp pool
DHCPv6 pool: cafe-1
DNS server: 2022::2
Domain name: www.heuet.edu.cn
Active clients: 1 //一个client

实验九 DHCPv6前缀代表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
DHCP  SERVER

Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#ipv6 dhcp pool dhcpv6 //定义DHCP服务的名字
Router(config-dhcpv6)#prefix-delegation pool dhcpv6-pool lifetime 1800 600 //创建DHCPV6-pool的前缀代
//表地址池,并定义有效期
Router(config-dhcpv6)#dns-server 2001:db8:3000:3000::42
Router(config-dhcpv6)#domain-name www.heuet.edu.cn
Router(config-dhcpv6)#exit l
Router(config)#int g0/0
Router(config-if)#ipv6 dhcp server dhcpv6 //在接口上启动DHCP服务对象
Router(config-if)#exit
Router(config)#ipv6 local pool dhcpv6-pool 2001:db8:1200::/40 48 //定义一个前缀长度为40的本地前缀代表
//地址池,并且定义分配给DHCPv6-PD Client的前缀长度是48位
Router(config)#int g0/0
Router(config-if)#ipv6 add 2010:AB8::1/64
Router(config-if)#ipv6 enable
Router(config-if)#no shutdown
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
DHCP Client

Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#int g0/0
Router(config-if)#no sh
Router(config-if)#ipv6 add autoconfig //无状态自动配置IPv6地址
Router(config-if)#ipv6 enable
Router(config-if)#ipv6 dhcp client pd prefix-from-pr //在接口上启用PD,将PD命名为prefix-from-pr
Router(config-if)#
Router(config-if)#int g0/1
Router(config-if)#no sh
Router(config-if)#ipv6 address prefix-from-pr ::1:0:0:0:1/64 配置接口从名字prefix-from-pr那里取得前缀,
然后附加上1:0:0:0:1,最后形成接口的地址是2001:DB8:1200:1::1/64
Router(config-if)#int g0/2
Router(config-if)#no sh
Router(config-if)#ipv6 address prefix-from-pr ::1/64 //接口地址为2001:DB8:1200:::1/64
Router(config-if)#
1
2
3
4
5
6
7
8
9
Client1
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#
Router(config)#int g0/0
Router(config-if)#no sh
Router(config-if)#ipv6 address autoconfig //启用无状态自动获得IP地址
Router#show ipv6 interface brief
1
2
3
4
5
6
7
8
Client2
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#int g0/0
Router(config-if)#no sh
Router(config-if)#ipv6 add autoconfig //启用无状态自动获得IP地址
Router#show ipv6 inter bri

实验十 IPv6、IPv4双栈实验

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
R0
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#ipv6 router ospf 1
Router(config-rtr)#router-id 10.1.1.1
Router(config-rtr)#int g0/0
Router(config-if)#no sh
Router(config-if)#ip add 10.10.10.1 255.255.255.252
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#
Router(config-if)#ipv6 add 2001:DB8:CAFE:A001::1/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#exit
Router(config)#int g0/1
Router(config-if)#no sh
Router(config-if)#ip add 10.10.10.9 255.255.255.252
Router(config-if)#duplex auto
Router(config-if)#speed au
Router(config-if)#ipv6 address 2001:DB8:CAFE:A003::1/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#exit
Router(config)#int g0/2
Router(config-if)#no sh
Router(config-if)#ip add 10.1.0.1 255.255.0.0
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#ipv6 add 2001:DB8:CAFE::1/64
Router(config-if)#ipv6 address 2001:DB8:CAFE:1::1/64
Router(config-if)#ipv
Router(config-if)#ipv6 os
Router(config-if)#ipv6 ospf 1 ar
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#router ospf 2
Router(config-router)#log-adjacency-changes
Router(config-router)#network 10.1.0.0 0.0.255.255 area 0
Router(config-router)#network 10.10.10.0 0.0.0.3 area 0
Router(config-router)#network 10.10.10.8 0.0.0.3 area 0
Router(config-router)#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
R1
Router>en
Router#conf t
Router(config)#ipv unicast-routing
Router(config)#ipv6 router ospf 1
Router(config-rtr)#router-id 10.3.3.3
Router(config-rtr)#log-adjacency-changes
Router(config-rtr)#int g0/0
Router(config-if)#no sh
Router(config-if)#ip address 10.10.10.6 255.255.255.252
Router(config-if)#duplex au
Router(config-if)#speed au
Router(config-if)#ipv6 address 2001:DB8:CAFE:A002::2/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#int g0/1
Router(config-if)#no sh
Router(config-if)#ip address 10.10.10.10 255.255.255.252
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#ipv6 address 2001:DB8:CAFE:A003::2/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#int g0/2
Router(config-if)#no sh
Router(config-if)#ip address 10.3.0.1 255.255.0.0
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#ipv6 address 2001:DB8:CAFE:3::1/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#router ospf 2
Router(config-router)#log-adjacency-changes
Router(config-router)#network 10.10.10.8 0.0.0.3 area 0
Router(config-router)#network 10.10.10.4 0.0.0.3 area 0
Router(config-router)#network 10.3.0.0 0.0.255.255 area 0
Router(config-router)#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
R2
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#ipv6 router ospf 1
Router(config-rtr)#router-id 10.2.2.2
Router(config-rtr)#int g0/0
Router(config-if)#no sh
Router(config-if)#ip address 10.10.10.2 255.255.255.252
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#ipv6 address 2001:DB8:CAFE:A001::2/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#interface g0/1
Router(config-if)#no sh
Router(config-if)#ip address 10.10.10.5 255.255.255.252
Router(config-if)#duplex auto
Router(config-if)#speed auto
Router(config-if)#ipv6 address 2001:DB8:CAFE:A002::1/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#int g0/2
Router(config-if)#no sh
Router(config-if)#ip address 10.2.0.1 255.255.0.0
Router(config-if)#duplex au
Router(config-if)#speed auto
Router(config-if)#ipv6 address 2001:DB8:CAFE:2::1/64
Router(config-if)#ipv6 ospf 1 area 0
Router(config-if)#router ospf 2
Router(config-router)#log-adjacency-changes
Router(config-router)#network 10.10.10.0 0.0.0.3 area 0
Router(config-router)#network 10.10.10.4 0.0.0.3 area 0
Router(config-router)#network 10.2.0.0 0.0.255.255 area 0

实验十一 手工隧道

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
R0
Router>en
Router#conf t
Router(config)#ipv6 UNicast-routing
Router(config)#int g0/0
Router(config-if)#no sh
Router(config-if)#ipv6 address 2001:DB8:CAFE:1::1/64
Router(config-if)#int g0/1
Router(config-if)#no sh
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#int t0
Router(config-if)#ipv6 address 2001:DB8:CAFF:1::1/64
Router(config-if)#ipv6 en
Router(config-if)#tunnel source g0/1
Router(config-if)#tunnel destination 192.168.1.2
Router(config-if)#tunnel mode ipv6ip
Router(config-if)#ipv6 route 2001:DB8:ACE:2::/64 2001:DB8:CAFF:1::2
Router(config)#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
R1
Router>en
Router#conf t
Router(config)#ipv6 unicast-routing
Router(config)#int g0/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#no sh
Router(config-if)#int g0/1
Router(config-if)#ipv6 address 2001:DB8:ACE:2::1/64
Router(config-if)#no sh
Router(config-if)#int t0
Router(config-if)#ipv6 address 2001:DB8:CAFF:1::2/64
Router(config-if)#ipv6 en
Router(config-if)#tunnel source g0/0
Router(config-if)#tunnel destination 192.168.1.1
Router(config-if)#tunnel mode ipv6ip
Router(config-if)#i

实验十二 6to4隧道的配置

需要特别说明的是由于6to4隧道原理的特殊性,隧道端口的IPv4地址与IPv6网络的Ipv6地址有关联,所以分配IPv6网络的IP地址应该注意符合6to4隧道的编码要求。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
R1
R1#conf t
R1(config)#ipv6 unicast-routing //启用路由器的Ipv6转发功能
R1(config)#int loopback 0
R1(config-if)#ipv add 2002:0a01:0101:1::1/64
R1(config-if)#int f0/1
R1(config-if)#no sh
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config)#router ospf 1 //配置IPv4网络的动态路由协议OSPF
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
R1(config)#int t0 创建隧道,并配置隧道的IPv6地址及隧道模式
R1(config-if)#no sh
R1(config-if)#ipv en
R1(config-if)#ipv6 address 2002:A01:101::1/64
R1(config-if)#tunnel source f0/1
R1(config-if)#tunnel mode ipv6ip 6to4
R1(config)#ipv6 route 2002::/16 Tunnel0 //配置IPv6路由

R2
R2#conf t
R2(config)#ipv6 unicast-routing //启用路由器的Ipv6转发功能
R2(config)#int loopback 0
R2(config-if)#ipv6 add 2002:0a03:0303:1::1/64
R2(config-if)#int f0/1
R2(config-if)#ip add 10.3.3.3 255.255.255.0
R2(config-if)#no sh
R2(config)#router ospf 1 //配置IPv4网络的动态路由协议OSPF
R2(config-router)#network 10.3.3.0 0.0.0.255 area 0
R2(config)#int t0 创建隧道,并配置隧道的IPv6地址及隧道模式
R2(config-if)#no sh
R2(config-if)#ipv en
R2(config-if)#ipv6 address 2002:A03:303::1/64
R2(config-if)# tunnel source f0/1
R2(config-if)# tunnel mode ipv6ip 6to4
R2(config)#ipv6 route 2002::/16 Tunnel0 //配置IPv6路由

R3
R3#conf t
R3(config)#ipv6 unicast-routing //启用路由器的Ipv6转发功能
R3(config)#int loopback 0
R3(config-if)#ipv add 2002:0a02:0202:1::1/64
R3(config-if)#int f0/1
R3(config-if)#no sh
R3(config-if)#ip add 10.2.2.2 255.255.255.0
R3(config)#router ospf 1 //配置IPv4网络的动态路由协议OSPF
R3(config-router)#network 10.2.2.0 0.0.0.255 area 0
R3(config)#int t0 创建隧道,并配置隧道的IPv6地址及隧道模式
R3(config-if)#no sh
R3(config-if)#ipv6 address 2002:A02:202::1/64
R3(config-if)#ipv en
R3(config-if)# tunnel source f0/1
R3(config-if)# tunnel mode ipv6ip 6to4
R3(config)#ipv6 route 2002::/16 Tunnel0 //配置IPv6路由

R4
R4#conf t
R4(config)#ipv un //启用路由器的Ipv6转发功能
R4(config)#int f0/0
R4(config-if)#no sh
R4(config-if)#ip add 10.1.1.10 255.255.255.0
R4(config-if)#int f0/1
R4(config-if)#ip add 10.3.3.10 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int f1/0
R4(config-if)#no sh
R4(config-if)#ip add 10.2.2.10 255.255.255.0
R4(config)#router ospf 1 //配置IPv4网络的动态路由协议OSPF
R4(config-router)#network 10.1.1.0 0.0.0.255 area 0
R4(config-router)#network 10.2.2.0 0.0.0.255 area 0
R4(config-router)#network 10.3.3.0 0.0.0.255 area 0

实验十三 ISATAP隧道

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
R1
R1#CONF T
R1(config)#int loopback 0
R1(config-if)#ipv add 2002:303:301::1/64
R1(config-if)#int f0/0
R1(config-if)#no sh
R1(config-if)#ip add 3.3.30.1 255.255.255.0
R1(config-if)#exit
R1(config)#ip route 2.2.20.0 255.255.255.0 3.3.30.2
R1(config)#int t0
R1(config-if)#no sh
R1(config-if)#ipv en
R1(config-if)#tunnel source f0/0
R1(config-if)# tunnel mode ipv6ip isatap
R1(config-if)#exi
R1(config)#ipv unicast-routing
R1(config)#ipv6 router ospf 1
R1(config-rtr)#router-id 1.1.1.1
R1(config-rtr)#int t0 //创建ISATAP隧道,并配置隧道相关参数
R1(config-if)#ipv6 ospf network point-to-multipoint non-broadcast
R1(config-if)#ipv6 ospf neighbor FE80::5EFE:202:1401 //手工指定邻居使用本地链路地址
R1(config-if)#ipv6 ospf 1 area 0
R1(config-if)#exit
R1(config)#int lo 0
R1(config-if)#ipv6 ospf 1 area 0

R2
R2#conf t
R2(config)#int f0/0
R2(config-if)#no sh
R2(config-if)# ip address 3.3.30.2 255.255.255.0
R2(config-if)#int f0/1
R2(config-if)#no sh
R2(config-if)# ip address 2.2.20.2 255.255.255.0

R3
R3#conf t
R3(config)#ipv unicast-routing
R3(config)#int f0/0
R3(config-if)#no sh
R3(config-if)#ip add 2.2.20.1 255.255.255.0
R3(config-if)#int f0/1
R3(config-if)#no sh
R3(config-if)#ipv6 add 2002:202:201::1/64
R3(config-if)#exi
R3(config)#ip route 3.3.30.0 255.255.255.0 2.2.20.2
R3(config)#int t0
R3(config-if)#no sh
R3(config-if)#ipv en
R3(config-if)#tunnel source f0/0
R3(config-if)#tunnel mode ipv6ip isatap
R3(config-if)#exi
R3(config)#ipv6 router ospf 1
R3(config-rtr)# router-id 3.3.3.3
R3(config-rtr)#int t0 //创建ISATAP隧道,并配置隧道相关参数
R3(config-if)#ipv6 ospf network point-to-multipoint non-broadcast //为简化OSPF的运行,
//避免DR和BDR的选举,在隧道接口上把网络类型改为点到多点广播
R3(config-if)#ipv6 ospf neighbor FE80::5EFE:303:1E01 //手工指定邻居使用本地链路地址
R3(config-if)# ipv6 ospf 1 area 0
R3(config-if)#int f0/1
R3(config-if)#ipv6 ospf 1 area 0
R3(config-if)#

R4
R4#conf t
R4(config)#ipv un
R4(config)#int f0/0
R4(config-if)#no sh
R4(config-if)#ipv6 address 2002:202:201::2/64
R4(config-if)#exit
R4(config)#ipv6 router ospf 1
R4(config-rtr)#router-id 4.4.4.4
R4(config-rtr)#int f0/0
R4(config-if)#ipv6 ospf 1 area 0
R4(config-if)#

实验十四 ISATAP隧道(二)

C1 桥接本机网卡 ,路由器为C7200

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
R1
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip address 192.168.10.10 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exi
R1(config)#int s2/0
R1(config-if)#clock rate 64000
R1(config-if)#ip add 131.107.0.1 255.255.255.0
R1(config-if)#no sh



R2
R2#conf t
R2(config)#ipv un
R2(config)#int s2/0
R2(config-if)#ip address 131.107.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exi
R2(config)#int s2/1
R2(config-if)#clock rate 64000
R2(config-if)#ipv6 address 2001:2::1/64
R2(config-if)#no sh
R2(config-if)#exi
R2(config)#ip route 192.168.10.0 255.255.255.0 131.107.0.1
R2(config)#ipv6 route 2001:1::/64 2001:2::2
R2(config)#int t0
R2(config-if)#ipv6 address 2001:3::/64 eui-64
R2(config-if)#no ipv6 nd suppress-ra
R2(config-if)#tunnel source 131.107.0.2
R2(config-if)#tunnel mode ipv6ip isatap
R2(config-if)#no sh


R3
R3#conf t
R3(config)#ipv un
R3(config)#int s2/1
R3(config-if)#ipv6 address 2001:2::2/64
R3(config-if)#no sh
R3(config-if)#exi
R3(config)#int f0/0
R3(config-if)#ipv6 address 2001:1::1/64
R3(config-if)#no sh
R3(config-if)#exi
R3(config)#ipv6 route 2001:3::/64 2001:2::1

以管理员身份运行cmd。执行以下命令:

1
netsh interface ipv6 isatap set route 131.107.0.2

(Win10操作系统要先运行:netsh interface isatap set state enable命令)
执行以下命令查看结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
C:\WINDOWS\system32> ipconfig /all


无线局域网适配器 本地连接* 2:

媒体状态 . . . . . . . . . . . . : 媒体已断开连接
连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
物理地址. . . . . . . . . . . . . : BC-A8-A6-EB-A1-CD
DHCP 已启用 . . . . . . . . . . . : 是
自动配置已启用. . . . . . . . . . : 是

隧道适配器 isatap.{331437F1-5F3E-436E-8E71-36228471287E}:

连接特定的 DNS 后缀 . . . . . . . :
描述. . . . . . . . . . . . . . . : Microsoft ISATAP Adapter
物理地址. . . . . . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP 已启用 . . . . . . . . . . . : 否
自动配置已启用. . . . . . . . . . : 是
IPv6 地址 . . . . . . . . . . . . : 2001:3::5efe:192.168.10.20(首选)
本地链接 IPv6 地址. . . . . . . . : fe80::5efe:192.168.10.20%22(首选)
默认网关. . . . . . . . . . . . . : fe80::5efe:131.107.0.2%22
DNS 服务器 . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
TCPIP 上的 NetBIOS . . . . . . . : 已禁用

执行ping命令测试是否能够互通。

1
2
3
4
5
6
7
8
9
10
11
12
PS C:\WINDOWS\system32> ping 2001:1::1

正在 Ping 2001:1::1 具有 32 字节的数据:
来自 2001:1::1 的回复: 时间=74ms
来自 2001:1::1 的回复: 时间=81ms
来自 2001:1::1 的回复: 时间=99ms
来自 2001:1::1 的回复: 时间=61ms

2001:1::1 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 61ms,最长 = 99ms,平均 = 78ms

特别说明:1、如果你的操作系统是win10,请下载win10关于IPv6的补丁.
2、为了用ping命令测试是否互通,请暂时关闭计算机防火墙或者通过设置防火墙规则允许ping命令数据包通过。

------ end ------
0%