linux怎么查看本机ip和端口号?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
linux查看本机ip的命令是“ifconfig”命令和“ip address”命令;linux查看端口号的命令是“lsof -i:port”命令和“netstat -aptn”命令。
查看本机ip:
1)ifconfig命令
输出如下:
[root@topgun /home/cly] # ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.128.132 netmask 255.255.255.0 broadcast 192.168.128.255 inet6 fe80::20c:29ff:fe45:63ba prefixlen 64 scopeid 0x20<link> ether 00:0c:29:45:63:ba txqueuelen 1000 (Ethernet) RX packets 1936 bytes 2440516 (2.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1207 bytes 94802 (92.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 19 base 0x2024 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 12 bytes 744 (744.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12 bytes 744 (744.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
该命令属于包:
[root@topgun /home/cly] # pacman -Qo ifconfig /sbin/ifconfig 属于 net-tools 1.60.20120804git-2
2)ip address命令
输出如下:
[root@topgun /home/cly] # ip address 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:45:63:ba brd ff:ff:ff:ff:ff:ff inet 192.168.128.132/24 brd 192.168.128.255 scope global eth0 inet6 fe80::20c:29ff:fe45:63ba/64 scope link valid_lft forever preferred_lft forever
该命令属于包:
[root@topgun /home/cly] # pacman -Qo ip /usr/sbin/ip 属于 iproute2 3.5.1-1
Linux查看本机端口
查看指定的端口
# lsof -i:port
查看所有端口
# netstat -aptn
安装telnet
#yum install -y telnet.x86_64
#telnet ip 端口
更多相关资讯:
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。