Reputation: 1927
Is there anyway to determine if a windows computer is running IPV6 using native utilities, python or php?
Upvotes: 3
Views: 25964
Reputation: 1927
This is how I solved the issue, by trying to open up an IPv6 socket. If the system did not throw an error, then it is using IPv6.
import socket
def isIPV6():
ipv6 = True
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
except:
ipv6 = False
return ipv6
Upvotes: 6
Reputation: 12866
Enumerate the interfaces and check for an IPv6 address, like everyone else has stated. Alternatives include trying to open an IPv6 socket or get Python to call WSCEnumProtocols()
Upvotes: 1
Reputation: 33690
Jakob's approach is the simplest; you could pipe the result and do a match to see whether a network adapter has a valid IPv6 address.
Additionally, you could get this by fetching the Windows Management Instrumentation class Win32_NetworkAdapterConfiguration. The property IPAddress
is an array of all the IP addresses associated with a network adapter and you can match against them to see if there is a IPv6
address associated. But PS is a bit of an overkill, I'd go with Jakob's or Wyatt's answer unless you'd need to do something more intelligible and fancy (send an HTTP request; change some network rules; restart a service).
Upvotes: 0
Reputation: 9913
Sure. If ipconfig
contains an IPv6 Address
entry for a real interface, you've probably got IPv6 connectivity. There are also useful registry entries at HKLM\SYSTEM\CurrentControlSet\services\TCPIP6
.
Upvotes: 3
Reputation: 34718
Every computer ships with IPv4 at standard. IPv6 is only enabled on specific machines. But if you parse ifconfig/ipconfig then you should find yourself a IPv4/6 address in the output
Upvotes: 1