Querying and changing DHCP setting on bigfix client

Hi,

Was wondering is there a way I can query all the client network adapters connection name that has the DHCP set to disable. I try using this relevance but it is showing me the description name and those that are enable.

Q:(description of it & " - " & address of it as string ) of adapters whose (dhcp enableds of it) of network
A:Red Hat VirtIO Ethernet Adapter - 192.168.122.66

This relevance will show the connection name

Q:(name of item 0 of it & " - " & (address of item 1 of it as string)) of (connections of it, adapters of it) whose (guid of item 0 of it = name of item 1 of it) of network
A:Local Area Connection - 192.168.122.62
A:_Common_HGFITMO - Go to ithixpsupportt.com.sg instead of dialing directly - 10.203.135.240

Also is there a way I can use bigfix to enable DHCP on all the network adapter?

Appreciate your help in advance. Cheers~

ā€¦as it just so happens, Iā€™ve been working on an Analysis and Dashboard to bulk-import my BES Clients as Bare Metal Targets for ā€œBigFix OS Deployment and Bare Metal Imagingā€. Iā€™m pulling the full network config for both Windows and Linux in the following query, probably much more than you need, but here you goā€¦

q: if windows of operating system then (((friendly name of it, mac addresses of it, (if dhcp enabled of it then "dhcp" else "static") , addresses of it, subnet masks of it, gateways of it, concatenation ";" of (addresses of dns servers of it as string) , dns suffix of it) of adapters whose (exists addresses whose (it!="0.0.0.0") of it) of network)) else if name of operating system as lowercase starts with "linux" then ((names of it, mac addresses of it, (if not exists file ("/etc/sysconfig/network-scripts/ifcfg-" & name of it) then "" else if exists key "BOOTPROTO" whose (it as string as lowercase contains "dhcp") of file ("/etc/sysconfig/network-scripts/ifcfg-" & name of it) then "dhcp" else "static") , addresses of it,subnet masks of it, (if exists property "routing table" then (if exists gateways of routes whose (destination of it = "0.0.0.0") of routing table then (gateways of routes whose (destination of it = "0.0.0.0") of routing table as string) else "") else (if exists key "GATEWAY" of files ("/etc/sysconfig/network-scripts/ifcfg-" & name of it) then concatenation of substrings separated by "%22" of key "GATEWAY" of file ("/etc/sysconfig/network-scripts/ifcfg-" & name of it) else "")) , (if not exists line starting with "nameserver" of file "/etc/resolv.conf" then "" else concatenation ";" of first matches (regex "[^\ ]+") of following texts of firsts "nameserver" of lines starting with "nameserver" of file "/etc/resolv.conf") , (if not exists line starting with "domain" of file "/etc/resolv.conf" then "" else /* Some nsswitch.conf files are malformed, containing two "domain" lines; handle that case via tuple string items 0*/ tuple string items 0 of concatenation ", " of first matches (regex "[^\ ]+") of following texts of firsts "domain" of lines starting with "domain" of file "/etc/resolv.conf")) of ip interfaces whose (not loopback of it AND exists mac address of it) of network) else nothing
A: Local Area Connection 2, 88-51-fb-6b-c8-2f, dhcp, XXX.XXX.XXX.XXX, 255.255.255.0, XXX.XXX.XXX.1, XXX.DNS.SRV.XXX;XXX.DNS.SRV.2;XXX.DNS.SRV.3, mydomain.myagency.gov
T: 19.393 ms
I: plural ( string, string, string, ipv4 address, ipv4 address, ipv4 address, string, string )

You should be able to trim that to just the parts you need. To configure DHCP (on Windows I assume?), youā€™d use the ā€˜netsh.exeā€™ command:

C:\Program Files\Java>netsh int ipv4 set address
One or more essential parameters were not entered.
Verify the required parameters, and reenter them.
The syntax supplied for this command is not valid. Check help for the correct syntax.

Usage: set address [name=]<string>
             [[source=]dhcp|static]
             [[address=]<IPv4 address>[/<integer>] [[mask=]<IPv4 mask>]
             [[gateway=]<IPv4 address>|none [gwmetric=]<integer>]
             [[type=]unicast|anycast]
             [[subinterface=]<string>]
             [[store=]active|persistent]

Parameters:

       Tag            Value
       name         - Interface name or index.
       source       - One of the following values:
                      dhcp: Enables DHCP for configuring IP addresses for
                            the specified interface.
                      static: Disables DHCP for configuring IP addresses for
                            the specified interface. This value must be
                            specified if an address or a gateway is being
                            configured.
       address      - IPv4 address to add or modify, optionally followed by
                      the subnet prefix length.
       mask         - The IP subnet mask for the specified IP address.
       gateway      - One of the following values:
                      <IPv4 address>: A specific default gateway for the
                                      static IP address you are setting.
                      none: No default gateways are set.  This is the default.
       gwmetric     - The metric for the default gateway. This field should
                      be set only if gateway is specified.
       type         - One of the following values:
                      unicast: Marks the address as a unicast address.
                               This is the default.
                      anycast: Marks the address as an anycast address.
       subinterface - LUID of the subinterface on which the default gateway
                      exists.  This parameter is only needed on interfaces
                      with multiple subinterfaces.
       store        - One of the following values:
                      active: Set only lasts until next boot.
                      persistent: Set is persistent.  This is the default.

Remarks: Used to enable or disable DHCP for IP address configuration.
         Also removes any previous static IP addresses and default gateways,
         and can add a new static IP address and default gateway.

Examples:

       set address name="Local Area Connection" source=dhcp
       set address "Local Area connection" static 10.0.0.9 255.0.0.0 10.0.0.1 1

Edit: This Relevance can be expensive, so when you put it into an Analysis ensure that you donā€™t evaluate it too frequently. Iā€™m only pulling this weekly in my system.

3 Likes

Awesome!! Will be trying this out. Thanks for your help.