o*****l 发帖数: 539 | 1 I have a Ubuntu 9.04,
InetAddress.getLocalHost() does not work.
InetAddress.getLocalHost().getHostAddress() return "127.0.1.1"
while the actual ip is 192.168.21.62.
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:e8:e7:95:a6
inet addr:192.168.21.62 Bcast:192.168.21.255 Mask:255.255.255.0
inet6 addr: fe80::224:e8ff:fee7:95a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1078196 errors:0 dropped:0 overruns:0 frame:0
|
m*c 发帖数: 19 | 2 does it matter?
I have a Ubuntu 9.04,
InetAddress.getLocalHost() does not work.
InetAddress.getLocalHost().getHostAddress() return "127.0.1.1"
while the actual ip is 192.168.21.62.
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:e8:e7:95:a6
inet addr:192.168.21.62 Bcast:192.168.21.255 Mask:255.255.255.0
inet6 addr: fe80::224:e8ff:fee7:95a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1078196 errors:0 dropped:0 over
【在 o*****l 的大作中提到】 : I have a Ubuntu 9.04, : InetAddress.getLocalHost() does not work. : InetAddress.getLocalHost().getHostAddress() return "127.0.1.1" : while the actual ip is 192.168.21.62. : $ ifconfig : eth0 Link encap:Ethernet HWaddr 00:24:e8:e7:95:a6 : inet addr:192.168.21.62 Bcast:192.168.21.255 Mask:255.255.255.0 : inet6 addr: fe80::224:e8ff:fee7:95a6/64 Scope:Link : UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 : RX packets:1078196 errors:0 dropped:0 overruns:0 frame:0
|
m******t 发帖数: 2416 | 3 It works for me. What do you get when running "hostname" from command line?
0
【在 o*****l 的大作中提到】 : I have a Ubuntu 9.04, : InetAddress.getLocalHost() does not work. : InetAddress.getLocalHost().getHostAddress() return "127.0.1.1" : while the actual ip is 192.168.21.62. : $ ifconfig : eth0 Link encap:Ethernet HWaddr 00:24:e8:e7:95:a6 : inet addr:192.168.21.62 Bcast:192.168.21.255 Mask:255.255.255.0 : inet6 addr: fe80::224:e8ff:fee7:95a6/64 Scope:Link : UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 : RX packets:1078196 errors:0 dropped:0 overruns:0 frame:0
|
s******e 发帖数: 493 | 4 as I know, you need to run as root to get network interface list.
try to run as root to see if the pr still there. |