# Mobile Client MAC Address

**URL:** <https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037>\
**Category:** Ignition\
**Created:** [March 4, 2019, 6:39pm UTC](https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037 "2019-03-04T18:39:28Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 7, 2019, 1:56pm UTC](https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037/10 "2019-08-07T13:56:43Z")

</div>

In a **real** Vision client, you can obtain the local MAC addresses with the following script:

```auto
from java.net import NetworkInterface

# Get list of local mac address as strings
def myMacIds():
    macs = [ni.hardwareAddress for ni in NetworkInterface.getNetworkInterfaces() if ni.hardwareAddress]
    return [":".join(["%02x" % (b & 0xff) for b in mac]) for mac in macs]

```

Also, again in a real Vision client, you can obtain the outbound network interface and the corresponding local IP address the client uses to talk to the gateway with this script:

```auto
from java.net import DatagramSocket, InetAddress, NetworkInterface, URI

# Get the outbound network interface and local IP address (as a tuple).
def localInterface():
    gw = URI(system.tag.read('[System]Client/Network/GatewayAddress').value).host
    for ip in InetAddress.getAllByName(gw):
        socket = DatagramSocket()
        try:
            socket.connect(ip, 0)
            return NetworkInterface.getByInetAddress(socket.localAddress), socket.localAddress
        except:
            pass
        finally:
            socket.close()
    return None, None

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037)._
