linux指令查詢ip位址

2021-09-24 20:49:26 字數 1476 閱讀 4213

在黑視窗輸入指令ifconfig:

[root@baizhi ~]# ifconfig

eth0     link encap:ethernet hwaddr 00:0c:29:c2:48:40  

inet addr:192.168.94.128 bcast:192.168.94.255 mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fec2:4840/64 scope:link

up broadcast running multicast mtu:1500 metric:1

rx packets:1535 errors:0 dropped:0 overruns:0 frame:0

tx packets:240 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

rx bytes:104986 (102.5 kib) tx bytes:33058 (32.2 kib)

interrupt:19 base address:0x2000

​lo       link encap:local 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:0 errors:0 dropped:0 overruns:0 frame:0

tx packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

rx bytes:0 (0.0 b) tx bytes:0 (0.0 b)

說明:檢視ip的指令為ifconfig(window的檢視ip的命令為ipconfig,可以模擬記憶),對於查詢資訊我們只需要關注第二行即可:

inet addr:192.168.94.128  bcast:192.168.94.255  mask:255.255.255.0
vi   /etc/sysconfig/network-scripts/ifcfg-eth0       (單詞不用全記憶,按tab鍵可以自動補全)
我們會看到這樣的顯示:

device=eth0

hwaddr=00:0c:29:c2:48:40

type=ethernet

uuid=7b5d85e4-6a82-4613-8461-96e91a04a44b

onboot=yes

nm_controlled=yes

bootproto=dhcp

service  network restart
重啟之後就可以利用ifconfig查詢ip位址。

IP位址查詢

coding utf 8 ip 61.158.147.194 import urllib,urllib2,cookielib,sys,cjson reload sys sys.setdefaultencoding utf 8 url 定義介面位址,限制10qps headers headers ok...

IP位址查詢

coding utf 8 ip 61.158.147.194 import urllib,urllib2,cookielib,sys,cjson reload sys sys.setdefaultencoding utf 8 url 定義介面位址,限制10qps headers headers ok...

IP位址查詢介面

給出ip網路的位址,根據ip位址返回該ip所在的國家,省市 州 以及網路運營商等具體資訊。addheader apix key 您的apix key build response response client.newcall request execute 支援格式 json 請求方式 get 請...