文章目录
一、IPv6静态路由
1,建议开启IPv6单播路由功能
R1(config)#ipv6 unicast-routing
2,在IPv4中,在点到点网络中,建议使用出接口写法,在MA网络中建议使用下一跳写法,或者出接口+下一跳写法
在IPv6中,在点到点网络中,建议使用出接口写法,在MA网络中不能使用出接口写法,只能使用下一跳或者出接口+下一跳的写法
在MA网络中使用出接口写法
R1(config)#ipv6 route 2::/64 f0/0
R1#sho ipv6 route static
S 2::/64 [1/0]
via FastEthernet0/0, directly connected
R1#ping 2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
在MA网络中使用下一跳写法
R1(config)#ipv6 route 2::/64 2001::2
R1#sho ipv6 route static
S 2::/64 [1/0]
via 2001::2
R1#ping 2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/16/20 ms
当然,出接口+下一跳写法也是可以的
R1(config)#ipv6 route 2::/64 f0/0 2001::2
R1#sho ipv6 rou static
S 2::/64 [1/0]
via 2001::2, FastEthernet0/0
R1#ping 2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/19/32 ms
3,不能使用本地链路地址作为下一跳地址,因为本地链路地址是由eui64产生,路由器所有接口的本地链路地址一样,使用本地链路地址需要加上出接口才可以
R1(config)#ipv6 route 2::/64 FE80::C802:3AFF:FE14:0
% Interface has to be specified for a link-local nexthop
R1(config)#ipv6 route 2::/64 f0/0 FE80::C802:3AFF:FE14:0
R1#sho ipv6 rout static
S 2::/64 [1/0]
via FE80::C802:3AFF:FE14:0, FastEthernet0/0
R1#ping 2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/19/28 ms
二、RIPNG
使用组播地址ff02::9
,使用UDP封装,端口为521
,组播地址和端口号可以更改
启用ripng要跟进程名,进入接口宣告
R1(config)#ipv6 router rip ccnp
R1(config-rtr)#int lo0
R1(config-if)#ipv6 rip ccnp enable
R1(config-if)#int f0/0
R1(config-if)#ipv6 rip ccnp enable
R2,R3同理
注意这里的到达R1或R3的环回metric值为2,在ipv4中为1,是因为在ipv6中R2到达R1路由器查表一次,而R1路由器本身到达自己的环回还要查表一次,故再+1,为2
R2#sho ipv6 route rip
R 1::/64 [120/2]
via FE80::C801:EFF:FE4C:0, FastEthernet0/0
R 3::/64 [120/2]
via FE80::C803:11FF:FED0:0, Serial1/0
查看ipv6是rip协议
R2#sho ipv6 rip
RIP process "ccnp", port 521, multicast-group FF02::9, pid 261
Administrative distance is 120. Maximum paths is 16 //最大支持负载均衡
Updates every 30 seconds, expire after 180 //30s周期更新,180s无效计时器
Holddown lasts 0 seconds, garbage collect after 120 //抑制计时器0s,垃圾计时器120s
Split horizon is on; poison reverse is off //水平分割默认开启,毒性逆转默认关闭
Default routes are not generated
Periodic updates 15, trigger updates 3 //周期更新了15次,触发更新了3次
Interfaces:
Serial1/0
FastEthernet0/0
Loopback0
Redistribution:
None
注意:抑制计时器0s表示开启了触发更新,垃圾计时器120s,这里指的是无效计时器之后再过120s,就会删除路由,在rip v2中,刷新计时器为240s,是总时间,实际上是无效计时器之后60s就会删除路由,即rip ng中这个时间增加了一倍
三、OSPFv3
配置
R1(config)#ipv6 router ospf 100
R1(config-rtr)#router-id 91.1.1.1
R1(config-rtr)#int f0/0
R1(config-if)#ipv6 ospf 100 area 0
R1(config-if)#int lo0
R1(config-if)#ipv6 ospf 100 area 0
查看邻居表,这里不在显示邻居接口的IP地址,而是接口ID
R2#sho ipv6 ospf neighbor
Neighbor ID Pri State Dead Time Interface ID Interface
93.3.3.3 1 FULL/ - 00:00:38 6 Serial1/0
91.1.1.1 1 FULL/BDR 00:00:36 4 FastEthernet0/0
查看链路状态数据库,和ipv4的ospf相比,多了8类和9类LSA
R2#sho ipv6 ospf database
OSPFv3 Router with ID (92.2.2.2) (Process ID 100)
Router Link States (Area 0)
ADV Router Age Seq# Fragment ID Link count Bits
91.1.1.1 310 0x80000005 0 1 None
92.2.2.2 305 0x80000006 0 2 None
93.3.3.3 328 0x80000002 0 1 None
Net Link States (Area 0)
ADV Router Age Seq# Link ID Rtr count
92.2.2.2 316 0x80000001 4 2
Link (Type-8) Link States (Area 0)
ADV Router Age Seq# Link ID Interface
92.2.2.2 350 0x80000001 5 Se1/0
93.3.3.3 334 0x80000001 6 Se1/0
91.1.1.1 380 0x80000001 4 Fa0/0
92.2.2.2 356 0x80000001 4 Fa0/0
Intra Area Prefix Link States (Area 0)
ADV Router Age Seq# Link ID Ref-lstype Ref-LSID
91.1.1.1 317 0x80000003 0 0x2001 0
92.2.2.2 317 0x80000003 0 0x2001 0
92.2.2.2 317 0x80000001 4096 0x2002 4
93.3.3.3 330 0x80000002 0 0x2001 0
查看1类LSA,和ipv4的1类LSA相比,少了路由信息,即只有拓扑信息,
R2#sho ipv6 ospf database router self-originate
OSPFv3 Router with ID (92.2.2.2) (Process ID 100)
Router Link States (Area 0)
LS age: 1021
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Router Links
Link State ID: 0
Advertising Router: 92.2.2.2
LS Seq Number: 80000006
Checksum: 0x6CFD
Length: 56
Number of Links: 2
Link connected to: another Router (point-to-point)
Link Metric: 64
Local Interface ID: 5
Neighbor Interface ID: 6
Neighbor Router ID: 93.3.3.3
Link connected to: a Transit Network
Link Metric: 1
Local Interface ID: 4
Neighbor (DR) Interface ID: 4
Neighbor (DR) Router ID: 92.2.2.2
查看2类LSA,ipv4中的2类lsa还包含了MA网络中的网络掩码,而这里没有
R2#sho ipv6 ospf database network
OSPFv3 Router with ID (92.2.2.2) (Process ID 100)
Net Link States (Area 0)
LS age: 1261
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Network Links
Link State ID: 4 (Interface ID of Designated Router)
Advertising Router: 92.2.2.2
LS Seq Number: 80000001
Checksum: 0x30B1
Length: 32
Attached Router: 92.2.2.2
Attached Router: 91.1.1.1
查看8类LSA,描述了一个接口所在链路上的网络前缀、链路本地地址
R2#sho ipv6 ospf database link self-originate
OSPFv3 Router with ID (92.2.2.2) (Process ID 100)
Link (Type-8) Link States (Area 0)
LS age: 1607
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: Serial1/0)
Link State ID: 5 (Interface ID)
Advertising Router: 92.2.2.2
LS Seq Number: 80000001
Checksum: 0x584F
Length: 56
Router Priority: 1
Link Local Address: FE80::C802:3AFF:FE14:0
Number of Prefixes: 1
Prefix Address: 2002::
Prefix Length: 64, Options: None
LS age: 1612
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: FastEthernet0/0)
Link State ID: 4 (Interface ID)
Advertising Router: 92.2.2.2
LS Seq Number: 80000001
Checksum: 0x4267
Length: 56
Router Priority: 1
Link Local Address: FE80::C802:3AFF:FE14:0
Number of Prefixes: 1
Prefix Address: 2001::
Prefix Length: 64, Options: None
查看9类LSA,通告本路由器上的路由信息
R2#sho ipv6 ospf database prefix internal
OSPFv3 Router with ID (92.2.2.2) (Process ID 100)
Intra Area Prefix Link States (Area 0)
Routing Bit Set on this LSA
Now in min table
Table index: 34 min 26 sec
LS age: 1742
LS Type: Intra-Area-Prefix-LSA
Link State ID: 0
Advertising Router: 91.1.1.1
LS Seq Number: 80000003
Checksum: 0xD0EA
Length: 52
Referenced LSA Type: 2001
Referenced Link State ID: 0
Referenced Advertising Router: 91.1.1.1
Number of Prefixes: 1
Prefix Address: 1::1
Prefix Length: 128, Options: LA, Metric: 0
查看路由表,当接口网络类型为loopback时,metric为0
R1#sho ipv6 route ospf
O 2::2/128 [110/1]
via FE80::C802:3AFF:FE14:0, FastEthernet0/0
O 3::3/128 [110/65]
via FE80::C802:3AFF:FE14:0, FastEthernet0/0
O 2002::/64 [110/65]
via FE80::C802:3AFF:FE14:0, FastEthernet0/0
四、EIGRPv6
基本配置,必须指定router-id,必须开启协议,进入接口宣告
R2(config)#ipv6 router eigrp 100
R2(config-rtr)#eigrp router-id 2.2.2.2
R2(config-rtr)#no shu
R2(config-rtr)#int f0/0
R2(config-if)#ipv6 eigrp 100
R2(config-if)#int lo0
R2(config-if)#ipv6 eigrp 100
查看邻居表
R2#sho ipv6 eigrp neighbors
IPv6-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 Link-local address: Se1/0 14 00:01:59 24 200 0 5
FE80::C803:11FF:FED0:0
0 Link-local address: Fa0/0 11 00:02:31 20 200 0 3
FE80::C801:EFF:FE4C:0
查看拓扑表
R2#sho ipv6 eigrp topology
IPv6-EIGRP Topology Table for AS(100)/ID(2.2.2.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 1::/64, 1 successors, FD is 156160
via FE80::C801:EFF:FE4C:0 (156160/128256), FastEthernet0/0
P 2001::/64, 1 successors, FD is 28160
via Connected, FastEthernet0/0
P 2::/64, 1 successors, FD is 128256
via Connected, Loopback0
P 2002::/64, 1 successors, FD is 2169856
via Connected, Serial1/0
P 3::/64, 1 successors, FD is 2297856
via FE80::C803:11FF:FED0:0 (2297856/128256), Serial1/0
查看路由表
R2#sho ipv6 route eigrp
D 1::/64 [90/156160]
via FE80::C801:EFF:FE4C:0, FastEthernet0/0
D 3::/64 [90/2297856]
via FE80::C803:11FF:FED0:0, Serial1/0
五、MP-BGP
1,ipv6建立邻居传递ipv6路由
首先建立IPv6邻居
R1(config)#router bgp 1
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#neighbor 2001::2 remote-as 2
R2(config)#router bgp 2
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#neighbor 2001::1 remote-as 1
R1#sho ip bgp summary
BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001::2 4 2 8 9 0 0 0 never Idle
传递IPv6路由
R1(config)#router bgp 1
R1(config-router)#address-family ipv6 unicast
R1(config-router-af)#neighbor 2001::2 activate
R1(config-router-af)#network 1::/64
R2(config)#router bgp 2
R2(config-router)#address-family ipv6 unicast
R2(config-router-af)#neighbor 2001::1 activate
R2(config-router-af)#network 2::/64
R1#sho bgp ipv6 unicast
BGP table version is 9, 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
*> 1::/64 :: 0 32768 i
*> 2::/64 2001::2 0 0 2 i
R1#ping 2::2 source 1::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
Packet sent with a source address of 1::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/20/28 ms
2,ipv4建立邻居传递ipv6路由
R1(config)#router bgp 1
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#neighbor 12.1.1.2 remote-as 2
R1(config-router)#address-family ipv6 unicast
R1(config-router-af)#neighbor 12.1.1.2 activate
R1(config-router-af)#net 1::/64
R2(config)#router bgp 2
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#neighbor 12.1.1.1 remote-as 1
R2(config-router)#address-family ipv6 unicast
R2(config-router-af)#neighbor 12.1.1.1 activate
R2(config-router-af)#network 2::/64
发现路由不优,原因是下一跳地址不可达
R1#sho bgp ipv6 unicast
BGP table version is 2, 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
*> 1::/64 :: 0 32768 i
* 2::/64 ::FFFF:12.1.1.2 0 0 2 i
R1(config)#route-map next permit 10
R1(config-route-map)#set ipv6 next-hop 2001::2
R1(config-route-map)#exi
R1(config)#router bgp 1
R1(config-router)#address-family ipv6 unicast
R1(config-router-af)#neighbor 12.1.1.2 route-map next in
R1(config-router-af)#end
在R2上`R2#clear bgp ipv6 unicast * soft out `
R1#sho 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
*> 1::/64 :: 0 32768 i
*> 2::/64 2001::2 0 0 2 i
R2(config)#route-map next permit 10
R2(config-route-map)#set ipv6 next-hop 2001::1
R2(config-route-map)#exi
R2(config)#router bgp 2
R2(config-router)#address-family ipv6 unicast
R2(config-router-af)#neighbor 12.1.1.1 route-map next in
R2(config-router-af)#en
R1#clear bgp ipv6 unicast * soft out
R2#sho bgp ipv6 unicast
BGP table version is 6, local router ID is 2.2.2.2
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
*> 1::/64 2001::1 0 0 1 i
*> 2::/64 :: 0 32768 i
R1#ping 2::2 source 1::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
Packet sent with a source address of 1::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/18/24 ms
六、IPV6、IPV4共存
1,双栈
同时使用IPv6和IPv4协议
2,6 to 4 tunnel
将ipv6数据包封装在ipv4数据部分
R1有一个环回接口模拟IPv6用户,地址为1::1/64
R2为运营商,纯IPv4环境
R3有一个环回接口模拟IPv6用户,地址为3::3/64
R1(config)#int tunnel 1
R1(config-if)#tunnel source 12.1.1.1
R1(config-if)#tunnel destination 23.1.1.2
R1(config-if)#ipv6 address 2020::1/64
R1(config-if)#tunnel mode ipv6ip
R3(config)#int tunnel 1
R3(config-if)#tunnel source 23.1.1.2
R3(config-if)#tunnel destination 12.1.1.1
R3(config-if)#ipv6 address 2020::2/64
R3(config-if)#tunnel mode ipv6ip
R3#ping 2020::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2020::1, timeout is 2 seconds:
!!!!!
写路由IPv6走tunnel
R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router eigrp 100
R1(config-rtr)#eigrp router-id 1.1.1.1
R1(config-rtr)#no shu
R1(config-rtr)#int lo0
R1(config-if)#ipv6 eigrp 100
R1(config-if)#int tun 1
R1(config-if)#ipv6 eigrp 100
R3(config)#ipv6 unicast-routing
R3(config)#ipv6 router eigrp 100
R3(config-rtr)#eigrp router-id 2.2.2.2
R3(config-rtr)#no shu
R3(config-rtr)#int lo0
R3(config-if)#ipv6 eigrp 100
R3(config-if)#int tun 1
R3(config-if)#ipv6 eigrp 100
R1#sho ipv6 eigrp neighbors
IPv6-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 Link-local address: Tu1 10 00:00:32 48 5000 0 3
FE80::1701:102
R1#ping 3::3 source 1::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3::3, timeout is 2 seconds:
Packet sent with a source address of 1::1
!!!!!
3,自动tunnel
6 to 4 tunnel为点对点隧道,当多个节点需要互相通信时,配置麻烦
自动tunnel不需要给tunnel接口配置目标IP地址,但是需要内网的用户使用IPv6兼容性地址,由出口公网IPv4地址转化而来
这里12.1.1.1转化为IPv6兼容性地址网段为:2002:c01:101::/64
,同理23.1.1.2转化为IPv6兼容性地址网段为2002:1701:102::/64
0000 1100 0000 0001 0000 0001 0000 0001
0000 1100 0000 0001:0000 0001 0000 0001 即0c01:0101
所以给R1的lo0配置IP地址为 2002:c01:101:1::1/64
所以给R3的lo0配置IP地址为 2002:1701:102:3::3/64
R1(config)#int tunnel 0
R1(config-if)#tunnel source 12.1.1.1
R1(config-if)#tunnel mode ipv6ip 6to4
R1(config-if)#ipv6 address 2022::1/64
R1(config)#ipv6 route 2002::/16 tunnel 0
R3(config)#int tunnel 0
R3(config-if)#tunnel source 23.1.1.2
R3(config-if)#tunnel mode ipv6ip 6to4
R3(config-if)#ipv6 address 2022::2/64
R3(config)#ipv6 route 2002::/16 tunnel 0
当目标为由出口地址的公网IP转化而来的IPv6兼容地址时,走tunnel接口时,封装源IP为12.1.1.1,封装目的IP将自动从目的IPv6地址拿出来IPv4地址,为23.1.1.2;
R1#ping 2002:1701:102:3::3 source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2002:1701:102:3::3, timeout is 2 seconds:
Packet sent with a source address of 2002:C01:101:1::1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/34/52 ms