Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ floating IP in OpenStack neutron     - OpenSSL Introduction and compilation steps on Windows, Linux, Mac systems (Linux)

- Android first line of code study notes (Programming)

- Do not find ifconfig eth0 and IP address under CentOS6.5 (Linux)

- Linux install Maven and SVN client (Linux)

- Debian 8.1 (amd64) deployed Memcached (Server)

- Linux Kernel 4.2 Installation Instructions (Linux)

- How to Install Linux kernel 4.0 on Ubuntu / CentOS (Linux)

- How VirtualBox and VMware virtual machine conversion (Linux)

- Android Studio Personalization (Linux)

- GROUP BY extension (Database)

- DELL D630 Wireless LAN Driver Installation CentOS6 (Linux)

- To configure linux transparent firewall (Linux)

- CentOS 6/7 Series Docker Installation (Linux)

- Linux Tutorial Share: How to sudo command to define the PATH environment variable (Linux)

- lolcat: an output terminal rainbow effects in the Linux command-line tool (Linux)

- Hadoop vs spark (Server)

- Java regular expressions examples (Programming)

- Detailed usage history command (Linux)

- Ubuntu 14.04 build Android 5.1 development environment and compiler (Linux)

- Vagrant failed to start, stuck in Waiting for VM to boot solution (Linux)

 
         
  floating IP in OpenStack neutron
     
  Add Date : 2018-11-21      
         
       
         
  Foreword

Floating IP Fixed IP is relative terms, it is generally created in the VM assigned to the VM, you can achieve the purpose is, the outside world can be accessed through this Floating Ip access the VM, VM can also access the IP outside.

In OpenStack, this Floating IP using iptables namespace within the established NAT forwarding mechanism to achieve the VM to communicate with the outside world. This article focuses on how to use OpenStack to build and use Floating IP.

Environment Setup
 Ubuntu 14.04 LTS
2 card, namely eth0 (192.168.1.46) and eth1 (192.168.2.46, use this interface in the switch vlanid = 100)
If your machine is VM, please refer http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004099, to open eth0 and eth1 of promisic mode, this step is critical, if is not enabled, the outside world is unable to ping the VM assigned to the Floating IP
Devstack Configuration
Enable Nova, Neutron, Cinder, Keystone, Glance
Installation OpenvSwitch, then do the following configuration
 
# Add eth1 into br-eth1 and set eth0 and eth1 to promisc mode
sudo ovs-vsctl br-exists br-eth1 || sudo ovs-vsctl add-br br-eth1
sudo ovs-vsctl --may-exist add-port br-eth1 eth1
sudo ip link set dev eth1 promisc on
sudo ip link set dev eth0 promisc on
sudo ip addr flush eth1
sudo ip link set dev eth1 up
Devstack local.conf
# Note: please change XX to your devstack node IP, change VLAN_START and VLAN_END to your reserved vlan range Here
# My IP is 192.168.1.46, where the network is 192.168.1.0/24
[[Local | localrc]]
# Set API endpoint host using HOST_IP
HOST_IP = XX
# Use to specify the endpoint
SERVICE_HOST = XX

ADMIN_PASSWORD = welcome
MYSQL_PASSWORD = welcome
RABBIT_PASSWORD = welcome
SERVICE_PASSWORD = welcome
SERVICE_TOKEN = welcome
disable_service h-eng
disable_service h-api
disable_service h-api-cfn
disable_service h-api-cw
disable_service tempest
#enable_service tempest
disable_service dstat
# Enable Neturon
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron

# Stack.sh will freshen each repo on each run if RECLONE
# Is set to yes
RECLONE = True

# Setting OFFLINE = True to enable stack.sh to run multiple
# Times without an Internet connection
OFFLINE = False

# Set FLAT_INTERFACE to the Ethernet interface that connects
# The host to your local network
FLAT_INTERFACE = eth1
# FLOATING_RANGE = 192.168.1.0 / 24
# Q_FLOATING_ALLOCATION_POOL = start = 192.168.1.100, end = 192.168.1.119
# PUBLIC_NETWORK_GATEWAY = 192.168.1.30
PUBLIC_INTERFACE = eth0
PHYSICAL_NETWORK = public_eth1
OVS_PHYSICAL_BRIDGE = br-ex
# PUBLIC_BRIDGE = br-ex

FIXED_RANGE = 192.168.100.0 / 24
# FIXED_NETWORK_SIZE = 32
NETWORK_GATEWAY = 192.168.100.1


