Take the 2-minute tour ×



share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Something like this?

ssh user@server /sbin/ifconfig -a
share|improve this answer
add comment

This outputs e.g. /24:

ip addr | 
  awk -v ipaddr= '\

Make that your SSH command.

share|improve this answer
add comment

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 "" You follow the same procedure for the subnet mask, and see that I have a subnet mask.

share|improve this answer
add comment

Your Answer


