netmask in a script

Nathan England nathan at paysonlinux.org
Wed Oct 26 22:23:51 MST 2011


On Wednesday, October 26, 2011 21:49:40 Dazed_75 wrote:
> I would like to apply a netmask to an arbitrary IP in a bash/dash script
> (e.g. apply 255.255.255.0 to 173.10.3.155 to get 173.10.3.0).  Is there any
> easy way to do that without taking the IP apart, doing 4 operations and
> reassembling the results?


does executing

ifconfig DEVICE_NAME 173.10.3.155 netmask 255.255.255.0 

give you the desired results?


Nathan


More information about the PLUG-discuss mailing list