2013年9月7日 星期六

DHCPv6-PD


DHCPv6 Prefix Delegation (DHCPv6-PD)定義在RFC 3633,是DHCPv6的extension (option)。主要是用來和DHCPv6-PD server要求prefix給DHCPv6-PD client其他的interface。

Network layout如下:


Server端是Windows,使用dibber,設定檔如下(server.conf):
# Logging level range: 1(Emergency)-8(Debug)
log-level 8

# Don't log full date
log-mode short

iface "區域連線 35"
{

# clients should renew every half an hour
 T1 1800

# In case of troubles, after 45 minutes, ask any server
 T2 2700

# Addresses should be prefered for an hour
 prefered-lifetime 3600

# and should be valid for 2 hours
 valid-lifetime 7200
 
 class {
   pool 5000:1234::/48
 }

 # the following lines instruct server to grant each client
 # 1 or 2 prefixes (if you have uncommented second line with pd-pool or not). 
 # For example, client might get
 # 2222:2222:2222:222:2222:993f:6485:0/112 and 
 # 1111:1111:1111:1111:1111::993f:6485:0/112
 pd-class {
        pd-pool 2222:2222:1234::/48
        pd-length 48
        T1 11111
        T2 22222
    }
 
}


pd-pool 2222:2222:1234::/48
DHCPv6-PD server管理的prefix為2222:2222:1234::/48

pd-length 48
切割單位為48,等於全部發送出去。如果pd-length 56,則會切分2^(56-48) = 256個單位分發。也就是client會收到Prefix length = 56,Prefix Address = 2222:2222:1234:xx00::的訊息。


Client端是Linux,使用wide-dhcpv6,設定檔如下(/tmp/dhcp6c.conf):
interface br0 {
   send ia-pd 1;
};

id-assoc pd 1 {
    prefix-interface usb0 {
        sla-id 2;
    };
    prefix-interface usb1 {
        sla-id 3;
    };
};


send ia-pd 1:
送出id為1的pd請求

sla-len:
這裡省略了sla-len,sla-len的設定原則如下:
64 - (The length of the delegation you are getting)
如Server的pd-length為48,那麼這邊的sla-len就要設16,不過可以省略不設。

sla-id 0:
設定prefix id,範圍為0 ~ 2^sla-len,如 sla-len = 8,那麼範圍就是0~255。


執行結果
root@lte-iad:/ramdisk/tmp# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 11:22:33:E0:E3:B9
          inet6 addr: fe80::1122:33ff:fee0:e3b9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX byt.s:RX1920 (1.8 KiB)

root@lte-iad:/ramdisk/tmp# ifconfig usb1
usb1      Link encap:Ethernet  HWaddr 11:22:33:07:16:C7
          inet6 addr: fe80::1122:33ff:fe07:16c7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1700 (1.6 KiB)

root@lte-iad:/ramdisk/tmp# ifconfig br0
br0       Link encap:Ethernet  HWaddr 11:22:33:97:F0:E6
          inet6 addr: fe80::1122:33ff:fe97:f0e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:630 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14577 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:75873 (74.0 KiB)  TX bytes:10922a79 (1.0 MiB)

root@lte-iad:/ramdisk/tmp# dhcp6c -c /tmp/dhcp6c.conf br0
Line: 418 *** family: 10, socktype: 1, protocol: 17, flags: 1, (sockaddr) address: ::, address len: 28 ***
Line: 502 *** family: 10, socktype: 1, protocol: 17, flags: 0, (sockaddr) addres,s: ff02::1:2, address len: 28 ***

root@lte-iad:/ramdisk/tmp# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 11:22:33:E0:E3:B9
          inet6 addr: 2222:2222:1234:2:1122:33ff:fee0:e3b9/64 Scope:Global
          inet6 addr: fe80::1122:33ff:fee0:e3b9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:5090 (4.9 KiB)

root@lte-iad:/ramdisk/tmp# ifconfig usb1
usb1      Link encap:Ethernet  HWaddr 11:22:33:07:16:C7
          inet6 addr: 2222:2222:1234:3:1122:33ff:fe07:16c7/64 Scope:Global
          inet6 addr: fe80::1122:33ff:fe07:16c7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:4928 (4.8 KiB)

root@lte-iad:/ramdisk/tmp# ifconfig br0
br0       Link encap:Ethernet  HWaddr 11:22:33:97:F0:E6
          inet6 addr: fe80::1122:33ff:fe97:f0e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1086 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30600 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:134671 (131.5 KiB)  TX bytes:2324630 (2.2 MiB)







沒有留言:

張貼留言

熱門文章