Ask Your Question
1

How to configure multiple Floating IP for one instance?

asked 2014-02-13 03:53:55 -0500

Bing Wang gravatar image

updated 2014-02-13 07:38:39 -0500

darragh-oreilly gravatar image

I am running OpenStack havana on Ubuntu 12.04 LTS. This is a single node installation running with neutron. I would like to setup another Floating IP pool. I follow this guide : link text

I have three physics network, two external networks(eth1:br-ex,eth2:br-ex2) and one data network for network-node and compute-node(eth3:br-data).

step 1: create two neutron internal net on br-data and one neutron external net (for floating IP pool) on each external network.

step 2: create an instance with two net, and it create two interface.

step 3: connect to the vm, the eth0 and eth1 is configured auto. I follow the note in this guide: link text

step 4: create a floating ip from the pool of each external net. Two floating ip was attached to the instance ports.

My problem is the floating ip of first port in instance is enable, the second is disable, like:

root@node4:/# ping 10.141.127.106
PING 10.141.127.106 (10.141.127.106) 56(84) bytes of data.
64 bytes from 10.141.127.106: icmp_req=1 ttl=63 time=1.16 ms
64 bytes from 10.141.127.106: icmp_req=2 ttl=63 time=0.270 ms

root@node4:/# ping 10.0.0.11
PING 10.0.0.11 (10.0.0.11) 56(84) bytes of data.
^C
--- 10.0.0.11 ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 6999ms

infomation:
+--------------------------------------+----------+------------------------------------------------------+
| id                                   | name     | subnets                                              |
+--------------------------------------+----------+------------------------------------------------------+
| 9b5f614c-f542-4cce-a0cc-bf4b38ff0213 | net02    | 7a711c7d-94d3-40e6-a9dd-1c39970c7070 80.168.1.0/24   |
| bdf7a125-30bb-4032-b2b2-5572f7d6b878 | public01 | 7350863b-ea98-4556-90cd-b0f19015eb2d 10.141.127.0/24 |
| c57b87fa-38d2-4d09-8074-710b6c80851c | public02 | 7ac7e8f3-9a78-4f2c-a374-ae9c4e45e9cd 10.0.0.0/24     |
| f29e196c-00af-4897-a216-77dd4ae6c1a3 | net01    | 27d24911-9a88-4250-91ac-ced0ba6094fe 80.168.0.0/24   |
+--------------------------------------+----------+------------------------------------------------------+

root@node4:/# nova interface-list test
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| Port State | Port ID                              | Net ID                               | IP addresses | MAC Addr          |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+
| DOWN       | 905c0f9a-6537-45b7-8cd4-f37f5b2e1020 | 9b5f614c-f542-4cce-a0cc-bf4b38ff0213 | 80.168.1.2   | fa:16:3e:df:92:67 |
| DOWN       | cab602f4-ab80-4fe4-b7b3-89cef4799624 | f29e196c-00af-4897-a216-77dd4ae6c1a3 | 80.168.0.2   | fa:16:3e:6c:f1:7d |
+------------+--------------------------------------+--------------------------------------+--------------+-------------------+

root@node4:/# 
root@node4:/# nova list
+--------------------------------------+------+--------+------------+-------------+---------------------------------------------------------------+
| ID                                   | Name | Status | Task State | Power State | Networks                                                      |
+--------------------------------------+------+--------+------------+-------------+---------------------------------------------------------------+
| 9b485760-92e9-44d7-85d5-1db79d25906f | test | ACTIVE | None       | Running     | net01=80.168.0.2, 10.141.127.106; net02=80.168.1.2, 10.0.0.11 |
+--------------------------------------+------+--------+------------+-------------+---------------------------------------------------------------+

root@node4:/# neutron floatingip-list
+--------------------------------------+------------------+---------------------+--------------------------------------+
| id                                   | fixed_ip_address | floating_ip_address | port_id                              |
+--------------------------------------+------------------+---------------------+--------------------------------------+
| 6eb12f46-5e7d-4da5-b29e-e3277bddfe81 | 80.168.0.2       | 10.141.127.106      | cab602f4-ab80-4fe4-b7b3-89cef4799624 |
| fbefb0e9-8020-4e6c-9092-e6b71e04907d | 80.168.1.2       | 10.0.0.11           | 905c0f9a-6537-45b7-8cd4-f37f5b2e1020 |
+--------------------------------------+------------------+---------------------+--------------------------------------+

Thanks

edit retag flag offensive close merge delete

Comments

could it be because the instance has only one default route?

darragh-oreilly gravatar imagedarragh-oreilly ( 2014-02-13 07:55:01 -0500 )edit

maybe, I will confirm it tomorrow. Should I create one router on the eth1 of the instance with the floating ip gateway?

Bing Wang gravatar imageBing Wang ( 2014-02-13 09:30:48 -0500 )edit

First try this: Change the default gateway on the instance to use eth1 instead of eth0. Then try pinging the 2nd floating ip again. My theory is that the ping replies are being routed back via the other interface and conntrack in router can't match it to what came in. Use tcpdump to see.

darragh-oreilly gravatar imagedarragh-oreilly ( 2014-02-13 10:09:35 -0500 )edit

Why someone should need multiple floating IPs for a VM?

cloudssky gravatar imagecloudssky ( 2014-02-13 14:50:47 -0500 )edit

I think you are right, but with do this, another floating ip is failed to connect, just ip 10.141.127.106 address is disconnected. I have an application running in a virtual machine, it needs to communicate with the other two external network applications, and these applications are embedded into two separate devices.

Bing Wang gravatar imageBing Wang ( 2014-02-13 21:36:14 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-02-13 06:16:36 -0500

Mathias Ewald gravatar image

You can only assign a single floating IP to any given VM.

edit flag offensive delete link more

Comments

An instance connect with two external network is impossible?

Bing Wang gravatar imageBing Wang ( 2014-02-13 21:42:11 -0500 )edit

To be honest when I wrote this I remembered having read this somewhere. I was searching for there reference for you now and couldn't find it. I am not sure right now ... maybe I can test for you later today.

Mathias Ewald gravatar imageMathias Ewald ( 2014-02-14 01:28:42 -0500 )edit

Thank you very much. Maybe you are right.

Bing Wang gravatar imageBing Wang ( 2014-02-14 01:55:02 -0500 )edit
0

answered 2017-04-20 17:28:14 -0500

AndriusF47 gravatar image

updated 2017-04-20 17:32:27 -0500

Well, this one is old, but in case anyone need this. You can assign as many floating ip as you have interfaces Assuming you already have a setup with private networks and corresponding external networks.

  1. Add second network port to instance
  2. Ifup interface (private network)
  3. Let's say you added eth1 with
  4. network 192.168.1.0/24 and ip 192.168.1.3 and gateway as 192.168.1.1
  5. Attach second floating ip
  6. Add 2nd routing table and routing rules.

echo "1 rt2" >> /etc/iproute2/rt_tables

ip route add 192.168.1.0/24 dev eth1 src 192.168.1.3 table rt2

ip route add default via 192.168.1.1 dev eth1 table rt2

ip rule add from 192.168.1.3/32 table rt2

ip rule add to 192.168.1.3/32 table rt2

And there you go, you have multiple floating ip's. It's useful for any setups with already existing networking infrastructure, as floating ip's adds flexibility to it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

3 followers

Stats

Asked: 2014-02-13 03:53:55 -0500

Seen: 1,682 times

Last updated: Apr 20