`

list all ip address

 
阅读更多

import java.net.InetAddress;

import java.net.NetworkInterface;

import java.net.SocketException;

import java.util.Collections;

import java.util.Enumeration;

 

public class IPAddressTest {

 

public static void main(String args[]) throws SocketException {

        Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();

        for (NetworkInterface netint : Collections.list(nets))

            displayInterfaceInformation(netint);

    }

 

    static void displayInterfaceInformation(NetworkInterface netint) throws SocketException {

        System.out.printf("Display name: %s\n", netint.getDisplayName());

        System.out.printf("Name: %s\n", netint.getName());

        Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();

        for (InetAddress inetAddress : Collections.list(inetAddresses)) {

        System.out.printf("InetAddress: %s\n", inetAddress);

        }

        System.out.printf("\n");

     }

 

}

 

分享到:
评论

相关推荐

    解决IP地址冲突的完美方法--DHCP SNOOPING

    When a client receives a valid IP address from the DHCP server, or when a static IP source binding is configured by the user, a per-port and VLAN Access Control List (PACL) is installed on the port....

    CISCO 技术大集合

    建立动态地址翻译 ip nat inside source {list {access-list-number | name} pool name [overload] | static local-ip global-ip} 指定内部和外部端口 ip nat {inside | outside} 如下图所示, 路由器的Ethernet ...

    Wireless Network Watcher v1.46

    following information is displayed: IP address, MAC address, the company that manufactured the network card, and optionally the computer name. You can also export the connected devices list into ...

    端口查看工具

    CurrPorts displays the list of all currently opened TCP/IP and UDP ports on your local computer. For each port in the list, information about the process that opened the port is also displayed, ...

    8-07-14_MegaCLI for linux_windows

    LSIP200245985 (DFCT) Load address change for PCLI LSIP200233342 (DFCT) Error message displayed while deleting all ld's in MegaCLI, SLESS11 sp2 LSIP200232922 (DFCT) MegaCLI misspell the word "package...

    win 3.11 for workgroup tcpip支持

    "The DHCP client was unable to obtain an IP network address from a DHCP server. Do you want to see future DHCP messages?" This message means that TCP/IP has initialized but without any addressing ...

    ArubaOS 6.0 Command Line Interface Reference Guide 命令行用户手册

    Configure how often the controller should generate a DNS request to cache the IP address for a RADIUS server identified via its fully qualified domain name (FQDN). ap spectrum localoverride Convert an...

    switch security.rar

    Config-access-map#match ip address 1---------------匹配的是access-list的permit语句 Config-access-map#action drop Config#vlan access-map yucedu 20 Config-access-map#action forword 默认是转发的 show ...

    华为路由模拟

    # ifconfig eth0 &lt;ip address&gt; netmask &lt;netmask&gt; ;设置IP地址 # ifconfig eht0 &lt;ip address&gt; netmask &lt;netmask&gt; down ; 删除IP地址 # route add 0.0.0.0 gw &lt;ip&gt; # route del 0.0.0.0 gw &lt;ip&gt; # route add default...

    TCP/IP症状和原因

     没有到远程主机的路由 1) 用ipconfig /all检查缺省网关2) 用show ip route查看是否相应路由3) 如果没有该路由,用show ip route查看是否有缺省网关4) 如有网关,检查到目标的下一跳;如无网关,修正问题  ...

    常用网络命令实验报告(20210919173801).pdf

    格式:Nbtstat [-a RemoteName] [-A IP address] [-c] [-n] [-p port] [-r] [-R] [-s] [-S] 参数: * -a 显示当前的 NBT 信息。 * -c 显示当前的 TCP/IP 连接。 * -n 显示当前的 NetBIOS 名称。 连接工具包括: ...

    华为路由交换模拟器V3

    [Quidway-serial0]ip address &lt;ip&gt;&lt;mask&gt; [Quidway-serial0]undo shutdown 激活端口 [Quidway]link-protocol hdlc 绑定hdlc协议 [Quidway]user-interface vty 0 4 [Quidway-ui-vty0-4]authentication-mode ...

    Cisco Press - OSPF Network Design Solutions, 2nd Edition

    IP Address Management 59 IP Encapsulation Support 59 Available Resources 59 Technical Considerations 60 Fast Convergence 60 Routing Updates 61 VLSM and CIDR Support 61 Load Sharing 61 Metrics 61 ...

    计算机网络第六版答案

    The packet switch uses the destination IP address in the packet to determine the outgoing link. Asking which road to take is analogous to a packet asking which outgoing link it should be forwarded on...

    DotNetFtpSources

    if(this.IPAddress.ToLower().IndexOf("all") &gt; -1) { FTP_Listener = new TcpListener(System.Net.IPAddress.Any,this.Port); } else { FTP_Listener = new TcpListener(System.Net.IP...

    uboot常用命令详细介绍

    imls - list all images found in flash itest - return true/false on integer compare loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line loop - infinite ...

    F5 GTM IControl 配置管理工具

    --serverlist Get All Server ,eg.(--serverlist) --servercreate Server Create,eg.(--servercreate ServerName,DataCenterName,Address) --servergetmonitor Get Server Monitor,eg.(--servergetmonitor ...

    delphi socket call php socket 例子

    // create a list of all the clients that will be connected to us.. // add the listening socket to this list $clients = array( $sock ); while ( true ) { // create a copy, so $clients doesn't get...

    《网络安全》学生实验(项目)报告-CCNAS_Chp3_PTActA _AAA.doc

    Configure the AAA TACACS server IP address and secret key on R2. Step 4. Configure AAA login authentication for console access on R2. Enable AAA on R2 and configure all logins to authenticate using ...

Global site tag (gtag.js) - Google Analytics