1

Does anyone know how to create a .reg registry script that will add a second IP address to a machine that is called 127.0.0.2 ?

Here is the "manual" method:

  1. Go to the Control Panel > Network
    Connections Right click on the Local Area Connection (or whichever network connection you want to add the 2nd IP Address) and click Properties
  2. Click on Internet Protocol (TCP/IP) in the
    connection box and click properties Enter the first IP address in the
    properties box
  3. Click Advanced
  4. Click Add under the IP Addresses box and enter the information for the 2nd IP Address
  5. Close all the boxes

2 Answers 2

12

You're not going to want to do this with direct manipulation of the registry. You're much better off using the netsh command to make these kinds of changes.

Assuming the NIC is named "Local Area Connection", you can do netsh interface ip "Local Area Connection" x.x.x.x y.y.y.y where x.x.x.x is the IP address and y.y.y.y is the subnet mask.

4
  • +1 Wish I could agree more...
    – squillman
    Jan 20, 2010 at 23:26
  • ahh... i should have thought of that! thanks. ;-)
    – djangofan
    Jan 21, 2010 at 17:59
  • Yeah, don't do this when you're remotely and your primary address is DHCP, because it overrides the DHCP.
    – Dagelf
    May 19, 2020 at 14:52
  • 1
    Is this really adding a second IP address, or it only replaces the current IP with the new IP (x.x.x.x)?
    – IceCold
    Jul 26, 2021 at 9:38
3

Late, I know, but I think djangofan want something like that :

    netsh interface ip set address "Local Area Connection" static 192.168.0.110 255.255.255.0 192.168.0.5

    netsh interface ipv4 add address "Local Area Connection" 172.21.1.10 255.255.0.0 172.21.1.254

and the result :

Carte Ethernet Connexion au réseau local :

   Suffixe DNS propre à la connexion. . . :
   Adresse IPv4. . . . . . . . . . . . . .: 172.21.1.10
   Masque de sous-réseau. . . . . . . . . : 255.255.0.0
   Adresse IPv4. . . . . . . . . . . . . .: 192.168.0.110
   Masque de sous-réseau. . . . . . . . . : 255.255.255.0
   Passerelle par défaut. . . . . . . . . : 192.168.0.5
                                       172.21.1.254
2
  • Thank you. So long ago that I don't remember why I asked the question.
    – djangofan
    May 3, 2016 at 16:18
  • Yeah, don't do this when you're remotely and your primary address is DHCP, because it overrides the DHCP.
    – Dagelf
    May 19, 2020 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .