Chinaunix首页 | 论坛 | 博客
  • 博客访问: 751051
  • 博文数量: 256
  • 博客积分: 3502
  • 博客等级: 中校
  • 技术积分: 3988
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-17 21:13
文章分类

全部博文(256)

文章存档

2014年(11)

2013年(134)

2012年(111)

我的朋友

分类: 系统运维

2013-02-21 13:16:53

中获得ip 的几种方式:
1. 手动,命令:ipv6 address xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/nn
2. stateless autoconfiguration,过程如下:(假设r1已经在与host1互联的接口上配置好了一个global unicast address)
 a. host1通过r1的RA发现这条链路上的prefix
 b. host1生成一个interface id,并添加在prefix的后面
 c. host1通过DAD判断这个是否唯一,如果唯一则使用次。
 cisco的路由器可以通过关闭RA来禁止stateless autoconfiguration,命令:ipv6 nd suppress-ra,默认这个命令是关闭的。
 由于有了stateless autoconfiguration,那么一个企业更换sp的时候就不需要手动在每台pc上更换地址,而只要将路由器上每个接口的prefix改掉就可以 了。并且cisco还提供了一个接口级的命令:ipv6 nd prefix at , 这样就可以设置在某一时间自动更改接口的prefix。(注,这个命令需要时间的准确性,可惜的是cisco的设备还不支持ipv6的ntp)
3. stateful dhcp,功能较强两种方式都更为强大。默认情况下,cisco路由器使用RA发送有关stateless autoconfiguration的信息,如果想只使用stateful dhcp,那么需要输入接口命令:ipv6 nd managed-config-flag(但不推见这样做)
4. dhcp-pd(dhcp prefix delegation),地址委派。在pe-ce的简单环境下,只需要在pe配置好ipv6的地址和ipv6 dhcp池,那么ce就可以直接通过dhcp获得接口地址,并且在其下联接口上仍然可以获得dhcp池中的地址。这样做也是为了方便用户更换sp。

* 但在实际的运营中,还是第一种最为可靠保险。

dhcp-pd和stateless autoconfiguration的配置


R1
hostname R1
!
ipv6 unicast-routing
!
interface Ethernet1/1
no ip address
duplex full
ipv6 address test ::C800:5AFF:FE3F:1D/64
ipv6 enable
!
interface Ethernet1/2
duplex full
ipv6 address autoconfig default
ipv6 enable
ipv6 dhcp client pd test

R2
hostname R2
!
ipv6 unicast-routing
ipv6 dhcp pool test
prefix-delegation pool test
!
interface Ethernet1/1
duplex full
ipv6 address 2001::C800:5AFF:FE40:1D/64
ipv6 enable
ipv6 dhcp server test
!
ipv6 local pool test 2001:1::/48 64

R1
R1#sho ipv6 interface e1/2
Ethernet1/2 is up, line protocol is up
 IPv6 is enabled, link-local address is FE80::C800:5AFF:FE3F:1E
 Global unicast address(es):
   2001::C800:5AFF:FE3F:1E, subnet is 2001::/64 [PRE]
     valid lifetime 2591870 preferred lifetime 604670
 Joined group address(es):
   FF02::1
   FF02::2
   FF02::1:FF3F:1E
 MTU is 1500 bytes
 ICMP error messages limited to one every 100 milliseconds
 ICMP redirects are enabled
 ND DAD is enabled, number of DAD attempts: 1
 ND reachable time is 30000 milliseconds
 ND advertised reachable time is 0 milliseconds
 ND advertised retransmit interval is 0 milliseconds
 ND router advertisements are sent every 200 seconds
 ND router advertisements live for 1800 seconds
 Hosts use stateless autoconfig for addresses.
R1#
R1#sho ipv6 dhcp interface e1/2
Ethernet1/2 is in client mode
 State is OPEN
 Renew will be sent in 3d08h
 List of known servers:
   Reachable via address: 2001::C800:5AFF:FE40:1D
   DUID: 00030001CA005A400000
   Preference: 0
   Configuration parameters:
     IA PD: IA ID 0x00060001, T1 302400, T2 483840
       Prefix: 2001:1::/64
               preferred lifetime 604800, valid lifetime 2592000
               expires at Nov 24 2006 08:23 PM (2580964 seconds)
 Prefix name: test
 Rapid-Commit: disabled
R1#
R1#sho ipv6 route
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
S   ::/0 [1/0]
    via FE80::C800:5AFF:FE40:1D, Ethernet1/2
C   2001::/64 [0/0]
    via ::, Ethernet1/2
L   2001::C800:5AFF:FE3F:1E/128 [0/0]
    via ::, Ethernet1/2
C   2001:1::/64 [0/0]
    via ::, Ethernet1/1
L   2001:1::C800:5AFF:FE3F:1D/128 [0/0]
    via ::, Ethernet1/1
L   FE80::/10 [0/0]
    via ::, Null0
L   FF00::/8 [0/0]
R1#
R1#sho ipv6 routers
Router FE80::C800:5AFF:FE40:1D on Ethernet1/2, last update 0 min
 Hops 64, Lifetime 1800 sec, AddrFlag=0, OtherFlag=0, MTU=1500
 HomeAgentFlag=0, Preference=Medium
 Reachable time 0 msec, Retransmit time 0 msec
 Prefix 2001::/64 onlink autoconfig
   Valid lifetime 2592000, preferred lifetime 604800
R1#
R1#sho ipv6 interface e1/1    
Ethernet1/1 is up, line protocol is up
 IPv6 is enabled, link-local address is FE80::C800:5AFF:FE3F:1D
 Global unicast address(es):
   2001:1::C800:5AFF:FE3F:1D, subnet is 2001:1::/64 [PRE]
     valid lifetime 2580857 preferred lifetime 593657
 Joined group address(es):
   FF02::1
   FF02::2
   FF02::1:FF3F:1D
 MTU is 1500 bytes
 ICMP error messages limited to one every 100 milliseconds
 ICMP redirects are enabled
 ND DAD is enabled, number of DAD attempts: 1
 ND reachable time is 30000 milliseconds
 ND advertised reachable time is 0 milliseconds
 ND advertised retransmit interval is 0 milliseconds
 ND router advertisements are sent every 200 seconds
 ND router advertisements live for 1800 seconds
 Hosts use stateless autoconfig for addresses.
R1#
R1#sho ipv6 general-prefix
IPv6 Prefix test, acquired via DHCP PD
 2001:1::/64 Valid lifetime 2580694, preferred lifetime 593494
  Ethernet1/1 (Address command)

R2
R2#sho ipv6 interface e1/1
Ethernet1/1 is up, line protocol is up
 IPv6 is enabled, link-local address is FE80::C800:5AFF:FE40:1D
 Global unicast address(es):
   2001::C800:5AFF:FE40:1D, subnet is 2001::/64
 Joined group address(es):
   FF02::1
   FF02::2
   FF02::1:2
   FF02::1:FF40:1D
 MTU is 1500 bytes
 ICMP error messages limited to one every 100 milliseconds
 ICMP redirects are enabled
 ND DAD is enabled, number of DAD attempts: 1
 ND reachable time is 30000 milliseconds
 ND advertised reachable time is 0 milliseconds
 ND advertised retransmit interval is 0 milliseconds
 ND router advertisements are sent every 200 seconds
 ND router advertisements live for 1800 seconds
 Hosts use stateless autoconfig for addresses.
R2#
R2#sho ipv6 dhcp pool
DHCPv6 pool: test
 Prefix pool: test
              preferred lifetime 604800, valid lifetime 2592000
 Active clients: 1
R2#
R2#sho ipv6 local pool
Pool                  Prefix                                       Free  In use
test                  2001:1::/48                                  65535      1
R2#
R2#sho ipv6 dhcp interface e1/1
Ethernet1/1 is in server mode
 Using pool: test
 Preference value: 0
 Hint from client: ignored
 Rapid-Commit: disabled
R2#
R2#sho ipv6 route
IPv6 Routing Table - 5 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
C   2001::/64 [0/0]
    via ::, Ethernet1/1
L   2001::C800:5AFF:FE40:1D/128 [0/0]
    via ::, Ethernet1/1
S   2001:1::/64 [1/0]
    via 2001::C800:5AFF:FE3F:1E, Ethernet1/1
L   FE80::/10 [0/0]
    via ::, Null0
L   FF00::/8 [0/0]
    via ::, Null0
R2#
R2#sho ipv6 routers
Router FE80::C800:5AFF:FE3F:1E on Ethernet1/1, last update 0 min
 Hops 64, Lifetime 1800 sec, AddrFlag=0, OtherFlag=0, MTU=1500
 HomeAgentFlag=0, Preference=Medium
 Reachable time 0 msec, Retransmit time 0 msec
阅读(2216) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~