Updated git submodules
[docs.git] / docs / user-guide / natapp-user-guide.rst
1 NATApp User Guide
2 =================
3
4 The NATApp User Guide contains information about configuration,
5 administration, management, using and troubleshooting the feature.
6
7 Overview
8 --------
9
10 NATApp provides network different types of address translation
11 functionality for OpenDaylight. After installing this feature, network
12 administrators can select the type of NAT functionality they want to
13 enable by sending a REST API command. Subsequently, the user may enter
14 the gloabl IP addresses to the YANG Data Store through REST APIs. When
15 an OpenDaylight managed enterprise network with local IPs tries to
16 connect to external networks such as Internet, NATApp comes into play
17 and installs appropriate flow rules at the OpenFlow switch for
18 bidirectional NAT translation.
19
20 NATApp Architecture
21 -------------------
22
23 NATApp listens on OpenFlow southbound interface for Packet\_In messages.
24 The application parses the message for header information. If the
25 received message has a local IP address the application installs rules
26 on the OpenFlow switch for network address translation from local to
27 global IP addresses. NATApp has NATPacketHandler class that implements
28 the PacketProcessing interface to override the OnPacketReceived
29 notification by which the application is notified of Packet\_In
30 messages.
31
32 Configuring NATApp
33 ------------------
34
35 REST APIs are available at the following URI:
36 http://localhost:8181/apidoc/explorer/index.html#!/natapp(2016-01-25)
37
38 Mininet Topology
39 ~~~~~~~~~~~~~~~~
40
41 ::
42
43     sudo mn --mac --topo=single,10 --controller=remote,ip=127.0.0.1,port=6653
44
45 Install a flow to flood the ARP packets.
46
47 ::
48
49     sh ovs-ofctl add-flow s1 dl_type=0x0806,actions=FLOOD
50
51 Check the flow for ARP Flooding
52
53 ::
54
55     sh ovs-ofctl dump-flows s1
56
57 Administering or Managing NATApp
58 --------------------------------
59
60 Static NAT and Dynamic NAT
61 ~~~~~~~~~~~~~~~~~~~~~~~~~~
62
63 First user has to select the type of NAT he wants by using the following
64 URI:
65
66 POST URI
67     http://localhost:8181/restconf/operations/natapp:nat-type
68
69 Sample Input
70     {"natapp:input": { "type:static":""}}
71
72 Sample Input
73     {"natapp:input": { "type:dynamic":""}}
74
75 Then user can inject the Global IPs using the following URI
76
77 PUT URI
78     http://localhost:8181/restconf/config/natapp:staticNat/
79
80 Sample Input
81     {"natapp:staticNat": {"globalIP":["172.0.0.1/32","172.0.0.2/32",
82     "172.0.0.3/32", "172.0.0.4/32", "172.0.0.5/32", "172.0.0.6/32",
83     "172.0.0.7/32", "172.0.0.8/32", "172.0.0.9/32", "172.0.0.10/32"] }}
84
85 From mininet verify any pair of hosts can ping each other. The NATApp
86 modifies the destination IP address of the ICMP Echo request with the
87 global IP address. Check the mininet flows for this modification.
88
89 ::
90
91     sh ovs-ofctl dump-flows s1
92
93 Port Address Translation (PAT)
94 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
96 User can select PAT by using the following URI.
97
98 POST URI
99     http://localhost:8181/restconf/operations/natapp:nat-type
100
101 Sample Input
102     {"natapp:input": { "type:pat":""}}
103
104 Then user can inject the Global IPs using the following URI
105
106 PUT URI
107     http://localhost:8181/restconf/config/natapp:patNat/
108
109 Sample Input
110     {"natapp:patNat": {"globalIP":"172.0.0.1/32"}}
111
112 From Mininet use the command as xterm h1 h5. At h5 give the following
113 commands
114
115 ::
116
117     $ ip r add 172.0.0.1/32 dev h5-eth0
118     $ arp -s 172.0.0.1 00:00:00:00:00:01
119     $ nc -l 5000
120
121 At h1, Give the following command
122
123 ::
124
125     $ echo "TCS" | nc -p 8000 10.0.0.5 5000
126
127 ::
128
129     mininet> sh ovs-ofctl dump-flows s1
130     NXST_FLOW reply (xid=0x4):
131      cookie=0x0, duration=811.272s, table=0, n_packets=5, n_bytes=342, idle_age=13, priority=210,tcp,in_port=1,tp_src=8000 actions=mod_nw_src:172.0.0.1,mod_tp_src:2000,output:5
132      cookie=0x0, duration=499.843s, table=0, n_packets=2, n_bytes=84, idle_age=13, arp actions=FLOOD
133      cookie=0x0, duration=811.203s, table=0, n_packets=3, n_bytes=206, idle_age=13, priority=209,tcp,in_port=5,tp_dst=2000 actions=mod_nw_dst:10.0.0.1,mod_tp_dst:8000,output:1
134