[cs615asa] [CS615] getting subnet masks from ifconfig

Jan Schaumann jschauma at stevens.edu
Wed Mar 11 22:15:46 EDT 2015


Julian Sexton <jsexton at stevens.edu> wrote:
> On the linux-lab, I'm finding that ifconfig uses something similar to "Mask:
> 255.0.0.0" to represent the netmask. Is it alright to return this in the
> list of IP addresses when invoking the -i option? Or should we specifically
> exclude IP addresses precluded by the word "Mask:" ? 

'255.0.0.0' in this output is not the IP address configure on the
interface, but a netmask.  Netmasks can be represented in a variety of
ways (we will cover this in a future lecture, but don't let that deter
you from researching the concept).

Sample output for for ifcfg-data(1) on linux-lab:

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:16:3e:c6:94:fe  
          inet addr:155.246.89.104  Bcast:155.246.89.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20297354 errors:0 dropped:46978 overruns:0 frame:0
          TX packets:15382457 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6235755057 (6.2 GB)  TX bytes:13223411400 (13.2 GB)
          Interrupt:56 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:401466 errors:0 dropped:0 overruns:0 frame:0
          TX packets:401466 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:373858137 (373.8 MB)  TX bytes:373858137 (373.8 MB)

lo:0      Link encap:Local Loopback  
          inet addr:155.246.89.100  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
$ ifconfig -a | ifcfg-data -i
155.246.89.104
127.0.0.1
155.246.89.100
$ ifconfig -a | ifcfg-data -m
00:16:3e:c6:94:fe
$ ifconfig -a | ifcfg-data -n
255.255.255.0
255.0.0.0
255.255.255.255
$ 

-Jan


More information about the cs615asa mailing list