Manual Network Addressing

[#gtcurady]: Specifics for implementations of finding the address(es) used by a NIC

Note: This section is about having a computer report the IP address(es) that the computer is configured to use when communicating with other equipment on the same subnet/LAN. This section is also about having the computer report the “physical” hardware address on each NIC. (This type of physical hardware address is also called “MAC-48”, “MAC”, or “EUI-64” or “BIA” or “EHA” or “link layer”). For non-firewalls using IPv4, this will generally be a private address. Details are also available (in another section) for a similar, but different, task: determining the public IP address in use.

In Unix

Use “ ifconfig -Aa ” (or fewer parameters, as noted by the section on available network interfaces).

The hardware address, often referred to as a MAC-48 address, may be referred to as a “link layer address”, and may be shown by ifconfig output as lladdr. The 48 bits are represented by hexadecimal digits separated by single colons. (In this way, it may look similar to an IPv6 address with short numbers, although an IPv6 address needs to have either two colons directly next to each other or to have seven, not five, total colons.)

For IPv6 addresses, see the setting that starts with “inet6 ”. For IPv4 addresses, see the setting that starts with “inet4 ” or, more commonly, “inet ”. (If pattern matching, such as if searching through text with grep, the recommended pattern to match is “inet ” including a space after the word inet. Otherwise there will likely be “false positives” from any references to the IPv6 settings which are likely labelled with the text “inet6 ”.) For example, if a system's IPv4 address is being sought, and one isn't worried about seeing addresses of network interfaces other than the one being used, consider using:

ifconfig -Aa | grep -i "inet "
In Windows

Choose one of the following options. Note that some options may only show partial information about some similar information: Microsoft KB 162055 references default gateway in some software. WinIpCfg may only show one DNS server at a time (and require pressing a (More Details?) button and then an elipsis button to show more).


Use IPConfig and if that does not show enough information, add a /all parameter. In Win95 that may not exist, but Win9x-kernel operating systems will also have a graphical utility called WinIPCfg. Another graphical method is available for other Windows operating systems, involving looking at the settings where they are able to be set. (See Setting IPv4 in Windows and Renewing IPv4 in Windows.)

In Windows Vista (Home Premium), running msconfig.exe will run the “System Configuration Utility” (which is the name shown by UAC). Unlike some other variations of this program, there is a Tools menu. One of those Tools has a “Tool Name” of “Internet Protocol Configuration” and a description of “View and configure network address settings.” That may be used to launch cmd.exe /k (in a specified path) with a parameter to run %windir%\system32\ipconfig.exe unless the “Advanced options” checkbox is checked, in which case “ /all” will be appended to the ipconfig.exe command. The end user may then press the Launch button which will create a command prompt that runs the specified command and which does not exit automatically.

If IPConfig /all is shown, some of the extra information that is visible is the link-local hardware address, sometimes called a MAC-48 address. This address is called a “Physical Address” by the output of “IPConfig /all”, and is shown with a single hyphen separating each of six pairs of hexadecimal digits.

netsh interface ipv6 show address

Example output:

Interface 1: Loopback Pseudo-Interface 1

Addr Type  DAD State   Valid Life Pref. Life Address
---------  ----------- ---------- ---------- ------------------------
Other      Preferred     infinite   infinite ::1

Interface 11: Wireless Network Connection

Addr Type  DAD State   Valid Life Pref. Life Address
---------  ----------- ---------- ---------- ------------------------
Other      Deprecated    infinite   infinite fe80::XXXX:XXXX:XXXX:XXXX%11


Addr Type  DAD State   Valid Life Pref. Life Address
---------  ----------- ---------- ---------- ------------------------
Other      Deprecated    infinite   infinite fe80::5efe:

Interface 13: Local Area Connection

Addr Type  DAD State   Valid Life Pref. Life Address
---------  ----------- ---------- ---------- ------------------------
Temporary  Preferred   2d19h4m32s 2d19h4m32s fd00::XX:XXXX:XXXX:XXXX:XXXX
Public     Preferred  29d23h57m28s 6d23h57m28s fd00::XX:XXXX:XXXX:XXX:XXXX
Other      Preferred     infinite   infinite fe80::XXXX:XXXX:XXX:XXXX%13

Interface 16: Teredo Tunneling Pseudo-Interface

Addr Type  DAD State   Valid Life Pref. Life Address
---------  ----------- ---------- ---------- ------------------------
Public     Preferred     infinite   infinite 2001:0:XXXX:XXXX:XXXX:XXX:XXXX:XXXX
Other      Preferred     infinite   infinite fe80::XXXX:XXX:XXXX:XXXX%16

The various X characters, shown in that example output, were all hexadecimal digits. (The non-numeric digits were all rendered as lowercase.)

netsh interface ipv4 show address

The above syntax was tested in Windows Vista. Presumably some older versions of Windows do not support that syntax, but do support the following syntax (which is still supported, at least when tested with Windows 7).

netsh interface ip show address

Unlike the IPv6 layout, this ends up showing things line by line. Each line that says “IP Address” represents an IP address. The following line shows “Subnet Prefix” and may have output such as “ (mask”. If there are multiple IPv4 addresses, there will be multiple “IP Address” lines with each one followed by a “Subnet Prefix” line. After those lines a line saying “Default Gateway” will show the default route, followed by a Gateway metric. Each Interface also shows an “InterfaceMetric” line.

Configuration for interface "Local Area Connection 2"
   DHCP enabled:                         Yes
   InterfaceMetric:                      10

Configuration for interface "Local Area Connection"
   DHCP enabled:                         No
   IP Address:                 
   Subnet Prefix:               (mask
   IP Address:                 
   Subnet Prefix:               (mask
   Default Gateway:            
   Gateway Metric:                       256
   InterfaceMetric:                      20

Configuration for interface "Loopback Pseudo-Interface 1"
   DHCP enabled:                         No
   IP Address:                 
   Subnet Prefix:               (mask
   InterfaceMetric:                      50
MAC address

netsh lan show interfaces ” may show information about just the wired cards. However, a service may need to be started before that will work. sc query dot3svc
It may quite likely say “STATE” is “1  STOPPED”. If so, trying to effectively use “netsh lan” (e.g. “netsh lan show settings” may show a message, “The Wired AutoConfig Service (dot3svc) is not running.” Hmm, it would be nice if the netsh program provided more details on a resolution, but here they are: Run “ sc start dot3svc

For further details about Netsh, see netsh documentation. For further details specifically about referencing IPv6 with Netsh, see Netsh commands for Interface IPv6.

[#wnipcfge]: Graphical program: W*n*IPCfg.Exe

Fans of WinIPCfg from Win9x may be able to use a similar program for other Microsoft Windows operating systems: e.g. there is an Info page for Wntipcfg.exe for Win2K. Microsoft KB 927229: Win2K RK Tools for administrative tasks has a download link to the Win2K Wntipcfg.exe (hyperlink direct to file download).

Another graphical method
Find a list of adapters by running the Network Control Panel Applet. Access the context/shortcut menu (by right-clicking on the icon) of the desired adapter (look for one which may be enabled and which is not the “1394 Connection” (described by MS Q307736: Description of 1394 Connection in Windows XP) and choose “Status”. Then look for a “Details...” button (for Windows Vista) or a tab.

Before getting too reliant on this command, note that Microsoft has decided to stop using this command as a recommended method of performing the task. So, for compatibility with newer operating systems, using netsh instead is recommended. (Details: Microsoft Technet: Migrating IPv6.exe Commands to Netsh Command)

Confirmation needed: It appears this is IPv6.exe -v if IfIndex (where details of “IfIndex” are probably involving using an identifier, as described by available network interfaces).

[#stcurady]: Specific implementations of network address assignment

Note: Some of these methods involve manually setting addresses. Some of these may involve using other methods (which may be discussed further in the section about automatic address assignment).

Notes about MAC addresses

There may be a way to set the interface's hardware address (as currently interacting with software on the machine, and as sent out with ARP). This may be doable; with at least some operating system platforms this may be done using a method which is fairly generic regarding which model of network card is being used.

Such an address may even be able to be changed long term so that the new address is used even after the computer reboots or even stops supplying power to the network card. Traditionally, this has been done using software provided by the card's manufacturer, and may be quite specific to the model of network card being used.

For further details, see the section about setting an address in the operating system that will be used. For example, if using Microsoft Windows, see the following section about setting addresses in Microsoft Windows, and then see the sub-section related to setting MAC addresses.

In Unix
IP addresses
(Manually) (Re-)requesting an IPv6 address
(Manually) (Re-)requesting an IPv4 address

Generally, running dhclient on the desired interface will work. (The program may need to be executed by running a program with superuser privileges.)

For example, if the network interface name is if0 (which it probably is not: see the section on network interface names), then run:

dhclient if0
Setting an address (short term)

Although the method may vary (e.g. with BackTrack it may be set through a graphical interface), the most common method is to use ifconfig. First identify the name of the network interface. To do this, see available network interface identifiers.

If the interface in question is called if0 then an example command to run for IPv4 may be:

ifconfig if0 inet prefixlen 24

(Instead of “prefixlen ” and a prefix length, IPv4 addresses may use a syntax such as “netmask”. In fact, using netmask is probably more likely to work, although this documentation leads with using “prefixlen” because that has the preferred syntax for notating subnet size, both because it is shorter and because using prefixlen is more consistent with a syntax supported by IPv6.)

Specifying the address family, inet, is probably optional. Therefore, one may guess that older Unixes, specifically those Unix versions that did not support multiple address families, probably did not support including this “inet” argument at all. However, the OpenBSD man page for ifconfig notes that “specifying the address family is recommended.” This guide is following that recommendation. If the syntax seems invalid, try leaving off the inet (and just assume that IPv4 is being implied), and try using “netmask instead of “prefixlen 24

If the interface in question is called if0 then an example command to run for IPv6 may be:

ifconfig if0 inet6 2001:db8::AF prefixlen 16

(Specifying the address family, inet6, is probably optional. Therefore, one may guess that older Unixes that did not support multiple address families probably did not support including this argument at all. However, the OpenBSD man page for ifconfig notes that “specifying the address family is recommended.”)

(64 is probably a more common prefix than 16 for IPv6. The reason the example shows 16 is to match the address from the 2001:db8:: subnet shown in the sample. Specify whatever subnet you are actually trying to use.)

Setting the IP address information long term

Implementations may vary. One implementation, OpenBSD's, is to store information in files called /etc/hostname.* which are named after the interface to configure. Unlike Linux, which names Ethernet network devices as “eth”, OpenBSD tends to name the network devices after the driver being used. Putting the configuration in these files allows /etc/netstart (optionally followed by an interface name, to limit the (re-)initialization to occur on only the specified NIC) to use those files which are documented in OpenBSD's man page for “hostname.if.

If the network-specific configuration files aren't identified, one may be able to work around the situation by simply putting a working ifconfig command in a script file that is automatically started when the system starts.

MAC address

In Unix, this may be doable with ifconfig. Try “ sudo ifconfig if0 lladdr 0e:01:23:45:67:89 ” to set the link-local address. (For Linux users, the network interface may commonly be eth0 instead of if0. Other systems may need to specify a different NIC ID.) If that syntax doesn't work, try setting the Ethernet address using “ sudo ifconfig if0 ether 0e:01:23:45:67:89 ”. Although it is possible that neither syntax may work (Brad's post on lladdr being added implies that this wasn't supported before), this feature has been widely supported for a very long time.

In Windows
IP address

There may be multiple options.

[#wnrnwip4]: (Re-)requesting an IPv4 address in 32+ bit versions of Microsoft Windows

Ensure the adapter is set to use DHCP. (If it isn't, see the steps about how to set the IP address.)

Then either release and renew, or repair. Releasing probably isn't needed, but it will set the IPv4 address to an invalid address (blank, or “”) and this will make the effects of the subsequent Renew to be more likely to be easily noticable.

To release, run “ IPConfig /release ”. In Win9x, the IPConfig command may or may note exist depending on the Windows version, but those operating systems that don't have IPConfig will have WinIPCfg exist in those operating systems, so the release button of WinIPCfg can be used. (Fans of WinIPCfg that are using operating systems that don't come with that tool may be able to use WNTIPCfg. For details on obtaining that, see the section about viewing an IP address with a specialized bundled graphical utility in Windows.)

To renew, “ IPConfig /renew ” or “ IPConfig /renew * ” may have the desired effect. Again, since some Win9x versions may not have IPConfig, WinIPCfg's renew button may help.

Another option may be to try to perform a “repair”. (This may work better with some operating systems than others. In Windows Vista or newer, the equivilent functionality may be provided by a much less pleasant “Diagnose” button.) This may perform multiple tasks, including performing a release and a renew.

To repair, which involves using the graphical interface, check the networking connections from the Network adapters screen. This screen should be reachable from Control Panel, and possibly from the Start menu (by exploring the folder of Network Connections), or from the command line. One may try to use the following command line to pull up a network connections screen.

Once the list of network adapters is visible, access the shortcut/context menu of the desired network adapter. In Windows XP, there may be a Repair option. Otherwise, choose Status and look for a Repair option on the (General? Support?) tab.

(Re-)requesting an IPv6 address
Unknown: Perhaps this is similar to using an IPv4 address. However, IPv6 support will need to be installed/enabled, which may not be the case for older Windows operating systems.
Setting an address (short term)
Using netsh

This may not be an option for Win9x. For IPv4, see:

netsh interface ipv4 set address /?

As a specific example: “ netsh interface ipv4 set address source=dhcp ”. As another specific example:

netsh interface ipv4 set address name="Local Area Connection" source=static address= mask= gateway= store=active

Note: This may not have been heavily tested (by the author of this text, at the time of this writing). Older versions of the software probably need to use ip instead of ipv4. See: MS Technet on Netsh

For IPv6, it is interesting that “ netsh interface ipv6 set address /? ” does not show any way to specify a prefix length (or a netmask).

For Windows XP and XP SP1, there was a command called ipv6 which could be used: Microsoft's article “Microsoft Technet: Migrating IPv6.exe Commands to Netsh Command” shows some details.

Using WMI

First, find the index:

WMIC NICCONFIG WHERE IPEnabled='True' GET Index,Caption

Then, customize the Index number (to specify which NIC to set), IPv4 address, and subnet size (specified via IPv4 “subnet mask” notation).

WMIC NICCONFIG WHERE Index=11 call EnableStatic ("""), (""")

You may also wish to set DNS settings. The following uses OpenDNS, which is one of the Usable DNS Servers for clients to use

WMIC NICCONFIG WHERE (IPEnabled=TRUE and Index=11) call SetDNSServerSearchOrder ("""), (""")

Setting DNS and WINS Server Addresses Remotely provides a warning (second paragraph).

[#wnstip4l: Setting an IP address (using settings that will remain long term) in 32+ bit versions of Microsoft Windows.

For Win9x, note that changing to or from DHCP is likely to have the operating system say (presumably correctly) that it insists on a reboot of the operating system in order for the new settings to take effect.

Either use IPv4, see “ netsh interface ipv4 set address /? ” and use a command involving store=persistent, or use the graphical user interface. For Windows XP and XP SP1, there was also a command called IPv6.exe which may have provided some additional options.

For the GUI, access the list of network connections. (Details are in the section called (Re-)requesting an IPv4 address in 32+ bit versions of Microsoft Windows.) Access a specific network connection's shortcut/context menu and either choose Properties, or choose Status and then choose the Properties button on the General tab. If applicable, agree to the prompt that comes from UAC. Then choose the protocol: In Windows XP and older operating systems, the “Internet Protocol Version 4 (TCP/IPv4)” protocol (as it is named by newer operating systems) may have the shorter name of “Internet Protocol (TCPIP)”. Either double-click on the desired protocol, or select it and choose the Properties button.

MAC-48 address

(Note: This process may have not been verified by the author of this text, at the time of this writing. Some of this is simply an accumulation of details found elsewhere. Consider these steps to be experimental.)

SANS article on changing MAC states, “On Windows 7 and later, the MAC address for 802.11 wireless interfaces must sometimes be specially crafted in order for the operating system to accept it.” “Note that many interfaces, such as for” an “802.11 wireless card, will not accept a custom MAC address unless a special bit in the MAC indicates that it has been customized.” (That web page provides software to resolve the issue. Those details have not been tested or reviewed by the author of this text.)

Text mode

The MAC address can be viewed with “ WMIC NIC LIST FULL ” or, more abbreviated, “ WMIC NIC GET MacAddress ”. However, “ WMIC NIC Set /? ” yields, “INFO: Writeable properties are not available for this alias or class.

Altering Registry directly

The following is based on some information from a guide to spoofing MAC addresses:

Identify which Registry Key to use

There are likely multiple registry keys to choose from; only one is likely to match the NIC to be changed. The registry key may be named 0000 or 0001 or something higher like 0015. The correct one needs to be identified.

REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} /v DriverDesc /s

If the name of the device is not sufficient, there is another way to be thorough and help to be certain that the NIC selected is the one that is actively used:

REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} /v NetCfgInstanceID /s

Then run “ net config rdr ” (or “ net config workstation ”, if that's preferred). The output of that Net command should say: “Workstation active on:”. Then, on the next line (after a tab), it should say “NetBT_Tcpip_{”, followed by a GUID (and then a matching closing “}”). Compare that GUID to the results of running the previous “REG [...] /v NetCfgInstanceID /s” command.

REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000 /v NetworkAddress

If it exists, delete it before adding a desired value.

REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000 /v NetworkAddress
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000 /v NetworkAddress /t REG_SZ /d 0e0123456789

Then, the device needs to be reset (stopped, and then started). This may be doable by restarting the computer, or by disabling the device in the Device Manager, although there are classier ways.

Using netsh

A discussion about trying to use WMI on XP has moderator Jakob Gottlieb Svendsen stating that “found out that only wifi adapters can be enabled/disabled with netsh in Windows XP!”) So perhaps this won't work. (It may, however, be simpler than the WMI approach, which may be more likely to work on supported operating systems.)

netsh interface set interface NetworkInterfaceNameOrIndex DISABLED
netsh interface set interface NetworkInterfaceNameOrIndex ENABLED


netsh interface set interface "Local Area Connection" DISABLED
netsh interface set interface "Local Area Connection" ENABLED
Using WMI

With Windows Vista and newer, WMI Win32_NetworkAdapter API may help. (This is untested, but is reported to be effective, and appears to be the fastest/slickest method.) This involves using the “Disable” and “Enable” code which was added with Windows Vista, so other methods may be needed for older operating systems.

WMIC PATH Win32_NetworkAdapter Get InterfaceIndex,NetConnectionID

The following is more complicated than necessary (just to show how to accomplish this advanced method), because it checks both the InterfaceIndex and the NetConnectionID. Either could be used.

WMIC PATH Win32_NetworkAdapter WHERE (InterfaceIndex=11 AND NetConnectionID="Wireless network Connection") Get MACAddress,NetEnabled,TimeOfLastReset

If that seemed to properly show the intended device, then:

WMIC PATH Win32_NetworkAdapter WHERE (InterfaceIndex=11 AND NetConnectionID="Wireless network Connection") Call /?

That should show a column called “Call” and the names of these “methods” (“Disable and Enable”) should show a “Status” of “Implemented”.

WMIC PATH Win32_NetworkAdapter WHERE (InterfaceIndex=11 AND NetConnectionID="Wireless network Connection") Call Disable
WMIC PATH Win32_NetworkAdapter WHERE (InterfaceIndex=11 AND NetConnectionID="Wireless network Connection") Call Enable

With older versions of Microsoft Windows, the best way might be to use an external utility. states, “Resetting the adapter can be accomplished in script with the freely available command line utility devcon from Microsoft, or from the adapters context menu in the Network Connections control panel applet.” (See: Info about Microsoft's Devcon program. Another page, Enable or Disable NICs, provides some details about using devcon to pull this off.) (There's also a(n untested) discussion about trying to use WMI on XP. That page notes that moderator Jakob Gottlieb Svendsen “found out that only wifi adapters can be enabled/disabled with netsh in Windows XP!”)


In Microsoft Windows, check the Device Manager. Once in the Device Manager, check out the section related to NICs, which may be a section called “Network adapters”. Review the card's Properties. This may be a bit custom per card. Perhaps under an “Advanced” tab is a relevant property. Actually, there will probably be multiple properties that can be changed. Which one should be used? Unfortunately, lets us know, “The exact name depends on the Ethernet driver used; not all drivers support changing the MAC address in this way.” Sigh. Try looking for a Property called “Network Address” (e.g. Realtek PCIe FE Family) or “Locally Administered Address” (Intel might use that?) or “MAC Address” or “Ethernet Address”.

Other operating systems

In DOS, changing the MAC address used by the card was a task that could commonly be done by using some software that was provided by the card manufacturer. (This software was often specialized enough that routinely the software could not perform this type of functionality for NICs made by other manufacturers.)

Perhaps software for this comes with the network software? As DOS did not have a single universally standardized network stack, there likely isn't a single set of directions on how to override the card's address with software. (Maybe someday directions for a popular stack will be investigated and placed here. That is not very high priority, though.)

netsh lan show interfaces ” may show information about just the wired cards. However, a service may need to be started before that will work. sc query dot3svc
It may quite likely say “STATE” is “1  STOPPED”. If so, trying to effectively use “netsh lan” (e.g. “netsh lan show settings” may show a message, “The Wired AutoConfig Service (dot3svc) is not running.” Hmm, it would be nice if the netsh program provided more details on a resolution, but here they are: Run “ sc start dot3svc