Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Hi I use media tamples dv server... I connected it via SSH with putty.. I need my server's IP address and subnetmask. I know the IP address but I don't know the subnetmask.

How can I find out my server full IP details with ssh?

share|improve this question
    
I thought Media Tample had 24/7 support is that not included in the price? –  Anthon May 11 '13 at 18:25
    
no they don't support dv server. things you do with plesk or ssh you are along.. –  Erdem Ece May 11 '13 at 19:01
    
Just be aware that network admins can and do play games with a net number having different netmasks at different points on the net. I would expect to see this especially in a hosting environment. –  msw May 12 '13 at 12:28

3 Answers 3

up vote 2 down vote accepted

Something like this?

ssh user@server /sbin/ifconfig -a
share|improve this answer
    
hi thanks. it says no such file or directory –  Erdem Ece May 11 '13 at 18:56
    
No such file or directory locally? You do not have ssh? or when you login to the server? –  Jared Burrows May 11 '13 at 19:43
    
@ErdemEce: Do you find it by locate ifconfig or using find etc? –  Sukminder May 11 '13 at 20:01
    
thanks this helped me a alot –  Erdem Ece May 12 '13 at 12:57

This outputs e.g. /24:

ip addr | 
  awk -v ipaddr=192.168.1.2 '\
    $1 == "inet" && $2 ~ "^" ipaddr "/" \
    {mask=$2; sub("^[^/]*","",mask); print mask}'

Make that your SSH command.

share|improve this answer

This answer is laborious but it should have the best shot of always working. I'd check to see if the utilities people are suggesting do exist (maybe they're just installed to a non-standard location, try doing a find first to save yourself the trouble).

You might try to see if there's a /proc/net/route file. If you cat that out it should give you the subnet for the interface. Numbers are in hex and the reverse of how we usually seem them though for example this is my laptop:

[root@localhost net]# cat route 
Iface   Destination Gateway     Flags   RefCnt  Use Metric  Mask        MTU Window  IRTT                                                       
wlan0   00000000    0101A8C0    0003    0   0   0   00000000    0   0   0                                                                              
wlan0   0001A8C0    00000000    0001    0   0   0   00FFFFFF    0   0   0                                                                              
virbr0  007AA8C0    00000000    0001    0   0   0   00FFFFFF    0   0   0  

The gateway is 0101A8C0 in hex so breaking that into octets (two hex digits) and converting to decimal I get "C0" = "192" "A8"="168" "01"="1" and "01" again for a gateway of "192.168.1.1" You follow the same procedure for the subnet mask, and see that I have a 255.255.255.0 subnet mask.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.