ION-DTN RC配置檔案分析
阿新 • • 發佈:2019-01-22
在安裝好ion環境後,要開啟ION應用程式並通過DTN協議棧傳輸資料,最重要的就是通過ionstart命令配置rc檔案來配置應用程式的環境,
新增一個span也就是一個連線,2表示連線另一端的節點號碼,5表示最大數目的輸出會話程序,120000是最大的輸出塊尺寸,後面的5和120000表示輸入的最大數目會話程序和最大塊尺寸,這裡設定和輸出一樣。1400是segment的尺寸,也就是1400byte資料在一個幀中,比如udp包,120000是限制聚合層大小,並設定聚合層時間為1s,命令'udplso 10.0.0.4:1113‘是設定連線本身性質,在這個rc檔案中,利用udp連線host2(ip地址:10.0.0.4)埠1113。
一般而言,ionstart開啟rc檔案的命令如下:
ionstart -I host1.rc
其中host1.rc就是rc檔名,要注意的是,在終端輸入ionstart命令,當前路徑必須是rc檔案所在路徑。
接下來具體分析rc檔案的組成:
首先給出一份rc檔案:
在分析之前,要知道一點:以單個“#”開頭的行表示註釋以方便了解相應配置所起的作用,而以兩個“##”開頭的行即表示此行為註釋號,同時也起到識別不同管理程序的作用,如ionadmin, ionsecadmin, ltpadmin, bpadmin, ipnadmin。
host1.rc
## begin ionadmin # ionrc configuration file for host3 in a 3node ltp test. #This uses ltp as the convergence layer. #command: % ionadmin host3.ionrc #This command should be run FIRST. # #Soochow University, April 2012 # Initialization command (command 3). #Set this node to be node 3 (as in ipn:3). #Use sdr configuration of “ionconfig” file. 1 1 ionconfig # start ion node s # Add some contacts. #They will start at +0 seconds from now, ending +86400 seconds from now. #They will connect node 1 to node 2, and connect node 2 to node 3. #They will transmit 125000 bytes/second. #Note that contacts are unidirectional, so order matters. a contact +0 +86400 1 2 125000 a contact +0 +86400 2 1 125000 # Add some ranges. These are the physical distance between nodes. #They will start at +0 seconds from now, ending +86400 seconds from now. #They will connect node 1 to node 2, and connect node 2 to node 3. #We will assume every range is one second. Data on the link is expected to take 1 second #to reach the other end (One Way Light Time). #Note that ranges cover both directions, so you only need define one range for any #combination of nodes. a range +0 +86400 1 2 1 # set this node to consume and produce a mean of 1000000 bytes/second. m production 1000000 m consumption 1000000 m horizon +0 ## end ionadmin ## begin ionsecadmin 1 e 1 ## end ionsecadmin ## begin ltpadmin # ltprc configuration file for host1 in a 3node ltp test. #Command: % ltpadmin host3.ltprc #This command should be run AFTER ionadmin and BEFORE bpadmin. # #Soochow University, April 2012 # #A warning: the ltp configuration is not ideal in this case. #please consult manual pages and other documentation for a better description. # Initialization command (command 1). # Establishes the LTP retransmission window. # (Prohibiting LTP from seizing all available storage). #A maximum of 5 sessions. A session is assumed to be around one second of #transmission. This value should be estimated at the sum of maximum round-trip #times(in seconds) for all "spans." Suggest throwing 20% higher number of sessions #to account for extra- long sessions which contain an actual retransmission. Set a total #LTP memory space usage limit of 1200000 as the sum of the memory space usage of #all spans (more or less the number of bytes in transit on all links for their duration). 1 5 1200000 # Add a span. (a connection) #Identify the span as engine number 2. That is the ipn node number of the node on #the other end of this span. Use 5 as the maximum number of export sessions. #Use 120000 as the maximum size of an export block. This more or less limits the #maximum size of a bundle in the system. The next two items are the maximum #number of import sessions and the maximum size of an imported block. #Since this is connect, we just copy the export numbers here. #1400 is the maximum segment size- more or less, the amount of data that can be #held in a single frame of the underlying protocol. In this case, UDP packets are #the frame, and we will give a conservative limit. #Limit the aggregation size to 120000 bytes, and set a time limit on aggregation to 1 #second. Use the command 'udplso 10.0.0.4:1113' to implement the link itself. #In this case, we use udp to connect to host2 (10.0.0.4 is host2's ipaddr) using port 1113 #(defined by IANA as the default UDP port for Licklider Transmission Protocol). #The single quote is important, don't use double quotes. a span 2 5 120000 5 120000 1400 120000 1 'udplso 10.0.0.4:1113' # Start command. #This command actually runs the link service output commands #(defined above, in the "a span" commands). #Also starts the link service INPUT task 'udplsi 10.0.0.5:1113' to #listen locally on UDP port 1113 for incoming LTP traffic. s 'udplsi 10.0.0.3:1113' m screening n w 1 ## end ltpadmin ## begin bpadmin # bprc configuration file for host3 in a 3node ltp test. #Command: % bpadmin host3.bprc #This command should be run AFTER ionadmin and ltpadmin and #BEFORE ipnadmin or dtnadmin. # #Soochow University, April 2012 # Initialization command (command 1). 1 # Add an EID scheme. #The scheme's name is ipn. #This scheme's forwarding engine is handled by the program 'ipnfw.' #This scheme's administration program (acting as the custodian daemon) is 'ipnadminep.' a scheme ipn 'ipnfw' 'ipnadminep' # Add endpoints. #Establish endpoints ipn:3.1 and ipn:3.2 on the local node. #The behavior for receiving a bundle when there is no application currently accepting #bundles, is to queue them 'q', as opposed to immediately and silently discarding #them (use 'x' instead of 'q' to discard). #Note that the custodian endpoint ipn:3.0 is automatically generated. a endpoint ipn:1.0 q a endpoint ipn:1.1 q a endpoint ipn:1.2 q # Add a protocol. #Add the protocol named ltp. #Estimate transmission capacity assuming 1400 bytes of each frame (in this case, udp #on ethernet) for payload, and 100 bytes for overhead. a protocol ltp 1400 100 # Add an induct. (listen) #Add an induct to accept bundles using the ltp protocol. #The duct's name is 3 (this is for future changing/deletion of the induct). #The induct itself is implemented by the 'ltpcli' command. a induct ltp 1 ltpcli # Add an outduct. (send to host2) #Add an outduct to send bundles using the ltp protocol. #The duct's name is 2(this is for future changing/deletion of the outduct). #The outduct itself is implemented by the 'ltpclo' command. a outduct ltp 2 ltpclo #Start bundle protocol engine, also running all of the induct, outduct, and #administration programs defined above s #w 1 ## end bpadmin ## begin ipnadmin # ipnrc configuration file for host3 in a 3node ltp test. #Essentially, this is the IPN scheme's routing table. #Command: % ipnadmin host1.ipnrc #This command should be run AFTER bpadmin (likely to be run last). # #Soochow University, April 2012 # Add an egress plan. #Bundles to be transmitted to element number 2 can be transmitted directly to host2 #using ltp outduct identified as ‘2.’ #See your bprc file or bpadmin for outducts/protocols you can use. a plan 2 ltp/2 ## end ipnadmin
接下來分段分析:
1 2 ionconfig
這行命令是選取ionconfig配置檔案,該檔案主要是指定了ion執行的記憶體空間,1代表是命令1 ,2代表是節點2,也就是如果你是為了節點1配置rc檔案,那麼這裡應該改成1 1 ionconfig,要注意的是,這裡ionconfig檔案應該和rc檔案在同一路徑下。
# start ion node
s
該行命令無需多解釋
a contact +0 +86400 1 2 125000
a contact +0 +86400 2 1 125000
這兩行命令是新增傳輸的時間和節點,傳輸將從0s開始,結束於86400s,將連線從節點1到節點2,傳輸速度是125000 bytes/second新增一些範圍。 這些是節點之間的物理距離,連線節點1到節點2,我們假設這些節點之間的距離時間為1s,也就是說資料從節點1到節點2要花費1s時間,由於range包含了雙向,因此只需要定義一個range即可。a range +0 +86400 1 2 1
m production 1000000
m consumption 1000000
m horizon +0
設定該節點消耗和生產的均值為1000000 bytes/second
1
e 1
不多解釋a protocol ltp 1400 100
1 5 1200000
1表示命令1,5表示會話程序最大值為5,1200000(單位byte)表示LTP記憶體空間的使用上限,,也就是所有span的使用記憶體空間總和。
a span 2 5 120000 5 120000 1400 120000 1 'udplso 10.0.0.4:1113'
新增一個span也就是一個連線,2表示連線另一端的節點號碼,5表示最大數目的輸出會話程序,120000是最大的輸出塊尺寸,後面的5和120000表示輸入的最大數目會話程序和最大塊尺寸,這裡設定和輸出一樣。1400是segment的尺寸,也就是1400byte資料在一個幀中,比如udp包,120000是限制聚合層大小,並設定聚合層時間為1s,命令'udplso 10.0.0.4:1113‘是設定連線本身性質,在這個rc檔案中,利用udp連線host2(ip地址:10.0.0.4)埠1113。
s 'udplsi 10.0.0.3:1113'
m screening n
w 1
這裡設定input task。用udp埠1113進行監聽,本節點地址為10.0.0.3。
m screening n 此命令啟用或禁用接收的LTP的篩選,n表示禁用。預設是禁用。
a scheme ipn 'ipnfw' 'ipnadminep'
不做解釋
a endpoint ipn:1.0 q
a endpoint ipn:1.1 q
a endpoint ipn:1.2 q
新增終端節點,ipn:1.0 1表示本節點的number,0表示service number,servicenumber 類似於埠號之類的,每個number提供一個服務,q表示對於每一個接收到的bundle進行排隊,而x表示立即丟棄這個bundle,也就是a endpoint ipn:1.0 q 改成a endpoint ipn:1.0 x,常用在loopback測試中。
a protocol ltp 1400 100
新增ltp協議,每個frame有1400bytes資料,100個位元組的開銷。
a induct ltp 1 ltpcli
新增監聽induct,duct的名字為1
a outduct ltp 2 ltpclo
添加發送outduct,duct名字為2
s
開始bundle 協議,開啟所有的induct和outduct。
a plan 2 ltp/2
新增輸出計劃,也就是bundle要傳輸到node number為2的節點,使用標識為“2”的ltp輸出。
以上就是對rc檔案的分析,可以說正確的配置好rc檔案那麼ion就成功了一半,那麼rc檔案中,有幾個需要注意的地方,
比如bp的啟動命令
s,很多情況下由於並不顯眼,可能會漏寫該命令,會直接導致bp層執行失敗。本人就曾經因為漏了s命令,調了一天的bug。
還有就是ltp協議的兩個主要引數,block和session。也就是這條命令:a span 1 5 120000 5 120000 1400 120000 1 'udplso 10.0.0.3:1113'
Block 的尺寸決定著一次會話最多可以傳輸多少資料(以位元組為單位)。會話的量(或數目)決定著同時最多可以進行多少個會話。Block 的實際尺寸與通道的速率( Channel rate )決定了傳輸 Block 所需的時間。