netmask in a script

Dazed_75 lthielster at gmail.com
Thu Oct 27 00:27:47 MST 2011


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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20111027/309cb2d1/attachment.html>


More information about the PLUG-discuss mailing list