# IMAGE_URLS accepts a comma separated list of images to pre-load into OpenStack
IMAGE_URLS = http: //download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
[[Post-config | $ NOVA_CONF]]
[DEFAULT]
rpc_response_timeout = 300
service_down_time = 300
libvirt_iscsi_use_multipath = True
#force_config_drive = False

[Libvirt]
iscsi_use_multipath = True

[Database]
max_pool_size = 40
max_overflow = 60

[[Post-config | / $ Q_PLUGIN_CONF_FILE]]
[Ml2]
tenant_network_types = vlan, flat
[Ml2_type_flat]
flat_networks = public_eth0
[Ml2_type_vlan]
network_vlan_ranges = public_eth1: VLAN_START: VLAN_END

[Ovs]
bridge_mappings = public_eth0: br-ex, public_eth1: br-eth1
enable_tunneling = False
Setup flat and vlan network
Next, I need to do two things, one is to create a VLAN ID of the private network 100, after the virtual machine from the default network IP assignments.
Then the flat of a public network, this network is used to assign floating IP
Create a private network, VLAN ID 100

Copy the code
stack @ openstack-wangp11-01: ~ / devstack $ neutron net-create --provider: network_type vlan --provider: physical_network public_eth1 --provider: segmentation_id 100 vlan_100
stack @ openstack-wangp11-01: ~ / devstack $ neutron net-show vlan_100
+ --------------------------- + --------------------- ----------------- +
| Field | Value |
+ --------------------------- + --------------------- ----------------- +
| Admin_state_up | True |
| Id | 2426ff0d-953f-467f-a564-c4f63d926836 |
| Mtu | 0 |
| Name | vlan_100 |
| Port_security_enabled | True |
| Provider: network_type | vlan |
| Provider: physical_network | public_eth1 |
| Provider: segmentation_id | 100 |
| Router: external | False |
| Shared | False |
| Status | ACTIVE |
| Subnets | fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f |
| Tenant_id | 8cb8c084ffb84914b41d5044ecbcad4e |
+ --------------------------- + --------------------- ----------------- +
stack @ openstack-wangp11-01: ~ / devstack $ neutron subnet-create --enable-dhcp --ip-version 4 --name vlan_100_subnet01 2426ff0d-953f-467f-a564-c4f63d926836 192.168.46.0/24
stack @ openstack-wangp11-01: ~ / devstack $ neutron subnet-show fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f
+ ------------------- + ----------------------------- ----------------------- +
| Field | Value |
+ ------------------- + ----------------------------- ----------------------- +
| Allocation_pools | { "start": "192.168.46.2", "end": "192.168.46.254"} |
| Cidr | 192.168.46.0/24 |
| Dns_nameservers | |
| Enable_dhcp | True |
| Gateway_ip | 192.168.46.1 |
| Host_routes | |
| Id | fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f |
| Ip_version | 4 |
| Ipv6_address_mode | |
| Ipv6_ra_mode | |
| Name | vlan_100_subnet01 |
| Network_id | 2426ff0d-953f-467f-a564-c4f63d926836 |
| Subnetpool_id | |
| Tenant_id | 8cb8c084ffb84914b41d5044ecbcad4e |
+ ------------------- + ----------------------------- ----------------------- +
Next, create a Floating IP where the public network, the network type is flat

Note the following: 192.168.1.100-192.168.1.119 network administrator assigned to me IP pool, 192.168.1.30 is the router ip of our network

