# Client Network IP Tag shows loopback 127.0.1.1 instead of IP

**URL:** <https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115>\
**Category:** General Discussion\
**Created:** [June 10, 2015, 1:44pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115 "2015-06-10T13:44:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricFrancoeur](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@EricFrancoeur](https://forum.inductiveautomation.com/u/EricFrancoeur)\
**Post date:** [June 10, 2015, 1:44pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/1 "2015-06-10T13:44:57Z")

</div>

I’ve hit a bump… I want the client’s IP … And the tag shows a loopback address…

Anyone have a trick to get my Client IP address ???

---

<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:** [June 10, 2015, 2:07pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/2 "2015-06-10T14:07:00Z")

</div>

Is the gateway service running on the same machine? If so, and you launched from localhost, the client IP really is from localhost. Ignition wouldn’t know what other IP address applies since it isn’t using it at that point.

Or did you launch across a network and the client IP is still localhost?

---

<div class="post-metadata">

**Author:** ![EricFrancoeur](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@EricFrancoeur](https://forum.inductiveautomation.com/u/EricFrancoeur)\
**Post date:** [June 10, 2015, 2:13pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/3 "2015-06-10T14:13:37Z")

</div>

No it’s not the Gateway… it’s a remote pc that the client is running on.

---

<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:** [June 10, 2015, 2:20pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/4 "2015-06-10T14:20:23Z")

</div>

If you must have the client IP addresses without regard to the actual path the server, you can script it like so:`from java.net import NetworkInterface
interfaces = NetworkInterface.getNetworkInterfaces()
for iface in interfaces:
	print iface
	addresses = iface.getInterfaceAddresses()
	for addr in addresses:
		print addr.getAddress()`

---

<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:** [June 10, 2015, 2:24pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/5 "2015-06-10T14:24:15Z")

</div>

> [@EricFrancoeur](#):
>
> No it's not the Gateway.... it's a remote pc that the client is running on.

Odd. I suspect you are running some form of antivirus that is diverting your connections through a local proxy. Try the script function system.net.getExternalIpAddress().

---

<div class="post-metadata">

**Author:** ![EricFrancoeur](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@EricFrancoeur](https://forum.inductiveautomation.com/u/EricFrancoeur)\
**Post date:** [June 10, 2015, 2:59pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/6 "2015-06-10T14:59:01Z")

</div>

No AV or Proxy. It’s a linux box… Ubuntu 14.04 with Oracle Java 7 (Never use Java 8 with Ubuntu btw… the screen freezes in clients and as a Designer you can’t select the projet you want to work on)

So yeah the output of that is :

name:wlan0 (wlan0)  
/IPv6 Address(Not gonna type that)  
/10.0.5.178  
name:lo (lo)  
/0:0:0:0:0:0:01%1  
/127.0.0.1

So if I want just to return the 10.0.5.178 I’m having an issue, because if I try addresses = interface[0].getInterfaceAddresses()  
instead of going thru the loop and then addresses[1].getAddress() it doesn’t work

Guess you can play into that like in datasets ??

Event with the name ‘wlan0’ it won’t 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:** [June 10, 2015, 3:05pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/7 "2015-06-10T15:05:04Z")

</div>

[quote=“EricFrancoeur”]No AV or Proxy. It’s a linux box… Ubuntu 14.04 with Oracle Java 7 (Never use Java 8 with Ubuntu btw… the screen freezes in clients and as a Designer you can’t select the projet you want to work on)  
[/quote]

I think this is a bug with Java webstart - if you use the native launchers to run the client and designer you should be able to use Java 8 without issue.

---

<div class="post-metadata">

**Author:** ![EricFrancoeur](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@EricFrancoeur](https://forum.inductiveautomation.com/u/EricFrancoeur)\
**Post date:** [June 10, 2015, 4:15pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/8 "2015-06-10T16:15:35Z")

</div>

[quote=“Kevin.Herron”]  
I think this is a bug with Java webstart - if you use the native launchers to run the client and designer you should be able to use Java 8 without issue.[/quote]

I should test that someday…

---

<div class="post-metadata">

**Author:** ![EricFrancoeur](https://avatars.discourse-cdn.com/v4/letter/e/dfb087/32.png) [@EricFrancoeur](https://forum.inductiveautomation.com/u/EricFrancoeur)\
**Post date:** [June 10, 2015, 5:29pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/9 "2015-06-10T17:29:25Z")

</div>

Thanks to pturmel, I was able to play with the java class he showed me and create the function I need!!

`project.Terminal.getIPAddress('wlan0')
`

```auto
def getIPAddress(PortName, IPV6=None):

	if IPV6 is None:
		intIPVersion = 1
	else:
		intIPVersion = 0
	
	from java.net import NetworkInterface
	interface = NetworkInterface.getByName(PortName)
   	addresses = interface.getInterfaceAddresses()
   	
   	dtaIPs = []
   	for addr in addresses:
   		dtaIPs.append((str(addr.getAddress())).strip('/'))
   		
   	return dtaIPs[intIPVersion]

```

---

<div class="post-metadata">

**Author:** ![andy.vickers](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@andy.vickers](https://forum.inductiveautomation.com/u/andy.vickers)\
**Post date:** [April 1, 2019, 12:52pm UTC](https://forum.inductiveautomation.com/t/client-network-ip-tag-shows-loopback-127-0-1-1-instead-of-ip/10115/10 "2019-04-01T12:52:03Z")

</div>

This is definitely a bug/undesirable consequence. Running a project on a Raspberry Pi has the same effect, it pulls the loopback instead of eth0, on a windows PC the tag is fine through. In my mind it would be better if it was at least an array that you could go through.

When using a combination of pi / windows it gives a headache as some work some don’t. I made the following code to overcome this when getting the MAC at least. Hopefully it helps someone.

```auto

mac = getMacPiSafe()	

def getMACAddress(PortName, IPV6=None):
   	    
   	    	if IPV6 is None:
   	    		intIPVersion = 1
   	    	else:
   	    		intIPVersion = 0
   	    	
   	    	from java.net import NetworkInterface
   	    	interface = NetworkInterface.getByName(PortName)
   	       	addresses = interface.getInterfaceAddresses()
   	       	
   	       	dtaIPs = []
   	       	for addr in addresses:
				ip = addr.getAddress()
				network = NetworkInterface.getByInetAddress(ip)
				mac = network.getHardwareAddress()
				strmac = ':'.join('%02x' % (b) for b in mac) 
				   	       	
   	       	
   	       	if len(dtaIPs)>0:
   	       		return dtaIPs[intIPVersion]
   	       	else: 
   	       	    return None

def getMacPiSafe():
	mac = system.tag.read('[System]Client/Network/MACAddress').value
	eth0mac = getMACAddress('eth0');
           
	if(mac==None): 
	   return (eth0mac)
	else:
	   return (mac)

```
