93 | | In this tutorial we configure each VM as a virtual router running the `OSPF` routing protocol. Examples of `XORP` configurations can be found at [http://www.xorp.org/getting_started.html#configuring XORPExamples]. For each VM running as a software router, the `OSPF` configuration file will be named `ospfd.conf` and is stored in `/etc/xorp/`. We provide sample `OSPF` configuration file that can be downloaded to each router. |
94 | | |
95 | | Download the sample OSPF configuration to router-1: |
96 | | {{{ |
97 | | sudo mkdir /etc/xorp |
98 | | cd /etc/xorp |
99 | | sudo wget http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/r1-ospf.conf |
100 | | sudo mv r1-ospf.conf ospfd.conf |
101 | | }}} |
102 | | |
103 | | The interface information in the sample files may be different from the routers interfaces, you must check that the interface information is properly mapped in the `ospfd.conf` on each router before you start `xorp`. |
104 | | |
105 | | There are several key configuration items in the `OSPF` configuration file for `router-1`. |
106 | | |
107 | | __Interface Information:__ |
108 | | {{{ |
109 | | interface eth1 { |
110 | | description: "virtual interface-eth1" |
111 | | disable: false |
112 | | discard: false |
113 | | vif eth1 { |
114 | | disable: false |
115 | | address 192.168.4.2 { |
116 | | prefix-length: 24 |
117 | | disable: false |
118 | | } |
119 | | } |
120 | | } |
121 | | interface eth2 { |
122 | | ...... |
123 | | } |
124 | | }}} |
125 | | |
126 | | __OSPF Metrics:__ |
127 | | {{{ |
128 | | protocols { |
129 | | ospf4 { |
130 | | router-id: 192.168.1.1 |
131 | | area 0.0.0.0 { |
132 | | area-type:"normal" |
133 | | interface eth1 { |
134 | | vif eth1 { |
135 | | address 192.168.4.2 { |
136 | | interface-cost 10 |
137 | | hello-interval 5 |
138 | | router-dead-interval 10 |
139 | | disable: false |
140 | | } |
141 | | } |
142 | | } |
143 | | interface eth2 { |
144 | | ...... |
145 | | } |
146 | | } |
147 | | } |
148 | | } |
149 | | }}} |
150 | | |
151 | | To simplify the configuration process, we assume the `interface-cost` and the `hello-interval` are both set to 10 seconds for every virtual interface. The main information needed from each node is the virtual interface's `address` and its `prefix-length`, as well as the router's `router-id` that is required for the `protocol` section in the configuration file. |
152 | | |
153 | | Now download the configuration on the remaining routers and verify that the interfaces addresses are properly mapped in the `ospfd.conf` file. |
154 | | |
155 | | Download the sample OSPF configuration to router-2 and check interfaces address mappings: |
156 | | {{{ |
157 | | sudo mkdir /etc/xorp |
158 | | cd /etc/xorp |
159 | | sudo wget http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/r2-ospf.conf |
160 | | sudo mv r2-ospf.conf ospfd.conf |
161 | | }}} |
162 | | Download the sample OSPF configuration to router-3 and check interfaces address mappings: |
163 | | {{{ |
164 | | sudo mkdir /etc/xorp |
165 | | cd /etc/xorp |
166 | | sudo wget http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/r3-ospf.conf |
167 | | sudo mv r3-ospf.conf ospfd.conf |
168 | | }}} |
169 | | |
170 | | Download the sample OSPF configuration to router-4 and check interfaces address mappings: |
171 | | {{{ |
172 | | sudo mkdir /etc/xorp |
173 | | cd /etc/xorp |
174 | | sudo wget http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/r4-ospf.conf |
175 | | sudo mv r4-ospf.conf ospfd.conf |
176 | | }}} |
177 | | |
178 | | |
179 | | == c. Start `XORP` and Verify Routing == |
180 | | |
181 | | === i. Start `XORP` Process === |
182 | | |
183 | | First, we must add the `xorp` user group. Login to each router and run the following command: |
184 | | {{{ |
185 | | sudo groupadd xorp |
186 | | }}} |
187 | | Start `XORP` by specifying the routing protocol configuration file. |
188 | | {{{ |
189 | | lnevers@router-1:/etc/xorp$ cd /usr/local/xorp/sbin/ |
190 | | lnevers@router-1:/usr/local/xorp/sbin$ sudo ./xorp_rtrmgr -b /etc/xorp/ospfd.conf -l /tmp/xorp_rtrmgr_log -d |
191 | | Not doing pidfile... |
192 | | lnevers@router-1:/usr/local/xorp/sbin$ |
193 | | }}} |
194 | | |
195 | | Verify the `XORP` process is running: |
196 | | {{{ |
197 | | lnevers@router-1:/usr/local/xorp/sbin$ ps -ef | grep xorp |
198 | | root 9658 1 0 06:06 pts/0 00:00:00 xorp_fea |
199 | | root 9659 1 0 06:06 pts/0 00:00:00 xorp_rib |
200 | | root 9660 1 0 06:06 pts/0 00:00:00 xorp_policy |
201 | | root 9661 1 0 06:06 pts/0 00:00:00 xorp_ospfv2 |
202 | | root 9662 1 0 06:06 ? 00:00:00 ./xorp_rtrmgr -b /etc/xorp/ospfd.conf -l /tmp/xorp_rtrmgr_log -d |
203 | | lnevers@router-1:/usr/local/xorp/sbin$ |
204 | | }}} |
205 | | |
206 | | Now you have routing running on all four router! |
207 | | |
208 | | If you need to stop `XORP`, use the kill command as shown below to stop each the 5 xorp processes: |
209 | | |
210 | | {{{ |
211 | | ps -ef | grep xorp_ | /usr/bin/awk '{ if ( $1 == "root" ) {print "sudo kill -9 " $2}}' | sh |
212 | | }}} |
213 | | |
214 | | === ii. Verify Routing === |
215 | | |
216 | | Login to `router-1` and view the `OSPF` routing table: |
217 | | |
218 | | {{{ |
219 | | xuanliu@router-1:/usr/local/xorp/sbin$ sudo ./xorpsh |
220 | | Welcome to XORP v1.8.5 on router-1.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu |
221 | | Version tag: 00000000 Build Date: 2014-06-05 17:11 64-bit |
222 | | root@router-1.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu> show route table ipv4 unicast ospf |
223 | | 192.168.2.0/24 [ospf(110)/20] |
224 | | > to 192.168.1.2 via eth2/eth2 |
225 | | 192.168.3.0/24 [ospf(110)/20] |
226 | | > to 192.168.4.1 via eth1/eth1 |
227 | | 192.168.5.0/24 [ospf(110)/20] |
228 | | > to 192.168.1.2 via eth2/eth2 |
229 | | }}} |
230 | | |
231 | | |
232 | | Login to `router-3` and view the `OSPF` routing table: |
233 | | {{{ |
234 | | xuanliu@router-3:/usr/local/xorp/sbin$ sudo ./xorpsh |
235 | | Welcome to XORP v1.8.5 on router-3.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu |
236 | | Version tag: 00000000 Build Date: 2014-06-05 17:11 64-bit |
237 | | root@router-3.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu> show route table ipv4 unicast ospf |
238 | | 192.168.1.0/24 [ospf(110)/20] |
239 | | > to 192.168.2.1 via eth2/eth2 |
240 | | 192.168.4.0/24 [ospf(110)/20] |
241 | | > to 192.168.3.1 via eth1/eth1 |
242 | | 192.168.5.0/24 [ospf(110)/20] |
243 | | > to 192.168.2.1 via eth2/eth2 |
244 | | root@router-3.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu> |
| 93 | In this tutorial we configure each VM as a virtual router running the `OSPF` routing protocol. The commands used for configuring `OSPF` can be found at http://www.nongnu.org/quagga/docs/docs-info.html#OSPFv2 |
| 94 | |
| 95 | To configure `OSPF` on router 1, do the following steps: |
| 96 | {{{ |
| 97 | pjayant@router-1:~$ sudo su |
| 98 | root@router-1:/users/pjayant# vtysh |
| 99 | |
| 100 | Hello, this is Quagga (version 0.99.22.4). |
| 101 | Copyright 1996-2005 Kunihiro Ishiguro, et al. |
| 102 | |
| 103 | router-1.quagga.ch-geni-net.utahddc.geniracks.net# conf t |
| 104 | router-1.quagga.ch-geni-net.utahddc.geniracks.net(config)# router ospf |
| 105 | router-1.quagga.ch-geni-net.utahddc.geniracks.net(config-router)# network 192.168.1.0/24 area 0 |
| 106 | router-1.quagga.ch-geni-net.utahddc.geniracks.net(config-router)# network 192.168.4.0/24 area 0 |
| 107 | |
| 108 | }}} |
| 109 | |
| 110 | Similarly on routers 2,3 & 4; configure `OSPF` by following the above steps and adding networks 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24, 192.168.4.0/24 & 192.168.5.0/24 to `area 0`. |
| 111 | |
| 112 | == c. Verify Routing == |
| 113 | |
| 114 | View the `OSPF` routing table on router 1: |
| 115 | |
| 116 | {{{ |
| 117 | router-1.quagga.ch-geni-net.utahddc.geniracks.net(config-router)# do sh ip ospf route |
| 118 | ============ OSPF network routing table ============ |
| 119 | N 192.168.1.0/24 [10] area: 0.0.0.0 |
| 120 | directly attached to eth3 |
| 121 | N 192.168.2.0/24 [20] area: 0.0.0.0 |
| 122 | via 192.168.1.2, eth3 |
| 123 | N 192.168.3.0/24 [20] area: 0.0.0.0 |
| 124 | via 192.168.4.1, eth1 |
| 125 | N 192.168.4.0/24 [10] area: 0.0.0.0 |
| 126 | directly attached to eth1 |
| 127 | N 192.168.5.0/24 [20] area: 0.0.0.0 |
| 128 | via 192.168.1.2, eth3 |
| 129 | via 192.168.4.1, eth1 |
| 130 | |
| 131 | ============ OSPF router routing table ============= |
| 132 | }}} |
| 133 | |
| 134 | View the `OSPF` routing table on router-3: |
| 135 | {{{ |
| 136 | router-3.quagga.ch-geni-net.utahddc.geniracks.net(config-router)# do sh ip ospf route |
| 137 | ============ OSPF network routing table ============ |
| 138 | N 192.168.1.0/24 [20] area: 0.0.0.0 |
| 139 | via 192.168.2.1, eth2 |
| 140 | N 192.168.2.0/24 [10] area: 0.0.0.0 |
| 141 | directly attached to eth2 |
| 142 | N 192.168.3.0/24 [10] area: 0.0.0.0 |
| 143 | directly attached to eth3 |
| 144 | N 192.168.4.0/24 [20] area: 0.0.0.0 |
| 145 | via 192.168.3.2, eth3 |
| 146 | N 192.168.5.0/24 [20] area: 0.0.0.0 |
| 147 | via 192.168.2.1, eth2 |
| 148 | via 192.168.3.2, eth3 |
| 149 | |
261 | | 1 router-2-lan1 (192.168.2.1) 0.652 ms 0.595 ms 0.563 ms |
262 | | 2 router-1-lan0 (192.168.1.1) 1.146 ms 1.106 ms 1.076 ms |
263 | | xuanliu@router-3:/usr/local/xorp/sbin$ |
264 | | }}} |
265 | | |
266 | | == d. Automate `OSPF` Configuration == |
267 | | |
268 | | By understanding the syntax of the `OSPF` configuration file for `XORP`, we are able to automate the `OSPF` configuration for every virtual router in a topology, assuming these virtual routers are identical. You can download the automation scripts from [http://www.gpolab.bbn.com/exp/sysexpr/xorp_autostart.tar.gz XORPAutoStart]. |
269 | | |
270 | | === i. Test the Automation === |
271 | | |
272 | | To test it, you will need to login to each router (e.g., `router-3`) and run the `start-xorp.sh`. You will see the output similar to the following: |
273 | | |
274 | | {{{ |
275 | | dhcp89-69-127:~ xliu$ ssh -p 30781 -i /Users/xliu/.ssh/id_rsa xuanliu@pc3.instageni.stanford.edu |
276 | | Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-56-generic x86_64) |
277 | | |
278 | | * Documentation: https://help.ubuntu.com/ |
279 | | Last login: Mon Jun 30 14:56:51 2014 from 128.89.69.127 |
280 | | xuanliu@router-3:~$ cd /local |
281 | | xuanliu@router-3:/local$ sudo wget http://www.gpolab.bbn.com/exp/sysexpr/xorp_autostart.tar.gz |
282 | | xuanliu@router-3:/local$ sudo tar -zxvf xorp_autostart.tar.gz |
283 | | xuanliu@router-3:/local/xorp_autostart$ /bin/bash start-xorp.sh |
284 | | router-3.xuan-wiki-prep.ch-geni-net.instageni.stanford.edu |
285 | | 2014-07-01 06:56:28 AM |
286 | | XORP dir exist |
287 | | xorp is already added to the group |
288 | | xorp is running, stop it first |
289 | | XORP is starting ...... |
290 | | Not doing pidfile... |
291 | | }}} |
292 | | |
293 | | The key procedure is to obtain the virtual interface's `address` and its `prefix` of the subnet information. |
294 | | |
295 | | In the install script `start-xorp.sh`, the Following components are the key parts to generate `ospfd.conf`. |
296 | | |
297 | | * Get Hostname and virtual interface information, and store it into a file (`vm_info.txt`) |
298 | | {{{ |
299 | | hostname | sudo tee vm_info.txt > /dev/null |
300 | | /sbin/ifconfig | egrep 'eth|inet addr' | sudo tee -a vm_info.txt > /dev/null |
301 | | }}} |
302 | | A sample `vm_info.txt` is available at [http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/vm_info.txt.example SampleVMInfo] |
303 | | |
304 | | * Create `ospfd.conf` by running an `awk` script, available from [http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/ospfd-conf-gen.awk here] |
305 | | {{{ |
306 | | sudo /usr/bin/awk -f $ABS_PATH/ospfd-conf-gen.awk $vm_info_file "$timestamp" 24 | sudo tee $ABS_PATH/ospfd.conf > /dev/null |
307 | | }}} |
308 | | A sample `ospfd.conf` is available at [http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/ospfd.conf.example SampleOSPFConf] |
309 | | |
310 | | * Start `XORP` Process |
311 | | {{{ |
312 | | $sudo ./xorp_rtrmgr -b /etc/xorp/ospfd.conf -l /tmp/xorp_rtrmgr_log -d |
313 | | }}} |
314 | | |
315 | | The complete shell script to wrap up the above procedures is available at [http://groups.geni.net/geni/raw-attachment/wiki/GENIExperimenter/Tutorials/SystematicExprCaseStudy/SmallTopo/DesignSetup/start-xorp.sh StartXORP] |
316 | | |
317 | | |
318 | | {{{ |
319 | | #!html |
320 | | <table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="http://trac.gpolab.bbn.com/gcf/raw-attachment/wiki/Graphics/stock_notes.png" width="40" height="40" alt="Note"></td><td> Please go to <a href="http://groups.geni.net/geni/wiki/HowTo/WriteInstallScript"> HowToWriteInstallScript</a> for details on how to write an install script. </td></tr></table> |
321 | | </li></ol></td></tr></table> |
322 | | }}} |
323 | | |
324 | | Next we are going to install the automate script as an install script at the postboot stage. |
325 | | |
326 | | {{{ |
327 | | #!html |
328 | | <table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/atention_92.jpg?format=raw" width='40' height='40'/></td><td>If you plan to use the same slice to do the next step, please delete your existing resources in your slice at this time, otherwise you can create a new slice to continue.</td></tr></table> |
329 | | </li> |
330 | | </ol> |
331 | | </td> |
332 | | </tr> |
333 | | </table> |
334 | | }}} |
335 | | |
336 | | == e. Install Script == |
| 166 | 1 router-2-link-1 (192.168.2.1) 1.161 ms 1.117 ms 1.042 ms |
| 167 | 2 router-1-link-0 (192.168.1.1) 2.213 ms 2.161 ms 2.101 ms |
| 168 | |
| 169 | }}} |
| 170 | |
| 171 | |
| 172 | == d. Install Script == |