# Get MAC address of Gateway

**URL:** <https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565>\
**Category:** Ignition Early Access\
**Created:** [August 10, 2020, 7:15pm UTC](https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565 "2020-08-10T19:15:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [August 10, 2020, 7:15pm UTC](https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565/1 "2020-08-10T19:15:44Z")

</div>

Hi  
I need to get the MAC address of Gateway but didn’t find any API for that. Is there any way to get it by java in python?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 10, 2020, 7:36pm UTC](https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565/2 "2020-08-10T19:36:34Z")

</div>

You can enumerate the `NetworkInterface`s with `NetworkInterface.getNetworkInterfaces()` and each of those will have a `getHardwareAddress()` on it.

[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/NetworkInterface.html](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/NetworkInterface.html)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [August 11, 2020, 4:31pm UTC](https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565/3 "2020-08-11T16:31:24Z")

</div>

> [@Kevin.Herron](#):
>
> `NetworkInterface` s with `NetworkInterface.getNetworkInterfaces()`

Hi Kevin,  
Could you please give me a sample code in python script? I have some problem making it work.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 11, 2020, 4:50pm UTC](https://forum.inductiveautomation.com/t/get-mac-address-of-gateway/37565/4 "2020-08-11T16:50:53Z")

</div>

```python
from java.net import NetworkInterface

e = NetworkInterface.getNetworkInterfaces()

while e.hasMoreElements():
	ni = e.nextElement()
	hwaddr = ni.getHardwareAddress()
	
	if hwaddr is not None:
		mac = ':'.join(format(x & 0xFF, '02x') for x in hwaddr)
		print "%s: %s" % (ni.getName(), mac)

```

```auto
llw0: 12:eb:72:12:1c:de
awdl0: 12:eb:72:12:1c:de
en5: ac:de:48:00:11:22
vmnet8: 00:50:56:c0:00:08
vmnet1: 00:50:56:c0:00:01
en0: f8:ff:c2:01:e4:c6

```
