2013年9月21日 星期六

RFC 5569 - IPv6 Rapid Deployment on IPv4 Infrastructures (6rd)之筆記


Abstract

6rd是建立在6to4的機制上,提供ISP快速布建IPv6網路的機制,
和6to4相似處:
  statless IPv6(IPv6 prefix + IPv4 address information),並且將IPv6封裝在IPv4上在IPv4-only網路上傳送。
和6to4不同處:
  6to4使用2002::/16的prefix,而6rd使用ISP給的prefix。


Introduction

描述Free這間ISP成功的使用6rd快速布建IPv6網路(5周),而且低成本,變動少。


Problem Statement and Purpose of 6rd

ISP/Customer/Application之間的死結,影響IPv6布置的速度。
ISP等待Customer有需求才會想布置IPv6,而客戶只有當應程式需要IPv6才會想用IPv6,應用程式卻因為沒有IPv6所以在NAT底下繼續奮鬥。
ISPs wait for customer demand before deploying IPv6; customers don't demand IPv6 as long as application vendors announce that their products work on existing infrastructures (that are IPv4 with NATs); application vendors focus their investments on NAT traversal compatibility as long as ISPs don't deploy IPv6.

Problem
6to4的routing問題,6to4的IPv6 address是由IPv4算出來的,如:ISP給你10.1.1.1,你的6to4 address就是2001:0a01:0101::,另外一個ISP也給他的client相同的IPv4 Addresss,而他也使用了6to4,routing就出問題了。這個問題的癥結點就是相同的prefix,如果由ISP各自給合法的Prefix,就沒這問題了。因為即使是NAT,各自的Prefix還是會不同,IPv6 address仍可保證唯一。


Specification

6rd relay server的IPv4 anycast address可以由ISP自行決定,通常會避免掉192.88.99.1這個6to4專用address。

圖中說明,6rd CPE會負責將IPv6的packet封裝在IPv4裡面,並且往6rd relay server傳送,之後就可以送到IPv6的Network去,反過來,目的地是ISP的IPv6 prefix就會經由6RD relay server送到6rd CPE去。

    參考資料:
  1. 6to4 and 6rd
  2. RFC 5569 - IPv6 Rapid Deployment on IPv4 Infrastructures (6rd)





2013年9月14日 星期六

融券現償


102/09/04券賣國泰金$42.35,保證金38,200。
102/09/12現償國泰金$43.25,應退$42.35,因為已經賣在42.35。
102/09/13收到$38200 + $42350 - 費用(60+127+33) + 利息(3) = 80333。

年/月/日 股票別 股數 單價 價金 手續費 交易稅 淨付額 擔保品 融資金額 融券保證金 借券費
102/09/04
券賣
2882
國泰金
1,000 42.35 42,350 60 127 38,200 0 42,130 38,200 33

金額詳細算法:
保證金:成交價金x 保證金成數(90%)
42350 x 0.9 = 38115

借卷費:又稱融券手續費,成交價金x融券手續費率(0.08%)
42350 x 0.0008 = 33.88

賣出手續費:成交價金 x 賣出手續費率(0.1425% X 折扣)
42350 x 0.001425 = 60.35

證交稅:成交價金x證交稅率(0.3%)
42350 x 0.003 = 127.05

融卷放空可向券商收取利息,
利息=(擔保品價金+保證金) x 融卷利率(0.2%) x 融資券計息天數/365
(38200 + 42350) x 0.002 x 8 / 365 = 3.531


    參考資料:
  1. 券商優惠列表(含融資劵利率)




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)







熱門文章