我怎么知道我的服务器有哪些IP? [英] How do I know what IPs my server have?
本文介绍了我怎么知道我的服务器有哪些IP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用curl,我想随机化与我的服务器可用的IP一起使用的IP卷曲。
I am using curl and I want to randomize the IP curl used with the IPs available for my server.
我需要知道我的服务器可用的IP。虽然我可以对其进行硬编码,但是有没有PhP程序?
I need to know the IPs available for my server. Though I can hard code it, is there a PhP program for that?
推荐答案
如果你在centos中,请运行此命令php exec()
,它会显示所有可用的ip接口。
if you are in centos, run this command using php exec()
and it will show you all availables ip interfaces.
ifconfig | grep inet | awk -F 'addr:' '{ print $2} ' | awk -F ' ' '{ print $1 }'
这篇关于我怎么知道我的服务器有哪些IP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文