Проект

Общее

Профиль

Network setup » История » Версия 1

Dmitry Chernyak, 05.02.2013 11:24

1 1 Dmitry Chernyak
h1. Network setup
2 1 Dmitry Chernyak
3 1 Dmitry Chernyak
{{toc}}
4 1 Dmitry Chernyak
5 1 Dmitry Chernyak
Back to [[SETUP]] page.
6 1 Dmitry Chernyak
7 1 Dmitry Chernyak
Network configuration may be highly various.
8 1 Dmitry Chernyak
9 1 Dmitry Chernyak
h2. Basic schema - one ethernet to all.
10 1 Dmitry Chernyak
11 1 Dmitry Chernyak
One ethernet, one subnet, internet connection provided by external (not in claster) router.
12 1 Dmitry Chernyak
By default installer create bridge named xen-br0. You can customize parameters by editing /etc/network/interfaces.
13 1 Dmitry Chernyak
In this case you must have nodes connected to gigabit ethernet switch.
14 1 Dmitry Chernyak
By default it looks like:
15 1 Dmitry Chernyak
<pre>
16 1 Dmitry Chernyak
auto xen-br0
17 1 Dmitry Chernyak
iface xen-br0 inet static
18 1 Dmitry Chernyak
        address 192.168.5.88
19 1 Dmitry Chernyak
        netmask 255.255.255.0
20 1 Dmitry Chernyak
        network 192.168.5.0
21 1 Dmitry Chernyak
        broadcast 192.168.5.255
22 1 Dmitry Chernyak
        gateway 192.168.5.1
23 1 Dmitry Chernyak
        bridge_ports eth0
24 1 Dmitry Chernyak
        bridge_stp off
25 1 Dmitry Chernyak
        bridge_fd 0
26 1 Dmitry Chernyak
#       up ifconfig eth0 mtu 9000
27 1 Dmitry Chernyak
#       up ifconfig xen-br0 mtu 9000
28 1 Dmitry Chernyak
</pre>
29 1 Dmitry Chernyak
Important parameters besides ipv4 settings is:
30 1 Dmitry Chernyak
<pre>
31 1 Dmitry Chernyak
bridge_ports eth0
32 1 Dmitry Chernyak
</pre>
33 1 Dmitry Chernyak
34 1 Dmitry Chernyak
- means that physical interface eth0 enslaved to this bridge.
35 1 Dmitry Chernyak
36 1 Dmitry Chernyak
<pre>
37 1 Dmitry Chernyak
up ifconfig eth0 mtu 9000
38 1 Dmitry Chernyak
up ifconfig xen-br0 mtu 9000
39 1 Dmitry Chernyak
</pre>
40 1 Dmitry Chernyak
41 1 Dmitry Chernyak
- setting jumbo frame on bridge for more network speed and less cpu utilization.
42 1 Dmitry Chernyak
It will be actual on interface where drbd link will be.
43 1 Dmitry Chernyak
However, setting mtu higher than 1500 will cause problems with any network equipment that
44 1 Dmitry Chernyak
doesn't support jumbo frames. That's the reason because it option commented out by default.
45 1 Dmitry Chernyak
46 1 Dmitry Chernyak
h2. Default schema - two ethernets, one for interlink(ganeti interoperation+drbd link) and one for lan.
47 1 Dmitry Chernyak
48 1 Dmitry Chernyak
This schema suits most cases. It doesn't required a gigabit switch, provide good performance and reliability.
49 1 Dmitry Chernyak
Two gigabit network interfaces on the nodes are connected directly or via a gigabit
50 1 Dmitry Chernyak
switch (if you want more than two nodes in the cluster).
51 1 Dmitry Chernyak
Other interfaces connected to lan.
52 1 Dmitry Chernyak
Lan failure doesn't affect cluster in this setup.
53 1 Dmitry Chernyak
This is /etc/network/interfaces file for this setup:
54 1 Dmitry Chernyak
<pre>auto xen-br0
55 1 Dmitry Chernyak
iface xen-br0 inet static
56 1 Dmitry Chernyak
	address 192.168.236.1
57 1 Dmitry Chernyak
	netmask 255.255.255.0
58 1 Dmitry Chernyak
	network 192.168.236.0
59 1 Dmitry Chernyak
	broadcast 192.168.236.255
60 1 Dmitry Chernyak
        bridge_ports eth0
61 1 Dmitry Chernyak
        bridge_stp off
62 1 Dmitry Chernyak
        bridge_fd 0
63 1 Dmitry Chernyak
#	up ifconfig eth0 mtu 9000
64 1 Dmitry Chernyak
#	up ifconfig xen-br0 mtu 9000
65 1 Dmitry Chernyak
66 1 Dmitry Chernyak
auto xen-lan
67 1 Dmitry Chernyak
iface xen-lan inet static
68 1 Dmitry Chernyak
	address 192.168.5.55
