https://wiki.openstack.org/w/api.php?action=feedcontributions&user=Anil.venkata&feedformat=atomOpenStack - User contributions [en]2024-03-29T05:32:37ZUser contributionsMediaWiki 1.28.2https://wiki.openstack.org/w/index.php?title=Neutron/VPNaaS/HowToInstall&diff=78000Neutron/VPNaaS/HowToInstall2015-04-22T09:17:10Z<p>Anil.venkata: /* Installation */</p>
<hr />
<div><br />
== Installation ==<br />
<br />
Devstack patch: https://review.openstack.org/#/c/42265/<br />
<br />
please make sure strongswan isn't installed.<br />
<br />
add this line to the openrc<br />
use devstack using this localrc ( q-vpn is added)<br />
<br />
ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron<br />
<br />
DEST=/opt/stack<br />
disable_service n-net<br />
enable_service tempest<br />
enable_service q-vpn<br />
API_RATE_LIMIT=False<br />
VOLUME_BACKING_FILE_SIZE=4G<br />
VIRT_DRIVER=libvirt<br />
SWIFT_REPLICAS=1<br />
export OS_NO_CACHE=True<br />
SCREEN_LOGDIR=/opt/stack/screen-logs<br />
SYSLOG=True<br />
SKIP_EXERCISES=boot_from_volume,client-env<br />
ROOTSLEEP=0<br />
ACTIVE_TIMEOUT=60<br />
Q_USE_SECGROUP=True<br />
BOOT_TIMEOUT=90<br />
ASSOCIATE_TIMEOUT=60<br />
ADMIN_PASSWORD=openstack<br />
MYSQL_PASSWORD=openstack<br />
RABBIT_PASSWORD=openstack<br />
SERVICE_PASSWORD=openstack<br />
SERVICE_TOKEN=tokentoken<br />
Q_PLUGIN=openvswitch<br />
Q_USE_DEBUG_COMMAND=True<br />
IPSEC_PACKAGE=openswan<br />
<br />
* Checkout Test branches<br />
<br />
Neutron : https://review.openstack.org/#/c/33148/<br />
<br />
Neutron client : https://review.openstack.org/#/c/29811/<br />
<br />
* VPNaaS on Fedora<br />
Fedora/centos uses Libreswan(fork of the Openswan IPSEC VPN) for ipsec openswan. <br />
Libreswan driver support will be added by patch https://review.openstack.org/#/c/174299/ .<br />
Devstack will pick this driver for Fedora with this change https://review.openstack.org/#/c/176192/<br />
If you are not running the devstack, please enable Libreswan driver in vpn_agent.ini<br />
<br />
* Run Devstack<br />
<br />
./stack.sh<br />
<br />
* Install neutron client code (devstack installes package version of clients)<br />
<br />
cd /opt/stack/python-neutronclient<br />
sudo python setup.py develop<br />
<br />
== Quick Test Script ==<br />
<br />
http://paste.openstack.org/raw/44702/<br />
<br />
This quick test script create two site with a router,a network and a subnet connected with<br />
public network. Then, connect both site via VPN.<br />
<br />
== Using Two DevStack Nodes for Testing ==<br />
You can use two DevStack nodes connected by a common "public" network to test VPNaaS. The second node can be set up with the same public network as the first node, except it will use a different gateway IP (and hence router IP). In this example, we'll assume we have two DevStack nodes (East and West), each running on hardware (you can do the same thing with multiple VM guests, if desired).<br />
(Note: you can also create similar topology using two virtual routers with one devstack)<br />
<br />
==== Example Topology ====<br />
A dedicated physical port can be used for the "public" network connection (e.g. eth2) interconnected by a physical switch. You'll need to add the port to the OVS bridge on each DevStack node (e.g. <code>sudo ovs-vsctl add-port br-ex eth2</code>).<br />
<br />
(10.1.0.0/24 - DevStack '''East''')<br />
|<br />
| 10.1.0.1<br />
[Quantum Router]<br />
| 172.24.4.226<br />
|<br />
| 172.24.4.225<br />
[Internet GW]<br />
| <br />
|<br />
[Internet GW]<br />
| 172.24.4.232<br />
|<br />
| 172.24.4.233<br />
[Quantum Router]<br />
| 10.2.0.1<br />
|<br />
(10.2.0.0/24 DevStack '''West''')<br />
<br />
==== DevStack Configuration ====<br />
<br />
For '''East''' you can append these lines to the localrc, which will give you a private net of 10.1.0.0/24 and public network of 172.24.4.0/24<br />
<br />
PUBLIC_SUBNET_NAME=yoursubnet<br />
PRIVATE_SUBNET_NAME=mysubnet<br />
FIXED_RANGE=10.1.0.0/24<br />
NETWORK_GATEWAY=10.1.0.1<br />
PUBLIC_NETWORK_GATEWAY=172.24.4.225<br />
Q_FLOATING_ALLOCATION_POOL=start=172.24.4.226,end=172.24.4.231<br />
<br />
For '''West''' you can add these lines to localrc to use a different local network, public GW (and implicitly router) IP:<br />
PUBLIC_SUBNET_NAME=yoursubnet<br />
PRIVATE_SUBNET_NAME=mysubnet<br />
FIXED_RANGE=10.2.0.0/24<br />
NETWORK_GATEWAY=10.2.0.1<br />
PUBLIC_NETWORK_GATEWAY=172.24.4.232<br />
Q_FLOATING_ALLOCATION_POOL=start=172.24.4.233,end=172.24.4.238<br />
<br />
==== VPNaaS Configuration ====<br />
With DevStack running on East and West and connectivity confirmed (make sure you can ping one router/GW from the other), you can perform these VPNaaS CLI commands.<br />
<br />
On '''East'''<br />
neutron vpn-ikepolicy-create ikepolicy1<br />
neutron vpn-ipsecpolicy-create ipsecpolicy1<br />
neutron vpn-service-create --name myvpn --description "My vpn service" router1 mysubnet<br />
<br />
neutron ipsec-site-connection-create --name vpnconnection1 --vpnservice-id myvpn --ikepolicy-id ikepolicy1 --ipsecpolicy-id ipsecpolicy1 --peer-address 172.24.4.233 --peer-id 172.24.4.233 --peer-cidr 10.2.0.0/24 --psk secret<br />
<br />
On '''West'''<br />
neutron vpn-ikepolicy-create ikepolicy1<br />
neutron vpn-ipsecpolicy-create ipsecpolicy1<br />
neutron vpn-service-create --name myvpn --description "My vpn service" router1 mysubnet<br />
<br />
neutron ipsec-site-connection-create --name vpnconnection1 --vpnservice-id myvpn --ikepolicy-id ikepolicy1 --ipsecpolicy-id ipsecpolicy1 --peer-address 172.24.4.226 --peer-id 172.24.4.226 --peer-cidr 10.1.0.0/24 --psk secret<br />
<br />
Note: Please make sure setup security group (open icmp for vpn subnet etc)<br />
<br />
==== Verification ====<br />
You can spin up VMs on each node, and then from the VM ping the far end router's public IP. With '''tcpdump''' running on one of the nodes, you can see that pings appear as encrypted packets (ESP). Note that BOOTP, IGMP, and the keepalive packets between the two nodes are not encrypted (nor are pings between the two external IP addresses).<br />
<br />
==== Kilo Update ====<br />
For Kilo, the localrc contents was moved into local.conf. With (VirtualBox) VMs used as hosts, where eth0 was set up as NAT, and eth1 set up as Internal Network, the following configurations were used in local.conf:<br />
<br />
OVS_PHYSICAL_BRIDGE=br-ex<br />
PUBLIC_INTERFACE=eth1<br />
<br />
Once stacked, VMs were created for testing, VPN IPSec commands used to establish connections between the nodes, and security group rules added to allow ICMP and SSH.<br />
<br />
== VPNaaS with Single DevStack and Two Routers ==<br />
Simple instructions on how to setup a test environment where a VPNaaS IPSec connection can be established using the reference implementation (OpenSwan). This example uses VIrtualBox running on laptop to provide a VM for running DevStack. It assumes a Kilo release (post Juno).<br />
<br />
The idea here is to have a single OpenStack cloud created using DevStack, two routers (one created automatically), two private networks (one created automatically) -10.1.0.0/24 and 10.2.0.0/24, a VM in each private network, and establish a VPN connection between the two private nets, using the public network (172.24.4.0/24).<br />
<br />
=== Preparation ===<br />
Create a VM (e.g. 7 GB RAM, 2 CPUs) running Ubuntu 14.04, with NAT I/F for access to the Internet. Clone a DevStack repo with latest (Kilo-1 used for this example).<br />
<br />
=== DevStack Configuration ===<br />
For this example, the following local.conf is used:<br />
<br />
[[local|localrc]]<br />
GIT_BASE=https://github.com<br />
DEST=/opt/stack<br />
<br />
disable_service n-net<br />
enable_service q-svc<br />
enable_service q-agt<br />
enable_service q-dhcp<br />
enable_service q-l3<br />
enable_service q-meta<br />
enable_service neutron<br />
enable_service q-vpn<br />
<br />
FIXED_RANGE=10.1.0.0/24<br />
FIXED_NETWORK_SIZE=256<br />
NETWORK_GATEWAY=10.1.0.1<br />
PRIVATE_SUBNET_NAME=privateA<br />
<br />
PUBLIC_SUBNET_NAME=public-subnet<br />
FLOATING_RANGE=172.24.4.0/24<br />
PUBLIC_NETWORK_GATEWAY=172.24.4.10<br />
Q_FLOATING_ALLOCATION_POOL="start=172.24.4.11,end=172.24.4.29"<br />
<br />
LIBVIRT_TYPE=qemu<br />
<br />
IMAGE_URLS="http://cloud-images.ubuntu.com/releases/14.04.1/release/ubuntu-14.04-server-cloudimg-amd64.tar.gz,http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-uec.tar.gz"<br />
<br />
SCREEN_LOGDIR=/opt/stack/screen-logs<br />
SYSLOG=True<br />
LOGFILE=~/devstack/stack.sh.log<br />
<br />
ADMIN_PASSWORD=password<br />
MYSQL_PASSWORD=password<br />
RABBIT_PASSWORD=password<br />
SERVICE_PASSWORD=password<br />
SERVICE_TOKEN=tokentoken<br />
<br />
Q_USE_DEBUG_COMMAND=True<br />
<br />
# RECLONE=No<br />
RECLONE=yes<br />
OFFLINE=False<br />
<br />
Start up the cloud using ./stack.sh and ensure it completes successfully. Once stacked, you can change RECLONE to No.<br />
<br />
=== Cloud Configuration ===<br />
Once stacking is completed, you'll have a private network (10.1.0.0/24), and a router (router1). To prepare for establishing a VPN connection, a second network, subnet, and router needs to be created, and a VM spun up in each private network.<br />
<br />
# Create second net, subnet, router<br />
source ~/devstack/openrc admin demo<br />
neutron net-create privateB<br />
neutron subnet-create --name subB privateB 10.2.0.0/24 --gateway 10.2.0.1<br />
neutron router-create router2<br />
neutron router-interface-add router2 subB<br />
neutron router-gateway-set router2 public<br />
<br />
# Start up a VM in the privateA subnet.<br />
PRIVATE_NET=`neutron net-list | grep 'private ' | cut -f 2 -d' '`<br />
nova boot --flavor 1 --image cirros-0.3.3-x86_64-uec --nic net-id=$PRIVATE_NET peter<br />
<br />
# Start up a VM in the privateB subnet<br />
PRIVATE_NETB=`neutron net-list | grep privateB | cut -f 2 -d' '`<br />
nova boot --flavor 1 --image cirros-0.3.3-x86_64-uec --nic net-id=$PRIVATE_NETB paul<br />
<br />
At this point, you can verify that you have basic connectivity. Note, DevStack will create a static route that will allow you to ping the private I/F IP of router1 from privateB network. You can remove the route, if desired.<br />
<br />
=== IPSec Site-to-site Connection Creation ===<br />
The following commands will create the IPSec connection:<br />
<br />
# Create VPN connections<br />
neutron vpn-ikepolicy-create ikepolicy<br />
neutron vpn-ipsecpolicy-create ipsecpolicy<br />
neutron vpn-service-create --name myvpn --description "My vpn service" router1 privateA<br />
<br />
neutron ipsec-site-connection-create --name vpnconnection1 --vpnservice-id myvpn \<br />
--ikepolicy-id ikepolicy --ipsecpolicy-id ipsecpolicy --peer-address 172.24.4.13 \<br />
--peer-id 172.24.4.13 --peer-cidr 10.2.0.0/24 --psk secret<br />
<br />
neutron vpn-service-create --name myvpnB --description "My vpn serviceB" router2 subB<br />
<br />
neutron ipsec-site-connection-create --name vpnconnection2 --vpnservice-id myvpnB \<br />
--ikepolicy-id ikepolicy --ipsecpolicy-id ipsecpolicy --peer-address 172.24.4.11 \<br />
--peer-id 172.24.4.11 --peer-cidr 10.1.0.0/24 --psk secret<br />
<br />
At this point (once the connections become active - which can take up to 30 seconds or so), you should be able to ping from the VM in the privateA network, to the VM in the privateB network. You'll see encrypted packets, if you tcpdump using the qg-# interface from one of the router namespaces. If you delete one of the connections, you'll see that the pings fail (if all works out correctly :).<br />
<br />
== Horizon Support ==<br />
<br />
<br />
* Checkout Test branch<br />
<br />
Horizon support has been merged.<br />
<br />
* Enable VPN section in Horizon<br />
<br />
Note that ff q-vpn is enabled Horizon VPN support is enabled automatically.<br />
<br />
Open <pre>/opt/stack/horizon/openstack_dashboard/local/local_settings.py</pre><br />
<br />
and replace<br />
<pre><br />
OPENSTACK_NEUTRON_NETWORK = {<br />
'enable_vpn': False,<br />
}<br />
</pre><br />
<br />
with<br />
<pre><br />
OPENSTACK_NEUTRON_NETWORK = {<br />
'enable_vpn': True,<br />
}<br />
</pre><br />
<br />
* Restart Apache to start using<br />
<br />
* Test user scenarios<br />
<br />
https://wiki.openstack.org/wiki/Neutron/VPNaaS/UI</div>Anil.venkata