Network Interface Addresses Listing

We can get the list of IP addresses that are assigned to it using a network interface. Network interface addresses can be obtained from a NetworkInterface instance by using one of two methods. The first method, getInetAddresses(), returns an Enumeration of InetAddress. The other method, getInterfaceAddresses(), returns a list of java.net.InterfaceAddress instances. This method is used when you need more information about network interface addresses beyond its IP address. For example, you might need additional network interface addresses related information about the subnet mask and broadcast address when the address is an IPv4 address, and a network prefix length in the case of an IPv6 address.

network interface addresses

The below example lists all the network interface addresses:

so using the above code we can list the network interface addresses

References:-

Leave a Reply

Your email address will not be published. Required fields are marked *