Generation of MAC addresses

1,488 views
Skip to first unread message

Nick Kakouros

unread,
Mar 30, 2018, 10:26:04 PM3/30/18
to gce-discussion
How are MAC address's generated on GCE? I would like to have some kind of custom routing on my VPC network and it would be nice to have custom ARP table entries. But for that, I would need to be able to predict the MAC addresses of current and future instances.

Karthick (Cloud Platform Support)

unread,
Mar 31, 2018, 6:31:35 PM3/31/18
to gce-discussion
Hello,

As I don't fully understand your use case about having custom routing on the VPC network, but, as explained, the MAC address is calculated (hash) based on the internal IP (user defined or auto-generated) of an instance. And at the moment, it is impossible to directly modify or inspect the VPC routing table, which is reasoned in [1][2]. You can however show your interest by opening a Public Issue Tracker to attract more attention to it. 



Nick Kakouros

unread,
Mar 31, 2018, 7:39:47 PM3/31/18
to gce-discussion
I would like to have a bunch of IP addresses in my VPC network forwarded to a single instance. If I operate on the private network that GCE knows about, I cannot add a route that will do the forwarding as GCE is in control of routes on this private range. Thus, I operate on a second private range. I have created custom routes (as it possible now) and added secondary ip addresses to instances so that communication can indeed happen among my instances over this second private range. The problem is that under some circumstances when an instance wants to reach another instance, an ARP request is fired that asks for the MAC address for the second private ip of the target instance. The GCE switch replies nothing back as it knows nothing about it. If I create a custom ARP table record that resolved this second IP address to the MAC address of the isntance, then communication is successful. But I want to automate my setup and knowing how to calculate the MAC address of an instance beforehand is crucial. Hope I explained it sufficiently.

Nick Kakouros

unread,
Mar 31, 2018, 7:46:56 PM3/31/18
to gce-discussion
BTW, do you know what hashing is performed to get the MAC address? Knowing that, I could predict the MAC address an instance will have.


On Sunday, April 1, 2018 at 12:31:35 AM UTC+2, Karthick (Cloud Platform Support) wrote:

Paul Nash

unread,
Apr 6, 2018, 6:24:36 PM4/6/18
to tterr...@gmail.com, gce-discussion
Hi Nick,

I'm sorry, but I'm not sure if there's a ton of detail we can provide to you on the mechanism for this. It's an implementation detail that could very likely change in the future.

--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/2b4f9b84-64ad-40c7-8881-83b0320d80c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Paul R. Nash | Group Product Manager, Compute Engine | paul...@google.com | 206-876-1620

Karthick (Cloud Platform Support)

unread,
Apr 6, 2018, 7:20:03 PM4/6/18
to gce-discussion
Hello Nick,

Thank you your patience in this concern while I was looking to find supporting information. For your use case, I would recommend you to try Alias IP which could be ideal feature for this scenario. And since you are using multiple interfaces there is already a feature request being worked by our internal team for supporting Alias IP on more than one VM interface. This is schedule to be rolling out soon. You can check here for any future updates on this. 

Additionally, if you don't wish to use Alias IPs, next easier solution is to obtain the MAC address on demand. This will be obtainable from instance Metadata, which is also an in-progress feature request. You will get future update on this Public Issue Tracker that you have already opened. 

Due to privacy reasons, I cannot share the specific hashing algorithm we use. We have a plan in place to change the hashing to be a hash of Instance ID + NIC index rather than hash of Internal IP. However, I cannot provide you with the ETA when this will be implemented. 
 


Nick Kakouros

unread,
Apr 7, 2018, 11:00:11 AM4/7/18
to gce-discussion
Thank you all for the information!

Tanmoy Sinha

unread,
Feb 14, 2019, 5:05:09 PM2/14/19
to gce-discussion
I believe my question is somewhat related to this topic, hence posting my query on top of it.

I am using gcloud compute API to list all instances within a subnet within a given project and for a zone. I get a list of hosts and their attributes, but I can't figure out their MAC address of those instance under the 'networkInterfaces' attribute. However, from within a instance the MAC is available while querying the meta-data server, but I can't afford to do that. Is there anyway, I can figure out the MAC through gcloud compute APIs?

Following is part of the response.

"networkInterfaces": [

                        {

                            "kind": "compute#networkInterface", 

                            "network": "xxxx", 

                            "accessConfigs": [

                                {

                                    "networkTier": "PREMIUM", 

                                    "kind": "compute#accessConfig", 

                                    "type": "ONE_TO_ONE_NAT", 

                                    "name": "External NAT", 

                                    "natIP": "xxxx"

                                }

                            ], 

                            "networkIP": "10.15.0.2",

                            "fingerprint": "Yl3nY0j-9Ag=",

                            "subnetwork": "yyyy",

                            "name": "nic0"

                        }

                    ],

Jason

unread,
Feb 17, 2019, 5:35:37 PM2/17/19
to gce-dis...@googlegroups.com
Hi,

From checking our public documentation in regards to making calls to the Compute Engine API, there is no call that details a way to get or list the MAC address of the VM instances [1]. I have created an internal request to either include the MAC address under the "networkInterface", or to add a REST call to list the MAC addresses of the VM instances. As this is a request to apply a new feature within Compute Engine, I cannot provide an ETA on if/when it will be applied; however, I have attached a Public Issue Tracker to the bottom of this message [2] so that you can follow the progress of this request.

Reply all
Reply to author
Forward
0 new messages