Jclouds - Neutron specify a nic when associating a floating ip - networking

I create instances with multiple network interfaces. However when I associate an floating ip to the instance as below, floating ip is always get allocated to the first interface of the instance.
api.addToServer(ip, server-id);
How do I get the floating ip assigned to the second or an interface other than the first interface. I could not find a way of specifying a nic when associating an floating ip.
I tried a different approach using Openstack commandline and seems it is working.
neutron floatingip-create ext
neutron floatingip-associate floating_ip-id port-id
However I could not find a way to associate a floating ip to a port also.
Then starting the instance with the port-id.

The floating IP extension for Neutron is not supported as of right now 8/20/14 in jclouds.

Is this feature available in JClouds latest release 1.8.1.
Thanks !

Related

Floating IPs usage on Digital Ocean

I am looking for a basic thing yet I have not found not even a single good documentation on getting it done.
I want to allocate a floating IP, then associate it to a network interface of a droplet other than eth0.
The reason is I want to have the ability to very easily switch from one IP to the other with a programming language.
In a few words, I want to be able to do these two commands and both should provide a different response.
curl --interface eth0 https://icanhazip.com
curl --interface eth1 https://icanhazip.com
Also, I want to know what to do once I release the Floating IP, how do I roll back to the starting point.
All documentation I read, rely heavily on "ip route" and "route", most did not even work, some worked but replaced completely the old IP by the floating and that's not what I want, and also they did not show how to rollback the introduced configuration changes.
Please help, I spent 1 whole day now trying to get this to work for a project, and no results so far.
I guess there is no need to know DigitalOcean, how to make this work on other Cloud Providers would apply here too I think.
Update
After asking this on DigitalOcean community forum (https://www.digitalocean.com/community/questions/clear-guide-on-outbound-network-through-floating-ip), they claim that is not supported, although there may be some solutions to this if somebody can provide such a "hacky" solution I would take it too. Thanks
In the cloud (AWS. GCP etc.) ARP is emulated by the virtual network layer, meaning that only IPs assigned to VMs by the cloud platform can be resolved. Most of the L2 failover protocols do break for that reason. Even if ARP worked,the IP allocation process for these IPs (often called “floating IPs”) would not integrate with the virtual network in a standard way, so your OS can't just "grab" the IP using ARP and route the packets to itself.
I have not personally done this on Digital Ocean, but I assume that you can call the cloud's proprietary API to do this functionality if you would like to go this route.
See this link on GCP about floating IPs and their implementation. Hope this is helpful.
Here's an idea that needs to be tested:
Let's say you have Node1(10.1.1.1/24) and Node2(10.1.1.2/24)
Create a loopback interface on both VMs and set the same IP address for both like (10.2.1.1/32)
Start a heartbeat send/receive between them
When NodeA starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 2
When NodeB starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 1
The nodes could monitor each other to withdraw the static routes if the other fails. Ideally you would need a 3rd node to reach quorum and prevent split brain scenarios, but you get the idea right?

Best practice to get and set network properties of minions by salt

I want to get and set network properties those one are in this picture by salt(If I want to be more specific salt-api).
Ubuntu network information
I know I can get some ip and netmask by salt.modules.network.interfaces and gateway from salt.modules.network.default_route and set network properties of windows machines by WIN_IP but I think there must be a better way.
Also I didn't find a way to gather dns of minions yet.
thanks in advance

How are Neutron namespaced networks connected to the physical interface?

Openstack is using namespaces to isolate each network created by 'neutron net-create'.
Since namespaces are isolated from each other but also from the main non-namespaced area, how they end up being connected to the physical interfaces which reside in this "non-namespace" main area?
Which Linux techniques are used for that?
As to what I have seen in the environment I worked on, these interfaces are attached to a virtual bridge in you machine, which is linked also to your physical interfaces.
libvirt creates the interface and it's name should be visible in the kvm / qemu extended process name. it should also be query capable via libvirt.

Finding the correct "network interface" number for IPv6

I am trying to use Boost for some IPv6 and multicast network communication. I need to construct an IPv6 multicast socket that uses a specific network interface index.
I was able to find the correct multicast option to set the network interface index in boost/asio/ip/detail/socket_option.hpp:
explicit multicast_request(const boost::asio::ip::address_v6& multicast_address, unsigned long network_interface = 0)
The problem is, I don't know how to find the correct value for the "network_interface" parameter. Is there a way to get the network_interface value using a local IPv6 address that I can provide? I looked in the documentation and examples, but couldn't find anything.
-- Dylan
Each platform provides APIs to enumerate the network interfaces, e.g. getifaddrs for many Unixes and GetAdaptersAddresses for Windows. Note on Windows there is a separate numerical space for IPv4 and IPv6 adapters which makes the API call if_nametoindex quite confusing.
You may wish to inspect the methods I employed in OpenPGM for portability, considering Windows doesn't really have useful adapter names:
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/getifaddrs.c
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/nametoindex.c
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/indextoaddr.c
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/indextoname.c
I don't think there's a platform-independent way to figure this out, just as there is no portable solution to enumerating the local addresses.
On Linux, you can find what you want in the second column of /proc/net/if_inet6, which is also available more robustly through the rtnetlink(7) interface.

Is there any way of an app in Linux have access to 2 network cards?

My app needs to access two network cards. One to receive data (eth0) and another to send data (3G modem).
Normally, the kernel force the app to work with only one card at a time.
Is there any thing that I can do to make it run?
Thank you.
The kernel does no such thing.
The kernel will route your traffic to the most appropriate end destination based upon the routing information and networks each card is assigned. However, if you are using TCP, your bidirectional communication will use only one route as there is only one address associated with that connection.
If you are trying to implement an multi-homing send/receive system, this is not supported in normal TCP - you will need to use a different protocol, likely implemented in the kernel.
The kernel is not forcing you to use a single interface. It just chooses a default interface if you don't specify otherwise. You can specify a specific interface by specifying it's IP address in the bind() command. To get a list of the available interfaces and their names, use the ioctl(SIOCGIFCONF) function.
Here's an example: http://techpulp.com/2008/10/get-list-of-interfaces-using-siocgifconf-ioctl/
You can make two different UDP sockets bind to separate NICs with the bind(2) and send on one and listen on the other.

Resources