I'm not trying to configure network interfaces, I am actually extracting the current IP address and netmask FROM ifconfig.  What I want to do is apply the netmask to the current IP in order to update /etc/dnsmasq.conf's value to the DHCP range it should proxy for in a portable PXE server. 

IOW, the IP of the PXE server is dynamic between different environments and dnsmasq is used so the PXE server does not need to be a DHCP server in whatever network it is attached to today.

On Wed, Oct 26, 2011 at 10:23 PM, Nathan England <nathan@paysonlinux.org> wrote:
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
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



--
Dazed_75 a.k.a. Larry

The spirit of resistance to government is so valuable on certain occasions, that I wish it always to be kept alive.
  - Thomas Jefferson