Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
# ネットワークインターフェース確認
PS C:\Users\Administrator> Get-NetIPInterface -AddressFamily IPv4
ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore
------- -------------- ------------- ------------ --------------- ---- --------------- -----------
3 Ethernet IPv4 1500 15 Enabled Connected ActiveStore
1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore
# DHCP オフ (対象インターフェースは上記で確認した値)
PS C:\Users\Administrator> Set-NetIPInterface -InterfaceIndex 3 -Dhcp Disabled
# IPアドレス [10.0.0.101/24], ゲートウェイ [10.0.0.1] を設定
PS C:\Users\Administrator> New-NetIPAddress -InterfaceIndex 3 -AddressFamily IPv4 -IPAddress "10.0.0.101" -PrefixLength 24 -DefaultGateway "10.0.0.1"
IPAddress : 10.0.0.101
InterfaceIndex : 3
InterfaceAlias : Ethernet
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Manual
SuffixOrigin : Manual
AddressState : Tentative
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : ActiveStore
# DNS [10.0.0.10] を設定
PS C:\Users\Administrator> Set-DnsClientServerAddress -InterfaceIndex 3 -ServerAddresses "10.0.0.10" -PassThru
InterfaceAlias Interface Address ServerAddresses
Index Family
-------------- --------- ------- ---------------
Ethernet 3 IPv6 {}
Ethernet 3 IPv4 {10.0.0.10}
# 設定確認
PS C:\Users\Administrator> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : RX-7
Primary Dns Suffix . . . . . . . : srv.world
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : srv.world
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Red Hat VirtIO Ethernet Adapter
Physical Address. . . . . . . . . : 52-54-00-75-14-84
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::b0bf:a4f1:530:d35c%3(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.101(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.1
DNS Servers . . . . . . . . . . . : 10.0.0.10
NetBIOS over Tcpip. . . . . . . . : Enabled
|