I need to communicate with Network Admin, who doesn't know java, to fix a network setup issue that is revealed when getLocalHost() runs. The box is on two networks and getLocalHost() returns the wrong one. On all of our other servers, this does not happen. I want to be able to show the Network Admin using the command line, that something is wrong. But I'm not familiar enough with the linux network commands to know what to call.
Try hostname
command as follows,
hostname --all-ip-address|cut -d ' ' -f1
If above one not working try ifconfig
as follows,
ifconfig eth0| grep 'inet addr:'|awk '{print $2}'|cut -d':' -f2
Here is also an other option, you can use ip
command as follows also,
ip addr show eth0|grep "eth0"|awk '{print $2}'|tail -1|cut -d'/' -f1
The
eth0
here is a system specific interface name, you have to check about your own interface on your system. Unless last two commands may not be able to help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With