나는 gethostbyname을 호출하고 첫 번째 IP 주소를 h_addr_list에 표시하는 응용 프로그램을 가지고 있습니다. VMware가 설치되어 있고 여러 가상 어댑터가있는 시스템에서 내 응용 프로그램은 항상 가상 어댑터 중 하나의 IP 주소를 반환합니다. 나는 항상 내 응용 프로그램이 내게 물리적 어댑터의 IP 주소를주고 싶다.gethostbyname이 반환 한 IP 주소 목록을 변경하는 방법?
따라서 물리적 어댑터의 IP 주소가 목록에서 첫 번째가되는 방식으로 가상 어댑터의 순서를 바꾸고 싶습니다. 그 중
http://support.microsoft.com/kb/171320
http://support.microsoft.com/kb/894564/en-us#appliesto
아무도 일하지 - 나는 모든 제안을 시도했다. 변경 한 후에 시스템을 재시작했습니다. 네트워크 어댑터의 순서를 변경하는 다른 방법이 있습니까? 가정하지 않으면 어떻게하면 항상 내 물리적 어댑터의 IP 주소를 얻을 수 있는지 코드를 통해 확인할 수 있습니까?
이Windows IP Configuration
Host Name . . . . . . . . . . . . : Win8x64D3b
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : NESSINBLR.COM
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : NESSINBLR.COM
Description . . . . . . . . . . . : Intel(R) 82566DM-2 Gigabit Network Connec
tion
Physical Address. . . . . . . . . : 00-0F-FE-E7-00-A6
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::bc7c:6cf5:e8ed:c874%12(Preferred)
IPv4 Address. . . . . . . . . . . : 172.26.82.152(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.252.0
Lease Obtained. . . . . . . . . . : Wednesday, June 19, 2013 2:55:44 AM
Lease Expires . . . . . . . . . . : Friday, June 21, 2013 2:55:38 AM
Default Gateway . . . . . . . . . : 172.26.80.1
DHCP Server . . . . . . . . . . . : 172.26.116.52
DHCPv6 IAID . . . . . . . . . . . : 251662334
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-3D-50-E5-00-0F-FE-E7-00-A6
DNS Servers . . . . . . . . . . . : 172.26.82.152
Primary WINS Server . . . . . . . : 172.26.82.152
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VMware Network Adapter VMnet1:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet
1
Physical Address. . . . . . . . . : 00-50-56-C0-00-01
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::d59f:e785:bc67:74c4%17(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.3.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 251678806
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-3D-50-E5-00-0F-FE-E7-00-A6
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter VMware Network Adapter VMnet8:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet
8
Physical Address. . . . . . . . . : 00-50-56-C0-00-08
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::3d00:a19f:32b5:5c52%18(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.5.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 268456022
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-18-3D-50-E5-00-0F-FE-E7-00-A6
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter isatap.{A80B07CA-01EF-411D-BB81-A4E2F06D588B}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.NESSINBLR.COM:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : NESSINBLR.COM
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.{8D6220B3-8F39-4514-8C4E-C79D8263C2B8}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
내 응용 프로그램은 항상 도와주세요 대신 172.26.82.152
의 192.168.5.1을 반환 -
내 OS 내 ipconfig/all을 출력 여기에 윈도우 8입니다.