域名城

标题: ipconfig与ifconfig命令用法及区别 [打印本页]

作者: cms5    时间: 2018-9-15 21:48
标题: ipconfig与ifconfig命令用法及区别
1. ipconfig命令

ipconfig命令用于windows系统环境下显示当前主机TCP/IP配置的信息:

C:UsersAdministrator>ipconfig

Windows IP 配置

无线局域网适配器 无线网络连接:

   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : fe80::5c43:3eeb:c4a:4856%12
   IPv4 地址 . . . . . . . . . . . . : 192.168.5.138
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.5.1

C:UsersAdministrator>
注意:aix、Linux系统里使用ifconfig查看IP配置信息。

用法:
ipconfig 显示信息
ipconfig /all  显示详细信息
ipconfig /renew 更新所有适配器


2. ifconfig命令

ifconfig命令用于显示linux、aix等非系统环境下主机TCP/IP配置的信息:

[root@mycms5 /]# ifconfig
eth2      Link encap:Ethernet  HWaddr 00:0C:29B:A4:9E  
          inet addr:192.168.3.10  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedb:a49e/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:43 errors:0 dropped:0 overruns:0 frame:0
          TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5077 (4.9 KiB)  TX bytes:13657 (13.3 KiB)

lo        Link encapocal Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:85 errors:0 dropped:0 overruns:0 frame:0
          TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9009 (8.7 KiB)  TX bytes:9009 (8.7 KiB)

# ip a 也可以先查看ip配置信息
[root@mycms5 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:db:a4:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.10/24 brd 192.168.3.255 scope global eth2
    inet6 fe80::20c:29ff:fedb:a49e/64 scope link
       valid_lft forever preferred_lft forever



注意:aix、Linux系统里使用ifconfig查看IP配置信息。

用法:
ifconfig 查看网络接口状态(当前激活的网络接口情况)
ifconfig -a 查看主机所有网络接口的情况
ifconfig eth0  查看某个(eth0)端口状态
3. 为什么Linux用ifconfig而Windows用ipconfig?

Linux下任何皆文件,任何皆设备,网络接口更接近设备,而Windows下用IP地址,可理解性更强,二是既然是不同的系统,就应显现他们的差别,命令自然就不同了。


转自: http://www.shoubashou.com/windows/20.html

作者: huanaa    时间: 2018-12-1 16:08
祝全城米友一米发、发大财、家家幸福美满、事业发达




欢迎光临 域名城 (https://club.domain.cn/) Powered by Discuz! X3.2