-
Notifications
You must be signed in to change notification settings - Fork 8
/
install-network-node.sh
executable file
·88 lines (75 loc) · 2.49 KB
/
install-network-node.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
PASSWORD=111111
CONFIG_DIR=network
source networkrc
echo "Start to Install Neutron"
sleep 3
cp /etc/sysctl.conf /etc/sysctl.conf~
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter=0" >> /etc/sysctl.conf
sysctl -p
apt-get install -y neutron-plugin-ml2 neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent
mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf~
cp $CONFIG_DIR/neutron/neutron.conf /etc/neutron
sed -i "s/111111/$PASSWORD/g" /etc/neutron/neutron.conf
mv /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini~
cp $CONFIG_DIR/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2
mv /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini~
cp $CONFIG_DIR/neutron/l3_agent.ini /etc/neutron
mv /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini~
cp $CONFIG_DIR/neutron/dhcp_agent.ini /etc/neutron
cp $CONFIG_DIR/neutron/dnsmasq-neutron.conf /etc/neutron
pkill dnsmasq
mv /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini~
cp $CONFIG_DIR/neutron/metadata_agent.ini /etc/neutron/
sed -i "s/111111/$PASSWORD/g" /etc/neutron/metadata_agent.ini
cp /etc/network/interfaces /etc/network/interfaces~~
cat << EOF > /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
## External net
auto br-ex
iface br-ex inet static
address $EXT_NET_ADDRESS
netmask $EXT_NET_NETMASK
gateway $EXT_NET_GATEWAY
dns-nameservers 8.8.8.8
## External net
auto $EXT_NET_INTF_NAME
iface $EXT_NET_INTF_NAME inet manual
up ifconfig \$IFACE 0.0.0.0 up
up ip link set \$IFACE promisc on
down ip link set \$IFACE promisc off
down ifconfig \$IFACE down
## Management net
auto $MGNT_NET_INTF_NAME
iface $MGNT_NET_INTF_NAME inet static
address $MGNT_NET_ADDRESS
netmask $MGNT_NET_NETMASK
## VM Data net
auto $VM_NET_INTF_NAME
iface $VM_NET_INTF_NAME inet static
address $VM_NET_ADDRESS
netmask $VM_NET_NETMASK
EOF
service openvswitch-switch restart
sleep 3
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex $EXT_NET_INTF_NAME
ethtool -K $EXT_NET_INTF_NAME gro off
ifdown br-ex && ifup br-ex && ifdown $EXT_NET_INTF_NAME && ifup $EXT_NET_INTF_NAME
service neutron-plugin-openvswitch-agent restart
sleep 3
service neutron-l3-agent restart
sleep 3
service neutron-dhcp-agent restart
sleep 3
service neutron-metadata-agent restart
sleep 3
exit 0