# A Design for SDN-Based Identifier-Locator Separation Architecture on IoT Networks
## 3 Proposed SDN-Based Identifier-Locator Separation Architecture for IoT Networks
### Main Procedure  
#### 3.4.1 Registration and Packet Forwarding Process  
The ARs of the proposed scheme are operated by an AR processing algorithm. The algorithm consists of three procedures according to the AR's role, and the algorithms for ARs are illustrated in Algorithm 1. If a new MN tries to connect to the network, it has to register itself to obtain necessary services. When the MN attaches to the network, the nearest OFS detects the attachment. If the OFS does not have any information about the MN in its flow table, it notifies the attachment of the MN to its AR. This AR becomes the s_AR of the MN, and it also detects the L2 attachment. From the L2 attachment, the s_AR can acquire the MN's ID and then can generate the EID and the LOC of the MN. The s_AR first looks up the EID routing table to find a dedicated next hop port for the EID. After that, the s_AR sends a registration request to the h_AR of the MN with its EID or LOC address, and it also sends a command to add a flow table entry to its OFS. This flow table entry is used for the ingressive packets using LOC to exchange an LOC for the EID of the MN. As the ARs are able to know their neighbor ARs using neighbor a detection mechanism like that in [18], the paths between ARs are already pre-configured. Therefore, the s_AR can find the next hop port for the EID. Lines 2-15 of Algorithm 1 illustrates the procedure. ```
1: receive a packet pkt from the OFS
2: if destination is MY ADDRESS (EID or LOC of this AR) then
3: if pkt:type is L2 ATTACHMENT NOTIFY then
4: save MN-ID from pkt; generate \(EID_{MN}\) using \(NAI_{MN}\); generate \(LOC_{MN}\) using \(MAC_{MN}\)
5: LOOKUP EIDRoutingTable for the next hop port(D)
6: send EID REG REQ(\(EID_{MN}\), \(LOC_{MN}\)) to h_AR(\(EID_{MN}\))
7: add (\(EID_{MN}\), \(LOC_{MN}\)) to BindingUpdateList; add flow table entry (\(LOC_{MN}\to EID_{MN}\))
8: else if pkt:type is EID registration reply then
9: done
10: end if
11: else if pkt:dst is in MY EID address block then
12: if pkt:type is EID registration request then
13: add <EID,LOC> to BindingCache; add a flow table entry(pkt:EID \(\rightarrow\) pkt:LOC)
14: send EID registration reply to pkt's src
15: end if
16: else if pkt:dst is not in MY EID address block then
17: LOOKUP EID routing table(dst) for next hop port(D); add a flow table entry (\(EID_{MN}\), D); Packet-Out(pkt)
18: else
19: drop packet
20: end if
```  
**Algorithm 1** Registration and Packet forwarding  
For the first received query request, the iOFSs do not have any entries related to the query. They send the query to their ARs for obtaining suitable flow table entries. After receiving the query, the n_AR checks whether the EID is included within its EID block. If not, the n_AR looks up its EIDrouting table for the next hop port. Then, it adds a flow table entry for the query to its OFSs, and the OFSs forward the query to the port toward to the MN's AR according to the flow table. When the query request arrives to the OFS of the MN's AR, it forwards the query to its controller, the h_AR. The h_AR also checks the EID according to Algorithm 1, and then it adds the EID-LOC mapping information to its binding cache. The MN's AR sends a command to its OFSs to add a flow table entry with the action that replaces the destination address from the EID to the LOC and that forwards the replaced packet to the IP domain. After sending the command to its OFS, it replies to the s_AR of the MN. The registration processes are terminated after the MN's s_AR receives the reply. For the packet forwarding, an MN may send a packet with EIDs as the source and destination address. If the OFS of the AR which the MN is attached to has no flow table entries for \(EID_{CN}\), it forwards the MN's packet to the AR. The AR looks up its EID routing table to handle the received packet. After finding the next hop port to forward the packet toward the destination, the AR sends a command to add a flow table entry to its OFSs according to Algorithm 1. Then, the packet is forwarded to the OFS of the h_AR via the n_ARs and their OFSs.