Windows 10 assign a static IP address and name to an ethernet port based on PCI address

0

Is there a way (from the command line) to assign a static ip and name assignment to an ethernet adapter based on the PCI bus/device/function number of the NIC? I am able to do this with the netsh CLI using the name that windows assigns it as such:

netsh interface ip set address name="Ethernet 5" static 192.168.xxx.xxx 255.255.255.0
netsh interface set interface name = "Ethernet 5" newname = "Example"

But relying on the ethernet label is not going to work in my case, so I'm looking to do this based on the PCI address of each one. I haven't been able to find much information on it, so any suggestions would help.

Stoic_Observer

Posted 2018-01-30T18:57:41.880

Reputation: 31

This feels like a roundabout way to solve your problem. First off, only physical Ethernet adapters have PCI addresses, so this won't be a universal solution. Why exactly don't you want to rely on the connection's name? – I say Reinstate Monica – 2018-01-30T19:03:32.170

I only want to do this for physical ports so that's ok. I am virtualizing Win 10 on a bare metal hypervisor. When windows reboots as virtualized the names of the connections are always different. The only thing that seems to be steady is the bus/device/function number of the ports. So I need a script that can assign these static IP's without relying on the names. – Stoic_Observer – 2018-01-30T19:08:40.803

Why not setup a DHCP server with a static IP assignments based on MAC address? The bind dhcp server can I do it I am doing it now. I am sure other dhcp servers can do it. – cybernard – 2018-01-31T03:02:12.303

A DHCP server would be nice to use, but this setup is not always done on a box where everything is already connected to the network. I'd like to be able to assign the IP's to specific physical NICs then later tell my client to plug each piece into its specifically numbered NIC. – Stoic_Observer – 2018-01-31T15:03:30.280

No answers