69 1 Dmitry Chernyak
	netmask 255.255.255.0
70 1 Dmitry Chernyak
	network 192.168.5.0
71 1 Dmitry Chernyak
	broadcast 192.168.5.255
72 1 Dmitry Chernyak
	gateway 192.168.5.1
73 1 Dmitry Chernyak
	bridge_ports eth1
74 1 Dmitry Chernyak
	bridge_stp off
75 1 Dmitry Chernyak
	bridge_fd 0
76 1 Dmitry Chernyak
</pre>
77 1 Dmitry Chernyak
78 1 Dmitry Chernyak
xen-br0 used by ganeti interoperation and drbd link, it was configured by the installer.
79 1 Dmitry Chernyak
Also the dns server and the gateway was configured by the installer - it will be our service instance(sci) address.
80 1 Dmitry Chernyak
xen-lan used by lan connection, its configuration must be added by hands.
81 1 Dmitry Chernyak
In this network configuration you must fill these variables in sci.conf:
82 1 Dmitry Chernyak
NODE1_IP - already configured by installer.
83 1 Dmitry Chernyak
NODE1_NAME - already configured by installer.
84 1 Dmitry Chernyak
NODE2_IP - set interlink ip address of second node. e.g. 192.168.236.2
85 1 Dmitry Chernyak
NODE2_NAME - set second node name. e.g. gnt2
86 1 Dmitry Chernyak
NODE1_LAN_IP - lan ip for first node. It will be available by dns name $NODE1_NAME-lan. 192.168.5.55
87 1 Dmitry Chernyak
NODE2_LAN_IP - lan ip for second node. It will be available by dns name $NODE2_NAME-lan. e.g. 192.168.5.58
88 1 Dmitry Chernyak
CLUSTER_IP - cluster address in lan. Must not match any exist host address in lan. 192.168.5.35
89 1 Dmitry Chernyak
CLUSTER_NAME - cluster name in lan. In will be available by dns name $CLUSTER_NAME.
90 1 Dmitry Chernyak
SCI_LAN_IP - if you want presence sci intance in your lan, assign ip. e.g. 192.168.5.59
91 1 Dmitry Chernyak
92 1 Dmitry Chernyak
h2. Mupltiple bridges with routing, firewalling and wan access.
93 1 Dmitry Chernyak
94 1 Dmitry Chernyak
Here is a bit more complicated network setup.
95 1 Dmitry Chernyak
In this setup we have, for example, two private netwokrs and wan by ethernet. All routing and firewalling
96 1 Dmitry Chernyak
performed by separate firewall instance in our cluster. This setup fit when you don't have expensive hardware routers and firewalls.
97 1 Dmitry Chernyak
This is /etc/network/interfaces file in this setup:
98 1 Dmitry Chernyak
<pre>
99 1 Dmitry Chernyak
auto lan
100 1 Dmitry Chernyak
iface lan inet static
101 1 Dmitry Chernyak
	address 192.168.21.10
102 1 Dmitry Chernyak
	netmask 255.255.255.0
103 1 Dmitry Chernyak
        bridge_ports eth0
104 1 Dmitry Chernyak
        bridge_stp off
105 1 Dmitry Chernyak
        bridge_fd 0
106 1 Dmitry Chernyak
107 1 Dmitry Chernyak
auto server
108 1 Dmitry Chernyak
iface server inet static
109 1 Dmitry Chernyak
	address 192.168.20.10
110 1 Dmitry Chernyak
	netmask 255.255.255.0
111 1 Dmitry Chernyak
	gateway 192.168.20.1
112 1 Dmitry Chernyak
        bridge_ports eth1
113 1 Dmitry Chernyak
        bridge_stp off
114 1 Dmitry Chernyak
        bridge_fd 0
115 1 Dmitry Chernyak
        up ifconfig eth1 mtu 9000
116 1 Dmitry Chernyak
        up ifconfig dmz mtu 9000
117 1 Dmitry Chernyak
118 1 Dmitry Chernyak
auto wan1
119 1 Dmitry Chernyak
iface wan1 inet manual
120 1 Dmitry Chernyak
        bridge_ports eth2
121 1 Dmitry Chernyak
        bridge_stp off
122 1 Dmitry Chernyak
        bridge_fd 0
