Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
如果您是普通用户(即不是“root”),ifconfig 不在您的路径中,但它是您想要的命令。
ifconfig
更具体地说:/usr/sbin/ifconfig -a
/usr/sbin/ifconfig -a
If you're a normal user (i.e., not 'root') ifconfig isn't in your path, but it's the command you want.
More specifically: /usr/sbin/ifconfig -a
/usr/sbin/ifconfig -a | awk 'BEGIN { count=0; } { if ( $1 ~ /inet/ ) { count++; if( count==2 ) { print $2; } } }'
这将列出机器的确切 IP 地址
This will list down the exact ip address for the machine
以下对我来说效果很好:
ping -s my_host_name
The following worked pretty well for me:
以下 shell 脚本给出了接口和 IP 地址的良好表格结果(不包括环回接口)它已在 Solaris 机器上进行了测试
/usr/sbin/ifconfig -a | awk '/flags/ {printf $1" "} /inet/ {print $2}' | grep -v lo ce0: 10.106.106.108 ce0:1: 10.106.106.23 ce0:2: 10.106.106.96 ce1: 10.106.106.109
The following shell script gives a nice tabular result of interfaces and IP addresses (excluding the loopback interface) It has been tested on a Solaris box
尝试使用ifconfig -a。 查找“inet xxx.xxx.xxx.xxx”,即您的 IP 地址
ifconfig -a
Try using ifconfig -a. Look for "inet xxx.xxx.xxx.xxx", that is your IP address
hostname 和 uname 将为您提供主机的名称。 然后使用 nslookup 将其转换为 IP 地址。
hostname
uname
hostname and uname will give you the name of the host. Then use nslookup to translate that to an IP address.
nslookup
还有:
getent $HOSTNAME
或者可能:
getent `uname -n`
在 Solaris 11 上,ifconfig 命令被认为是旧版命令,并且正在被 ipadm 取代,
ipadm show-addr
它将显示 Solaris 11 及更高版本系统上的 IP 地址。
There's also:
or possibly:
On Solaris 11 the ifconfig command is considered legacy and is being replaced by ipadm
will show the IP addresses on the system for Solaris 11 and later.
/usr/sbin/host `hostname`
应该可以解决问题。 请记住,solaris 机器具有多个 IP 地址是一种非常常见的配置,在这种情况下
/usr/sbin/ifconfig -a inet | awk '/inet/ {print $2}'
将列出所有 IP 地址
should do the trick. Bear in mind that it's a pretty common configuration for a solaris box to have several IP addresses, though, in which case
will list them all
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(8)
如果您是普通用户(即不是“root”),
ifconfig
不在您的路径中,但它是您想要的命令。更具体地说:
/usr/sbin/ifconfig -a
If you're a normal user (i.e., not 'root')
ifconfig
isn't in your path, but it's the command you want.More specifically:
/usr/sbin/ifconfig -a
这将列出机器的确切 IP 地址
This will list down the exact ip address for the machine
以下对我来说效果很好:
The following worked pretty well for me:
以下 shell 脚本给出了接口和 IP 地址的良好表格结果(不包括环回接口)它已在 Solaris 机器上进行了测试
The following shell script gives a nice tabular result of interfaces and IP addresses (excluding the loopback interface) It has been tested on a Solaris box
尝试使用
ifconfig -a
。 查找“inet xxx.xxx.xxx.xxx”,即您的 IP 地址Try using
ifconfig -a
. Look for "inet xxx.xxx.xxx.xxx", that is your IP addresshostname
和uname
将为您提供主机的名称。 然后使用 nslookup 将其转换为 IP 地址。hostname
anduname
will give you the name of the host. Then usenslookup
to translate that to an IP address.还有:
或者可能:
在 Solaris 11 上,ifconfig 命令被认为是旧版命令,并且正在被 ipadm 取代,
它将显示 Solaris 11 及更高版本系统上的 IP 地址。
There's also:
or possibly:
On Solaris 11 the ifconfig command is considered legacy and is being replaced by ipadm
will show the IP addresses on the system for Solaris 11 and later.
应该可以解决问题。 请记住,solaris 机器具有多个 IP 地址是一种非常常见的配置,在这种情况下
将列出所有 IP 地址
should do the trick. Bear in mind that it's a pretty common configuration for a solaris box to have several IP addresses, though, in which case
will list them all