1

windows have multi IP addresses, but now I want to browser Internet, I only want to use one IP access Internet preferentially.

such as I have IP addresses:

45.1.1.1
45.1.1.2
45.1.1.3
45.1.1.4

I want to access the IP.cn, I only want to there shows 45.1.1.1, but it(ip.cn) will show 45.1.1.2 or others actually.

how to realize it?


EDIT-01

I don't know the skip as source, is it mean this button? do you mean check it to add secondary IP or uncheck to add 2rd IP?

enter image description here

3
  • Only one address (45.1.1.1 in shown case) will be used for outbond internet connections. but it will show 45.1.1.2 Who is this "it"?
    – Akina
    May 21, 2019 at 12:18
  • check my post now.
    – 244boy
    May 21, 2019 at 12:58
  • Check your ipconfig, what address is set as first/primary?
    – Akina
    May 21, 2019 at 13:14

1 Answer 1

6

Delete and re-add the secondary addresses with the "skip as source" flag specified. This can be done through command-line tools only (but not through the "TCP/IP Properties" GUI).

Netsh

Netsh requires the address to be deleted first, then re-added:

netsh interface ipv4 add address <interface> <address>/<prefixlen> skipassource=true

For example:

netsh int ipv4 add addr "Ethernet" 192.168.1.5/24 skipassource=true

PowerShell

To add a new address:

New-NetIPAddress -IPAddress <addr>/<len> -InterfaceAlias <interface> -SkipAsSource $True

PowerShell also allows changing existing addresses:

Get-NetIPAddress <address> | Set-NetIPAddress -SkipAsSource $True

Final note

Note that in Server 2012, you must use only command-line tools, as any address change done through the "TCP/IP Properties" GUI will lose this flag for all addresses.


Further information:

8
  • is this works for Windows and Linux?
    – 244boy
    May 22, 2019 at 2:27
  • what's the skip as source flag? where is it?
    – 244boy
    May 30, 2019 at 10:21
  • See netsh interface ipv4 add address ?. May 30, 2019 at 10:24
  • I mean what's the with the "skip as source" flag specified.?
    – 244boy
    May 30, 2019 at 10:25
  • I edited my post, check it.
    – 244boy
    May 30, 2019 at 10:28

You must log in to answer this question.

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