123 1 Dmitry Chernyak
</pre>
124 1 Dmitry Chernyak
In this example we have separate lan interfaces, server interface(in this case servers separated from lan and
125 1 Dmitry Chernyak
clients go to servers thru router) and wan interface. server interface - ganeti interoperation dev and drbd link
126 1 Dmitry Chernyak
interfase, so there is mtu 9000.
127 1 Dmitry Chernyak
There is no address in wan for hypervisor, although we recommend you to get subnet from
128 1 Dmitry Chernyak
your ISP in order to assign IP addresses to nodes to management it even if router instance
129 1 Dmitry Chernyak
is down.
130 1 Dmitry Chernyak
In this network configuration you must fill these variables in sci.conf:
131 1 Dmitry Chernyak
NODE1_IP - already configured by installer.
132 1 Dmitry Chernyak
NODE1_NAME - already configured by installer.
133 1 Dmitry Chernyak
NODE2_IP - set interlink ip address of second node. e.g. 192.168.20.2
134 1 Dmitry Chernyak
NODE2_NAME - set second node name. e.g. gnt2
135 1 Dmitry Chernyak
NODE1_LAN_IP - lan ip for first node. It will be available by dns name $NODE1_NAME-lan. 192.168.21.55
136 1 Dmitry Chernyak
NODE2_LAN_IP - lan ip for second node. It will be available by dns name $NODE2_NAME-lan. e.g. 192.168.21.58
137 1 Dmitry Chernyak
CLUSTER_IP - cluster address in lan. Must not match any exist host address in lan. 192.168.21.35
138 1 Dmitry Chernyak
CLUSTER_NAME - cluster name in lan. In will be available by dns name $CLUSTER_NAME.
139 1 Dmitry Chernyak
SCI_LAN_IP - if you want presence sci intance in your lan, assign ip. e.g. 192.168.21.59
140 1 Dmitry Chernyak
141 1 Dmitry Chernyak
Here is an example /etc/network/interfaces in router instance:
142 1 Dmitry Chernyak
<pre>
143 1 Dmitry Chernyak
auto eth0
144 1 Dmitry Chernyak
iface eth0 inet static
145 1 Dmitry Chernyak
   address 192.168.20.1
146 1 Dmitry Chernyak
   netmask 255.255.255.0
147 1 Dmitry Chernyak
148 1 Dmitry Chernyak
auto eth1
149 1 Dmitry Chernyak
iface eth1 inet static
150 1 Dmitry Chernyak
   address 192.168.21.1
151 1 Dmitry Chernyak
   netmask 255.255.255.0
152 1 Dmitry Chernyak
153 1 Dmitry Chernyak
auto eth2
154 1 Dmitry Chernyak
iface eth2 inet static
155 1 Dmitry Chernyak
   address 1.1.1.2
156 1 Dmitry Chernyak
   netmask 255.255.255.0
157 1 Dmitry Chernyak
   address 1.1.1.1
158 1 Dmitry Chernyak
</pre>
159 1 Dmitry Chernyak
Where eth0 linked to bridge server, eth1 linked to lan, eth2 linked to wan.
160 1 Dmitry Chernyak
161 1 Dmitry Chernyak
h2. Datacenter schema - separate interfaces for lan, ganeti interoperation, drbd link.
162 1 Dmitry Chernyak
163 1 Dmitry Chernyak
If you have powerful networking infrastructure
164 1 Dmitry Chernyak
Here we have separate interfaces for ganeti interoperation(in this case it may be named management interface)
165 1 Dmitry Chernyak
<pre>auto mgmt
166 1 Dmitry Chernyak
iface mgmt inet static
167 1 Dmitry Chernyak
    address 192.168.236.1
168 1 Dmitry Chernyak
    netmask 255.255.255.0
169 1 Dmitry Chernyak
    network 192.168.236.0
170 1 Dmitry Chernyak
    gateway 192.168.236.1
171 1 Dmitry Chernyak
    broadcast 192.168.236.255
172 1 Dmitry Chernyak
        bridge_ports eth0
173 1 Dmitry Chernyak
        bridge_stp off
174 1 Dmitry Chernyak
        bridge_fd 0
175 1 Dmitry Chernyak
176 1 Dmitry Chernyak
auto xen-san
177 1 Dmitry Chernyak
iface xen-san inet static
178 1 Dmitry Chernyak
    address 192.168.237.1
179 1 Dmitry Chernyak
    netmask 255.255.255.0
180 1 Dmitry Chernyak
    network 192.168.237.0
181 1 Dmitry Chernyak
    broadcast 192.168.237.255
182 1 Dmitry Chernyak
    bridge_ports eth1
183 1 Dmitry Chernyak
    bridge_stp off
184 1 Dmitry Chernyak
    bridge_fd 0
185 1 Dmitry Chernyak
    up ifconfig eth1 mtu 9000
186 1 Dmitry Chernyak
    up ifconfig xen-san mtu 9000
