Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connected to a LAN with the aid of DHCP. Now and then, I need to reach a laptop someone brings to the office that's not configured to use DHCP. So far I need to do the following:

  1. Connect laptop to a network port
  2. Write down laptop's IP address and mask
  3. Change laptop's network settings to match our LAN
  4. Do my work
  5. Restore prior settings

In my old computer (Windows XP) I found a trick to configure my network card to use a second IP/mask simultaneously so I wouldn't need to fiddle with customer laptop settings. Sadly, I've lost the link and I can't find the appropriate search terms to find it again.

How can I accomplish it?

Edit: I found the link (Configuring Virtual IP Address) but the procedure is not working on my Windows 7 box: ipconfig /all doesn't show the new address and I can't even ping myself :(

share|improve this question
up vote 5 down vote accepted

You can add a second IP to the sane NIC if the NIC is not set to DHCP.

Which means that you either:

  • Need to get a fixed IP for your work laptop, so you can do this.
    • go to start, settings, control panel, network connections
    • Select the LAN and go to properties
    • Go to advanced, tab "IP settings" and add a second IP
  • Or still need to:
    • write down the current IP/netmask
    • go to start, settings, control panel, network connections.
    • Select the LAN and go to properties.
    • Unmark DHCP. Set a manual IP as written own in the first step.
    • Go to advanced, tab IP settings and add a second IP.
  • Or use a second network card for the second IP (usually the easiest way)
  • Or install additional software for more network management.
    I assume the last is not an option on corporate networks.
  • Or you can install a VM and configure that to the alternate IP. (Probably only useful if you already use VM and do not want to break existing connections from your main desktop).

(In XP)

screenshot of XP: advanced TCP/IP settings. Two IPs entered

(In win7) screenshot of win 7 ultimate X64: advanced TCP/IP settings. Two IPs entered has this as a C sharp solution for win 7:
However it has no explanation as to why it works, how it works, or how it has to be used.

public class IPAdder
        [DllImport("iphlpapi.dll", EntryPoint = "AddIPAddress", SetLastError = true)]
        private static extern UInt32 MyAddIPAddress(UInt32 Address, UInt32 IpMaskint, int IfIndex,
        out IntPtr NTEContext, out IntPtr NTEInstance);

    public IPAdder()
    { }

    public static void AddIPAddress(String IPAddress, String SubnetMask, int ifIndex)
        IPAddress IPAdd = System.Net.IPAddress.Parse(IPAddress);
        IPAddress SubNet = System.Net.IPAddress.Parse(SubnetMask);
            int MyNTEContext = 0;
            int MyNTEInstance = 0;
            IntPtr ptrMyNTEContext = new IntPtr(MyNTEContext);
            IntPtr ptrMyNTEInstance = new IntPtr(MyNTEInstance);
            UInt32 Result = MyAddIPAddress((uint)IPAdd.Address,
           (uint)SubNet.Address,ifIndex, out ptrMyNTEContext, out ptrMyNTEInstance);

public IPAddress Get37()
    IPAddress ipa = IPAddress.Any;
    // check network interfaces
    foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
        if ((ni.OperationalStatus != OperationalStatus.Up) ||
        (ni.NetworkInterfaceType ==NetworkInterfaceType.Loopback) ||
        (ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel))

        if ((ni.Description.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0) ||
        (ni.Name.IndexOf("virtual", StringComparison.OrdinalIgnoreCase) >= 0))

        if (ni.Description.Equals("Microsoft Loopback Adapter", StringComparison.OrdinalIgnoreCase))

        IPInterfaceProperties ipip = ni.GetIPProperties();
        bool found37 = false;
        foreach (IPAddressInformation unic in ipip.UnicastAddresses)
            string strip = unic.Address.ToString();
            if (strip == "")
                ipa = unic.Address;
                found37 = true;

        if (!found37)
            IPAdder.AddIPAddress("", "",
            (int)(uint)ni.GetType().GetField("index", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(ni));
            ipa =IPAddress.Parse("");
    return ipa;


If external software is allowed then Win IP config seems to do the job.

Screenshot of win7 with cmd.exe open with ipconfig output and winip cfg in the same image

share|improve this answer
This is all interesting info but I'm pretty sure there was a way to add a second IP address/mask combination while using DHCP, at least on XP (not sure if it's still possible on 7). I recall there was not GUI (you had to edit registry or run a command). – Álvaro González Mar 26 '13 at 9:14
I found the link (see my question's edit) but it doesn't seem to work :( – Álvaro González Mar 26 '13 at 9:42
I added two ways which should work. (Some code and an 3rd party tool). I still think it should be possible with native windows (7) commands somehow. – Hennes Mar 26 '13 at 18:54

Alternate Configuration functionality to establish multiple-network connectivity. You can use the Alternate Configuration functionality if you use a mobile computer at your office and at your home. When you are in the office, the computer uses a DHCP-allocated TCP/IP configuration. When you are at home (where you do not have access to a DHCP server), the computer automatically uses the alternative configuration.

Using the Alternate Configuration feature To use the Alternate Configuration feature:

  1. On the Start menu, click Control Panel.
  2. Click Network and Internet Connections.
  3. Click Network Connections.
  4. Right-click the local area network (LAN) or high-speed Internet connection that you want to configure and click Properties.
  5. Click Internet Protocol (TCP/IP) and click Properties.
  6. Click the Alternate Configuration tab.

Inspired by Microsoft

share|improve this answer
Thank you for your answer, but the word says it all: "alternate". I want to configure my desktop computer to use two subnets at the same time so I don't need to change the client laptop's settings. – Álvaro González Mar 26 '13 at 10:45

The procedure for Windows XP involves editing the registry and is explained at Configuring Virtual IP Address.

However, according to this question on Stack Overflow (Is it possible to configure a virtual network interface on Windows7?) the feature was disabled in Vista for security reasons. Apparently, there's no way to do it unless you use third-party customer drivers.

share|improve this answer

I'd suggest "permanently" editing the routing table. This way you can still use your DHCP configuration unaltered, while adding a routing option for your attached laptop without messing up its configuration:

route -p ADD <the IP of the laptop> mask <your PC's IP> <some metric value> <your PC IP>

Of course, if you so desire, you may opt for a subnet routing instead of a host route.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.