DTunnels: OSPF.txt

File OSPF.txt, 10.9 KB (added by hdempsey@bbn.com, 11 years ago)

Notes on OSPF experiment using Quagga software and EGRE tunnels

Line 
1
2OSPF experiment using Quagga software and virtual network of OpenVZ nodes + EGRE tunnels.
3
41. Create an emulab experiment using "ospf_setup.ns" setup file.
52. When Emulab swaps in experiments, it leaves lots of free space on the HDD of the created nodes.
6   Create partitions on this free space to store virtual machines.
7   To do so, use following commands on all the machines.
8   a. parted
9   b. print free
10      (Notice the last line it prints the free space. For e.g. a run of this on an emulab machine is)
11--------------------------------------------------------------------------------------------------------
12(parted) print free
13Model: SEAGATE ST3146707LC (scsi)
14Disk /dev/sda: 147GB
15Sector size (logical/physical): 512B/512B
16Partition Table: msdos
17
18Number  Start   End     Size    Type     File system  Flags
19 1      32.3kB  3216MB  3216MB  primary  sun-ufs
20 2      3216MB  6432MB  3216MB  primary  ext3         boot
21 3      6432MB  6564MB  132MB   primary  linux-swap
22        6564MB  147GB   140GB            Free Space
23--------------------------------------------------------------------------------------------------------
24
25We will create new partition from 6564MB till the end of the disk.
26
27   c. mkpart
28      (answer the questions as shown below)     
29--------------------------------------------------------------------------------------------------------
30(parted) mkpart
31Partition type?  primary/extended? extended
32Start? 6564MB
33End? -1
34--------------------------------------------------------------------------------------------------------
35Please note that -1 denotes end of the disk for parted.
36
37  d. mkpart (Yes...once again...although answer change this time as shown below)
38--------------------------------------------------------------------------------------------------------
39(parted) mkpart
40Partition type?  [logical]?
41File system type?  [ext2]?
42Start? 6564MB
43End? -1
44(parted)
45--------------------------------------------------------------------------------------------------------
46  e. quit
47  f. fdisk -l -u
48Output would be something like below
49--------------------------------------------------------------------------------------------------------
50[root@node0 yogesh]# fdisk -l -u
51
52Disk /dev/sda: 146.8 GB, 146815733760 bytes
53255 heads, 63 sectors/track, 17849 cylinders, total 286749480 sectors
54Units = sectors of 1 * 512 = 512 bytes
55
56   Device Boot      Start         End      Blocks   Id  System
57/dev/sda1              63     6281414     3140676   a5  FreeBSD
58/dev/sda2   *     6281415    12562829     3140707+  83  Linux
59/dev/sda3        12562830    12819869      128520   82  Linux swap / Solaris
60/dev/sda4        12819870   286749479   136964805    f  W95 Ext'd (LBA)
61/dev/sda5        12819933   286749479   136964773+  83  Linux
62
63Disk /dev/sdb: 146.8 GB, 146815733760 bytes
64255 heads, 63 sectors/track, 17849 cylinders, total 286749480 sectors
65Units = sectors of 1 * 512 = 512 bytes
66
67   Device Boot      Start         End      Blocks   Id  System
68/dev/sdb1              63   286744184   143372061   83  Linux
69[root@node0 yogesh]#
70--------------------------------------------------------------------------------------------------------
71   g. Formate the new partition in ext3 FS. Use command "mkfs -t ext3 new_partition"
72For e.g. in this case:
73[root@node0 yogesh]# mkfs -t ext3 /dev/sda5
74  h. Create a new directory to mount this partition "mkdir /vz"
75  i. Edit /etc/fstab so that this directory will be mounted automatically.
76for example, in this case add following command to /etc/fstab at the end
77
78/dev/sda5 /vz ext3    defaults  0 0
79 
80  j. Mount the new partition using 'mount -a'
81
823. Now install the OpenVZ kernel with EGRE module. Execute following on all four nodes.
83   a. Copy the source code of the kernel to /vz/ using following command.
84      git clone git://143.215.129.52/home/yogesh/git_repository/vn-with-openvz
85      Enter the kernel directory.       
86   b. Compile the kernel using "time make"
87   c. Compile modules using "time make modules"
88   d. Install modules using "time make modules_install"
89   e. Install kernel using "make install"
90   f. To boot using newly installed kernel, modify the "default" entry to new kernel in the file "/boot/grub/grub.conf"
91     (Usually this means changing the "default to 0)
92   g Please make sure the following steps are performed before rebooting into OpenVZ kernel.
93
94     sysctl
95     There are a number of kernel parameters that should be set for OpenVZ to work correctly. These parameters are stored in      /etc/sysctl.conf file. Here are the relevant portions of the file; please edit accordingly.
96--------------------------------------------------------------------------------------------------------
97# On Hardware Node we generally need
98# packet forwarding enabled and proxy arp disabled
99net.ipv4.ip_forward = 1
100net.ipv4.conf.default.proxy_arp = 0
101
102# Enables source route verification
103net.ipv4.conf.all.rp_filter = 1
104
105# Enables the magic-sysrq key
106kernel.sysrq = 1
107
108# We do not want all our interfaces to send redirects
109net.ipv4.conf.default.send_redirects = 1
110net.ipv4.conf.all.send_redirects = 0
111--------------------------------------------------------------------------------------------------------
112
113SELinux
114SELinux should be disabled. To that effect, put the following line to /etc/sysconfig/selinux:
115--------------------------------------------------------------------------------------------------------
116SELINUX=disabled
117--------------------------------------------------------------------------------------------------------
118   h. reboot
119   i. Verify that you are running the new kernel using "uname -a" 
120
1214. Install utilities on all the machines by executing following
122   a. cd /etc/yum.repos.d && wget http://download.openvz.org/openvz.repo && rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ && cd
123   b. yum -y install vzctl vzquota bridge-utils
124   c. service vz start
125   d. yum -y install vzpkg vzyum vzrpm43-python vzrpm44-python vzctl-lib
126   e. yum -y install vztmpl-fedora-core-5
127   f. wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz       
128   g. mv fedora-core-5-i386-minimal.tar.gz /vz/template/cache/fedora-core-5-i386-minimal.tar.gz
129   h. modprobe gre
130   i. In the checked out directory, there is the iproute source package which is required to be installed to create the
131      gre tunnels. Compile it using "make". After compilation enter directory ip by "cd ip/"
132
133Setting up the Virtual network of OpenVZ nodes
134-------------------------------------------------------------------------------------
135
136Execute following on all four nodes
137
1381. vzctl create 101 --ostemplate fedora-core-5-minimal
1392. for CAP in net_admin net_raw sys_admin; do vzctl set 101 --capability ${CAP}:on --save ; done
1403. vzctl start 101
1414. vzyum 101 -y install tcpdump quagga emacs telnet
142
143Node0 - physical machine with 4 interfaces i.e. machine connected to all the others
144-------------------------------------------------------------------------------------
145Execute following commands
146
1471. vzctl set 101 --netif_add eth0,00:43:34:56:78:0A,veth101.0,00:43:34:56:88:0B --save
1482. vzctl set 101 --netif_add eth1,00:43:34:56:78:1A,veth101.1,00:43:34:56:88:1B --save
1493. vzctl set 101 --netif_add eth2,00:43:34:56:78:2A,veth101.2,00:43:34:56:88:2B --save
1504. vzctl enter 101
1515. ifconfig eth0 13.0.0.59/24
1526. ifconfig eth1 11.0.0.53/24
1537. ifconfig eth2 7.0.0.37/24
1548. ifconfig lo up
1554. vzctl exit 101
1569. brctl addbr br0
15710. brctl addbr br1
15811. brctl addbr br2
15912. brctl addif br0 veth101.0
16013. brctl addif br1 veth101.1
16114. brctl addif br2 veth101.2
16215. cd /users/yogesh/iproute-2.6.20-070313/ip/
16316. ./ip tunnel add egre0 mode gre type eth local 10.1.2.2 remote 10.1.2.3 key 5
16417. ./ip tunnel add egre1 mode gre type eth local 10.1.3.2 remote 10.1.3.3 key 6
16518. ./ip tunnel add egre2 mode gre type eth local 10.1.1.2 remote 10.1.1.3 key 7
16619. brctl addif br0 egre0
16720. brctl addif br1 egre1
16821. brctl addif br2 egre2
16922. ./ip link set egre0 up
17023. ./ip link set egre1 up
17124. ./ip link set egre2 up
17225. ifconfig br0 up
17326. ifconfig br1 up
17427. ifconfig br2 up
175
176Node1
177-----
178
1791. vzctl set 101 --netif_add eth0,00:47:34:56:78:0A,veth101.0,00:47:34:56:88:0B --save
1802. vzctl enter 101
1813. ifconfig eth0 13.0.0.57/24
1824. ifconfig lo up
1834. vzctl exit 101
1845. brctl addbr br0
1855. brctl addif br0 veth101.0
1866. cd /users/yogesh/iproute-2.6.20-070313/ip/
1877. ./ip tunnel add egre0 mode gre type eth local 10.1.2.3 remote  10.1.2.2 key 5
1888. brctl addif br0 egre0
1899. ./ip link set egre0 up
19010. ifconfig br0 up
191
192Node2
193-----
194
1951. vzctl set 101 --netif_add eth0,00:53:34:56:78:0A,veth101.0,00:53:34:56:88:0B --save
1962. vzctl enter 101
1973. ifconfig eth0 11.0.0.47/24
1984. ifconfig lo up
1994. vzctl exit 101
2009. brctl addbr br0
20112. brctl addif br0 veth101.0
20215. cd /users/yogesh/iproute-2.6.20-070313/ip/
20317. ./ip tunnel add egre0 mode gre type eth local 10.1.3.3 remote  10.1.3.2 key 6
20419. brctl addif br0 egre0
2059. ./ip link set egre0 up
20610. ifconfig br0 up
207
208
209Node3
210------
211
2121. vzctl set 101 --netif_add eth0,00:53:34:56:78:0A,veth101.0,00:53:34:56:88:0B --save
2132. vzctl enter 101
2143. ifconfig eth0 7.0.0.31/24
2154. ifconfig lo up
2164. exit 101
2179. brctl addbr br0
21812. brctl addif br0 veth101.0
21915. cd /users/yogesh/iproute-2.6.20-070313/ip/
22018. ./ip tunnel add egre0 mode gre type eth local 10.1.1.3 remote  10.1.1.2 key 7
22119. brctl addif br0 egre0
2229. ./ip link set egre0 up
22310. ifconfig br0 up
224
225Now on all the nodes execute following
226-----------------------------------------
227
2280. vzyum 101 install quagga
2291. vzctl enter 101
2302. Add like "password zebra" to file /etc/quagga/zebra.conf
2313. service zebra start
2324. add line "127.0.0.1 localhost" to file /etc/hosts
2335. touch /etc/sysconfig/network
2346. mv /etc/quagga/ospfd.conf.sample /etc/quagga/ospfd.conf
2357. service ospfd start
236
237Node0:
238------
239
2405. enter zebra "telnet localhost 2601"  (password is  zebra as set above)
2416. enable
2427. configure terminal
2438. interface eth0
2449. ip address 13.0.0.59/24
24510. exit
24611. interface eth1
24712. ip address 11.0.0.53/24
24813. exit
24914. interface eth2
25015. ip address 7.0.0.37/24
25116. exit
25217. write memory
25318. exit
25419. exit
25520. telnet localhost 2604
25621. enable
25722. configure terminal
25823. router ospf
25924. network 13.0.0.0/24 area 13
26025. network 11.0.0.0/24 area 11
26126. network 7.0.0.0/24 area 7
26227. write memory
263
264Node1:
265------
266
2675. enter zebra "telnet localhost 2601"
2686. enable
2697. configure terminal
2708. interface eth0
2719. ip address 13.0.0.57/24
27210. exit
27317. write memory
27418. exit
27519. exit
27620. telnet localhost 2604
27721. enable
27822. configure terminal
27923. router ospf
28024. network 13.0.0.0/24 area 13
28125. write memory
282
283Node2:
284------
285
2865. enter zebra "telnet localhost 2601"
2876. enable
2887. configure terminal
2898. interface eth0
2909. ip address 11.0.0.47/24
29110. exit
29217. write memory
29318. exit
29419. exit
29520. telnet localhost 2604
29621. enable
29722. configure terminal
29823. router ospf
29924. network 11.0.0.0/24 area 11
30025. write memory
301
302Node3:
303------
304
3055. enter zebra "telnet localhost 2601"
3066. enable
3077. configure terminal
3088. interface eth0
3099. ip address 7.0.0.31/24
31010. exit
31117. write memory
31218. exit
31319. exit
31420. telnet localhost 2604
31521. enable
31622. configure terminal
31723. router ospf
31824. network 7.0.0.0/24 area 7
31925. write memory