187 1 Dmitry Chernyak
188 1 Dmitry Chernyak
auto xen-lan
189 1 Dmitry Chernyak
iface xen-lan inet manual
190 1 Dmitry Chernyak
    bridge_ports eth2
191 1 Dmitry Chernyak
    bridge_stp off
192 1 Dmitry Chernyak
    bridge_fd 0
193 1 Dmitry Chernyak
</pre>
194 1 Dmitry Chernyak
195 1 Dmitry Chernyak
In this example nodes don't have addresses in lan.
196 1 Dmitry Chernyak
You must fill these vars in sci.conf to create cluster fits this network config:
197 1 Dmitry Chernyak
NODE1_IP - already configured by installer.
198 1 Dmitry Chernyak
NODE1_NAME - already configured by installer.
199 1 Dmitry Chernyak
NODE2_IP - set interlink ip address of second node. e.g. 192.168.236.2
200 1 Dmitry Chernyak
NODE2_NAME - set second node name. e.g. gnt2
201 1 Dmitry Chernyak
NODE1_SAN_IP - lan ip for first node. It will be available by dns name $NODE1_NAME-san. 192.168.237.1
202 1 Dmitry Chernyak
NODE2_SAN_IP - lan ip for second node. It will be available by dns name $NODE2_NAME-san. e.g. 192.168.237.2
203 1 Dmitry Chernyak
CLUSTER_IP - cluster address in lan. Must not match any exist host address in lan. 192.168.236.35
204 1 Dmitry Chernyak
CLUSTER_NAME - cluster name in lan. In will be available by dns name $CLUSTER_NAME.
205 1 Dmitry Chernyak
SCI_LAN_IP - if you want presence sci intance in your lan, assign ip. e.g. 192.168.35.5
206 1 Dmitry Chernyak
SCI_LAN_NETMASK - your nodes don't have addresses in lan, so you must enter netmask for this segment by hand. e.g. 255.255.255.0
207 1 Dmitry Chernyak
SCI_LAN_GATEWAY - your nodes don't have addresses in lan, so you must enter gateway for this segment by hand. e.g. 192.168.35.1
208 1 Dmitry Chernyak
Of course, it is easy to use VLANS in datacenter conditions. Next example will explain how. However, remember it is recommended
209 1 Dmitry Chernyak
that drbd link must be on separate ethernet.
210 1 Dmitry Chernyak
211 1 Dmitry Chernyak
212 1 Dmitry Chernyak
h2. VLAN schema
213 1 Dmitry Chernyak
214 1 Dmitry Chernyak
If you have managed switches, you can set networking with VLANs.
215 1 Dmitry Chernyak
You should add something like this for each VLAN:
216 1 Dmitry Chernyak
<pre>
217 1 Dmitry Chernyak
auto eth0.55
218 1 Dmitry Chernyak
iface eth0.55 inet manual
219 1 Dmitry Chernyak
        up ifconfig eth0.55 up
220 1 Dmitry Chernyak
221 1 Dmitry Chernyak
auto bridge-example-vlan
222 1 Dmitry Chernyak
iface bridge-example-vlan inet manual
223 1 Dmitry Chernyak
        up brctl addbr bridge-example-vlan
224 1 Dmitry Chernyak
        up brctl addif bridge-example-vlan eth0.55
225 1 Dmitry Chernyak
        up brctl stp bridge-example-vlan off
226 1 Dmitry Chernyak
        up ifconfig bridge-example-vlan up
227 1 Dmitry Chernyak
        down ifconfig bridge-example-vlan down
228 1 Dmitry Chernyak
        down brctl delbr bridge-example-vlan
229 1 Dmitry Chernyak
</pre>
230 1 Dmitry Chernyak
Where 55 - VLAN number.
231 1 Dmitry Chernyak
In this example node don't have an ip address in this VLAN, although you could
232 1 Dmitry Chernyak
assign an ip to bridge just like standard bridge.
233 1 Dmitry Chernyak
234 1 Dmitry Chernyak
Alternative schema is:
235 1 Dmitry Chernyak
<pre>
236 1 Dmitry Chernyak
auto vlan55
237 1 Dmitry Chernyak
iface vlan55 inet manual
238 1 Dmitry Chernyak
   vlan_raw_device eth0
239 1 Dmitry Chernyak
240 1 Dmitry Chernyak
auto bridge-example-vlan
241 1 Dmitry Chernyak
iface bridge-example-vlan inet manual
242 1 Dmitry Chernyak
           bridge_ports vlan55
243 1 Dmitry Chernyak
        bridge_stp off
244 1 Dmitry Chernyak
        bridge_fd 0
245 1 Dmitry Chernyak
</pre>
246 1 Dmitry Chernyak
It do the same, but in another way.