# Step 1: create external flat network
$ Neutron net-create --router: external --provider: network_type flat --provider: physical_network public_eth0 public_net
# Step 2: create subnet based on your reservation Here
$ Neutron subnet-create --name public_eth0_subnet01 --allocation-pool start = 192.168.1.100, end = 192.168.1.119 --gateway 192.168.1.30 --disable-dhcp --ip-version 4 22d01ce7-b4c4-4af2-bc3c -9c3991903b4c 192.168.1.0/24
# Step 3: create a external router
$ Neutron router-create router1
# Step 4: connect router1 with the private subnet via 'neutron router-interface-add '
$ Neutron router-interface-add 2da62299-6e41-4b24-a1c7-a3d6cc4db1c8 fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f
# Step 5: Set the external public network as the router gateway 'neutron router-gateway-set '
$ Neutron router-gateway-set 73a38db4-20f9-49ba-b855-472be1e2fd45 e0368da6-197e-4c46-bfd1-4897d61b519a
# Step 6: Create floating IP from public network 'neutron floatingip-create '
$ Neutron floatingip-create 1452712a-acb3-4341-a5ca-1d838eb2feb9
# Step 7: assicate the VM instance's port in private network to the newly created floating ip port
## Get the port id of floating IP (in bold)
$ Stack @ openstack-wangp11-01: ~ $ neutron floatingip-list
+ -------------------------------------- + ---------- ------------------- --------------------- + -------- + ------------------- +
| Id | fixed_ip_address | floating_ip_address | port_id |
+ -------------------------------------- + ---------- ------------------- --------------------- + -------- + ------------------- +
| A2316e0b-6d72-420f-8a23-f8421160d3d4 | | 192.168.1.102 | 75353e16-5a16-452e-b420-0ada719d625c |
+ -------------------------------------- + ---------- ------------------- --------------------- + -------- + ------------------- +
## Get the port id of private interface attached to VM instance
$ Stack @ openstack-wangp11-01: ~ $ neutron port-list
+ -------------------------------------- + ------ + --- ---------------- + --------------------------------- -------------------------------------------------- --- +
| Id | name | mac_address | fixed_ips |
+ -------------------------------------- + ------ + --- ---------------- + --------------------------------- -------------------------------------------------- --- +
| 16a3e39c-48ef-4d4d-bc8a-96b27da7ff3c | | fa: 16: 3e: c1: 24: 51 | { "subnet_id": "e0368da6-197e-4c46-bfd1-4897d61b519a", "ip_address": "192.168.1.100" } |
| 616d03cd-df6a-465f-a23a-b6bf46e55f7a | | fa: 16: 3e: 48: 2e: 7f | { "subnet_id": "fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f", "ip_address": "192.168.46.4" } |
| 713e4541-7d22-4403-b828-94d714d94ec0 | | fa: 16: 3e: af: 43: 7b | { "subnet_id": "fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f", "ip_address": "192.168.46.2" } |
| 75353e16-5a16-452e-b420-0ada719d625c | | fa: 16: 3e: 23: 11: db | { "subnet_id": "fab94e2f-f7de-4bf6-8e9b-7ade0fcfad1f", "ip_address": "192.168.46.3" }
# Red above the port is in the private network of VM interface
$ Stack @ openstack-wangp11-01: ~ $ neutron floatingip-associate a2316e0b-6d72-420f-8a23-f8421160d3d4 75353e16-5a16-452e-b420-0ada719d625c
# Now you can use '192.168.1.102' to login to the VM instance from 192.168.1.XX network
I mentioned at the top, the Floating IP iptables rules by implemented within the namespace, how to view it? Here is an example of the neutron node, 192.168.1.102 is Floating IP, 192.168.46.3 is private IP

ip netns exec qrouter- iptables -t nat -S

-A Quantum-l3-agent-OUTPUT -d 192.168.1.102/32 -j DNAT --to-destination 192.168.46.3
-A Quantum-l3-agent-PREROUTING -d 192.168.1.102/32 -j DNAT --to-destination 192.168.46.3
-A Quantum-l3-agent-float-snat -s 192.168.46.3/32 -j SNAT --to-source 192.168.1.102
Enable nameserver
Now, VM with the outside world can communicate through 192.168.1.102, and the outside, VM's Ip is 192.168.1.102, but there is a problem and can not access the site can not sudo apt-get update

You must enable the nameserver can access outside URLs

# Add following to /etc/resolv.conf of the VM instance to enable name service
 
nameserver
nameserver

#and run following to enable
sudo resolvconf -u
Problem Diagnosis
     
         
       
         
  More:      
 
- iptraf: A Practical TCP / UDP network monitoring tools (Linux)
- MySQL various log summary (Database)
- Create and modify Oracle temporary table space (Database)
- Using VMware vSphere Client Linux virtual machine installation CentOS6.4 system (Linux)
- Windows 7 hard disk installation notes Debian (Linux)
- Help you to see Linux system architecture type 5 Common Commands (Linux)
- Configuration based on open source Lucene Java development environment (Server)
- Android Fragment everything you need to know (Programming)
- Upgrade Goldengate 11.1.1.1.2 to 11.2.1.0.1 (Database)
- Install Kali Linux via PXE network (Linux)
- Ubuntu program using the Sound Recorder (Linux)
- Linux NFS FTP use (Server)
- Ubuntu mysql stop fail to solve the problem (Database)
- Oracle database on the hit rate of query summary (Database)
- SUSE Firewall Configuration (Linux)
- Understanding Linux firewall Iptables (Linux)
- Installation and use the telnet command under CentOS 6.x (Linux)
- Oracle SDE and maintain common commands - Display space (Database)
- SELinux multi-level security (Linux)
- Oracle set the timer task JOB scheduler to execute stored procedures or PL / SQL code block (Database)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.