Server」カテゴリーアーカイブ

Hyper-V 2.0 新機能~ネットワーク編その4

そのほかのネットワーク新機能としては

  • ジャンボフレームのサポート
  • TCPオフロードのサポート

があげられます。

ジャンボフレームやTCPオフロードはホストでは使用できましたが、Hyper-V2.0(Windows Server 2008 R2)より、ゲストOSでサポートされるようになりました。

WS000005

これがHyper-V1.0のゲストOS上のネットワークプロパティの詳細設定です。 (Jumbo Packetの項目はありませんね)

WS000010

これがHyper-V2.0のゲストOS上のネットワークプロパティの詳細設定です。

これらの画面を見れば一目瞭然ですね。

ジャンボパケットはデフォルトでは無効ですので必要ならここの値を変更する必要があります。ただし、通信経路すべての機器がジャンボフレームに対応していないと使えませんので注意が必要です。

ジャンボパケットとは通常イーサネットでは最大1518バイトで通信を行いますが、それよりも大きなパケット通信を行うことを言います。通常1G以上の通信で使用します。10、100Mでの通信でジャンボパケットを使用すると逆にパフォーマンスが劣化したり、リンクが失われる場合がありますので注意が必要です。

TCPオフロードはデフォルトでペアレントOSおよび仮想端末側でオートになっています。

確認方法としてはそれぞれのコマンドプロンプトより

netsh int tcp sh global

TCPオフロードとはネットワーク通信における計算処理をCPUが行っていますが、それをNICに行わせることによってコンピュータまたはサーバー上のネットワークデータの処理を向上させるのに役立ちます。

今まではたとえホストOSでTCPオフロードを使用していても、仮想マシンのネットワーク処理はホストOSのCPUが担当していました。この処理を有効にすることにより10%程度の処理速度の向上が見込まれるようです。

Hyper-V 2.0 新機能~ネットワーク編その3

Hyper-Vにおける推奨のネットワーク構成としては、管理用ネットワークと仮想マシン用ネットワークを分けて構築しましょうということでした。

ではHyper-V1.0において具体的にどのように行うの?

  1. 物理NICを2枚用意する
  2. NIC1を管理用、NIC2を仮想マシン用とする
  3. Hyper-Vマネージャより仮想ネットワークマネージャを開き、NIC2に外部のネットワークを作成する
  4. ホストOSのネットワーク接続からNIC2にバインドされている仮想NICを無効化する

ポイントは4番の仮想NICを無効化するになります。これを行わないとNIC2で管理が行えてしまうからです。

ではHyper-V2.0では?

管理共有

Hyper-V2.0では、外部ネットワーク作成において新しいオプションが増えています。「管理オペレーティングシステムにこのネットワークアダプタの共有を許可する」です。

ということで実際には

  1. 物理NICを2枚用意する
  2. NIC1を管理用、NIC2を仮想マシン用とする
  3. Hyper-Vマネージャより仮想ネットワークマネージャを開き、NIC2に外部のネットワークを作成する
  4. 管理オペレーティングシステムにこのネットワークアダプタの共有を許可する」のチェックがないことを確認する

実は、Hyper-V2.0では「管理オペレーティングシステムにこのネットワークアダプタの共有を許可する」にチェックを入れないとホストOSのネットワーク接続に仮想NICは現れなくなりました。これは、いい変更ですね。

以上のように、より簡単に管理用と仮想マシン用のネットワークの分離ができるようになりました。

Hyper-V 2.0 新機能~ネットワーク編その2

厳密に言うと新機能ではないのですが、新たにインターフェイスが用意されたものがあります。それが、[MACアドレスの範囲]になります。

MACアドレスの範囲

Hyper-Vの仮想マシンのMACアドレスは動的に設定することができます。

実は、Hyper-Vの役割がインストールされた際にMACアドレスプールがレジストリに設定されます。

HKLMSoftwareMicrosoftWindows NTCurrentVersionVirtualization

MinimumMacAddress
MaximumMacAddress

指定例:
MinimumMacAddress = 00-15-5d-ec-34-00
MaximumMacAddress = 00-15-5d-ec-34-FF

*上位MACアドレスの00-15-5dはマイクロソフトが保有しているアドレスになるので固定にする必要があります。

がアドレス範囲として設定されることになります。

参考:Dealing with MAC address pool duplication in Hyper-V

さて、この設定が問題になることとしてはHyper-Vの役割をインストール済みの状態で、マスターとして設定したのちに複数台の物理マシンに展開したとします。仮にSysprepを実行してもこのアドレス範囲は変わりません。

ということは、複数のHyper-Vマシン上で仮想マシンを作成すると仮想マシン間でMACアドレスのバッティングが発生する可能性があります。

Hyper-V1.0の時にはこのレジストリ情報を変更することによって回避していました。すでにゲストを構築済みの場合は、一度ネットワークアダプタを削除し、再度作成する必要があります。

Hyper-V2.0では、インターフェイスからMACアドレス範囲を変更できるようになったんですね。

Hyper-V 2.0 新機能~ネットワーク編その1

ネットワークの設定において「MACアドレスのスプーフィングを有効にする」という機能が追加されました。

ネットワークアダプタ1.0

これがHyper-V1.0のネットワークアダプタの画面になります

ネットワークアダプタ2.0

これがHyper-V2.0のネットワークアダプタの画面になります

さて、これって何?

仮想ネットワークマネージャからネットワークを作成すると仮想スイッチが作られます

仮想スイッチ

この仮想スイッチは通常のスイッチと同様にMACアドレスの学習をします。しかし、ここで問題になるのはそもそも仮想マシンは物理MACを持っていません。ということはMACアドレスは常に仮想MACということになります。これは便利な半面、使い方によってはセキュリティ上の問題が発生する可能性があります。

仮想マシンで異なる複数のMACアドレスがあった場合は再学習されてしまいます。これはこれで正しい動作なのですが、Hyper-V2.0ではこのような動作を禁止させる仕様になりました。

参考:New in Hyper-V Windows Server 2008 R2 Part 2 – MAC Spoofing

チェックなし(セキュアモード)とした場合は次のようになります

  1. 仮想ネットワークに設定されたMACアドレスのみが自分が送るパケットの唯一の送信元MACアドレスになる
  2. 仮想マシンは宛先MACアドレスが登録されたMACアドレスのユニキャストのみを受信します。そのMACを宛先とするパケットは他のポートにフラッディングされることはない
  3. 仮想スイッチは学習するのでルーティングテーブルを含む様々な内部構造をメンテナンスします。仮想マシンを起動し仮想ネットワークが起動したらルーティングテーブルに自分のMACアドレスを登録し、他のポートに移動しないようにする
  4. トラフィックがスイッチによってフラッディングされる必要がある場合、セキュアモードになっているそのポートに対しては行われない
  5. 仮想マシン内のMACアドレスは上書きはされない

チェックを入れた場合(セキュアレスモード)は

  1. 仮想マシンはすべてのMACアドレスのトラフィックを送受信する
  2. 仮想マシンはフラッディングされたユニキャストパケットを受信する
  3. ポートに対して複数のMACアドレスを学習させることができる。またルーティングテーブルはスイッチポートを通過した時点で学習される
  4. 仮想マシンはMACアドレスを上書きできる

NLBを構築する際には(ユニキャスト構成)各ネットワークのMACアドレスをNLBで設定した仮想MACアドレスに変更しなくてはなりませんその場合は、この「MACアドレスのスプーフィングを有効にする」にチェックを入れたセキュアレスモードにする必要があります

2009/09/15追記

NLB構成の際には、静的MACにしてNLBのMACアドレスに変更する必要はないようです。検証の結果、自動的に適用されました。

キャッシュされたログオン

ドメイン環境において、ネットワークに接続していなくてもクライアントコンピューターにログオンできます。それはキャッシュされたログオン情報を使用してのログオンとなります。この話は以前からあり、最新OSであるWindows7でも同様です。

この仕組みとしてはレジストリに記載されている情報を使用します。

HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrent VersionWinlogon

値の名       : CachedLogonsCount
データ タイプ: REG_SZ
値           : 0 – 50

デフォルト値は10になっています。

これは10個のログオン情報を記憶するということで、ログオン回数とは関係ありません。

ちなみにWindows Server 2008では25に変更されましたが、Windows Server 2008 R2では、またもとの値の10に変更されました。

GPOでも変更できます

コンピュータの構成Windows の設定セキュリティの設定ローカル ポリシーセキュリティ オプション対話型ログオン : ドメイン コントローラが利用できない場合に使用する、前回ログオンのキャッシュ数

から設定を行います。

ここでの考察ですが、ドメイン環境で使用しているのであればキャッシュは使われたくないというニーズは必ずあります。そのような場合はこのレジストリを変更すれば対応できます。

しかし、組織においてノートPCを使用していて外部で使用する際にはネットワークに接続していない環境でPCにログオンしなくてはなりません。その際にドメインアカウントではなくローカルアカウントの使用をしなくてはならないのがネックになりますね。また、アカウントを変更するということは、ドメインで使用しているユーザープロファイルと、ローカルで使用するユーザープロファイルの使い分けをしなくてはならないのが現状です。たとえば、ノートPCをドメイン環境でも使用している状態で、外部からVPN接続をして使うという状況もあります。その際にプロファイルが異なっていると何かと不便ですね。端的な例だとメール(Outlookなど)など情報がプロファイルに記入されるものは特に不便です。

こんなことからやはりキャッシュされたログオンは必要なのかな?なんて思う今日この頃です。

まだ調べきれてない情報として、現在キャッシュされたログオンなのか?そうではないのか?の簡単な判別方法があるのかです。

SETコマンドを使用すれば、現在接続しているlogonserverが判りますが、キャッシュされたログオンでも同じ情報が出てくるのでこれではだめですね~

net user <アカウント名>の最終ログオン日時を見たのですが、なぜか更新されていない。なんでだろう・・・・

Windows Server 2008のTCP/IPパラメータ値に関して

ネットを徘徊していたら有用な情報を見つけましたので忘れないうちにメモ

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters

配下のパラメーター設定情報になります。

以下は抜粋情報になります。検索に引っ掛かりやすいようにね!

ここから********************************************************

ArpRetryCount

Key: TcpipParameters

Value Type: REG_DWORD—Number

Valid Range: 0–3

Default: 3

Description: This value controls the number of times that the computer sends a gratuitous Address Resolution Protocol (ARP) Request message for its own IPv4 address(es) while initializing. Gratuitous ARP requests are sent to ensure that the IPv4 address is not already in use on the locally attached subnet. The value controls the actual number of ARP requests sent, not the number of retries.

ArpUseEtherSNAP

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value controls how IPv4 packets are encapsulated on Ethernet subnets. Setting this value to 1 forces TCP/IP to transmit Ethernet packets using IEEE 802.3 Sub-Network Access Protocol (SNAP) encapsulation. By default, the TCP/IP stack transmits packets in Ethernet II format, also known as Ethernet DIX format. It always receives both formats.

DefaultTTL

Key: TcpipParameters

Value Type: REG_DWORD—Number of hops

Valid Range: 0–0xff (0–255 decimal)

Default: 128

Description: Specifies the default time-to-live (TTL) value set in the header of outgoing IPv4 packets. The TTL determines the maximum number of links on which an IPv4 packet is allowed to travel before being discarded.

DisableDHCPMediaSense

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value can be used to control DHCP Media Sense behavior. If set to 1, the DHCP client ignores Media Sense events from the interface. By default, Media Sense events trigger the DHCP client to take an action, such as attempting to obtain a lease when a connect event occurs, or invalidating the interface and routes when a disconnect event occurs.

DisabledComponents

Key: Tcpip6Parameters

Value Type: REG_DWORD

Valid Range: 0-FF

Default: 0

Description: This value can be used to modify IPv6 capabilities. The DisabledComponents registry value is a bit mask that controls the following series of flags, starting with the low order bit (Bit 0):

· Bit 0 Set to 1 to disable all IPv6 tunnel interfaces, including the Intra-site Automatic Tunnel Addressing Protocol (ISATAP), 6to4, and Teredo tunnel interfaces. Default value is 0. For more information about ISATAP, 6to4, and Teredo, see IPv6 Transition Technologies at http://technet.microsoft.com/en-us/library/bb726951.aspx.

· Bit 1 Set to 1 to disable all 6to4-based interfaces. Default value is 0.

· Bit 2 Set to 1 to disable all ISATAP-based interfaces. Default value is 0.

· Bit 3 Set to 1 to disable all Teredo-based interfaces. Default value is 0.

· Bit 4 Set to 1 to disable IPv6 over all non-tunnel interfaces, including LAN interfaces and Point-to-Point Protocol (PPP)-based interfaces. Default value is 0.

· Bit 5 Set to 1 to modify the default prefix policy table to prefer IPv4 to IPv6 when attempting connections. Default value is 0.

You must restart the computer for the changes to the DisabledComponents registry value to take effect.

DisableIPSourceRouting

Key: TcpipParameters, Tcpip6Parameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1, 2

0 – forward all packets
1 – do not forward source routed packets
2 – drop all incoming source routed packets

Default: 1 for IPv4 and 0 for IPv6

Description: IP source routing is a mechanism that allows the sender to determine the IP route that a packet should take through the network. The Ping and Tracert tools have command-line options to specify source routing.

DisableMediaSenseEventLog

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value can be used to disable logging of DHCP Media Sense events. By default, Media Sense events (connection/disconnection from the network) are logged in the event log for troubleshooting purposes.

DisableTaskOffload

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value instructs the TCP/IP stack to disable offloading of tasks to the network adapter for troubleshooting and testing purposes.

EnableAddrMaskReply

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value controls whether the computer responds to an Internet Control Message Protocol (ICMP) address mask request.

EnableBcastArpReply

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 1 (true)

Description: This value controls whether the computer responds to an ARP request when the source Ethernet address in the ARP request is not unicast. Network Load Balancing Service (NLBS) will not work properly if this value is set to 0.

EnableICMPRedirect

Key: TcpipParameters

Value Type: REG_DWORD–BOOLEAN

Valid Range: 0, 1 (False, True)

Default: 1 (True)

Recommendation: 0 (False)

Description: This value controls whether the TCP/IP stack will update its IPv4 routing table in response to ICMP Redirect messages that are sent to it by network devices such as a routers.

EnableMulticastForwarding

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: The routing service uses this value to control whether or not IP multicasts are forwarded. This value is created by the Routing and Remote Access service.

EnablePMTUBHDetect

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 1 (true)

Description: Setting this value to 1 (true) causes TCP to try to detect path maximum transmission unit (PMTU) black hole routers while doing PMTU discovery. A PMTU black hole router does not return ICMP Destination Unreachable messages when it needs to fragment an IPv4 packet that has the Don’t Fragment flag set. TCP depends on receiving these messages to perform PMTU discovery. With this feature enabled, TCP tries to send segments without the Don’t Fragment flag set if several retransmissions of a segment go unacknowledged. If the segment is then acknowledged, the TCP maximum segment size (MSS) for the connection is decreased and the Don’t Fragment flag is set for subsequent segments. Enabling PMTU black hole detection increases the maximum number of retransmissions that are performed for a given segment.

EnablePMTUDiscovery

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 1 (true)

Description: When this value is set to 1 (true), TCP attempts to discover the maximum transmission unit (MTU), or largest packet size, over the path to a remote host. By discovering the path MTU (PMTU) and limiting TCP segments to this size, TCP can eliminate fragmentation at routers along the path that connects networks with different MTUs. Fragmentation adversely affects TCP throughput and network congestion. Setting this value to 0 (not recommended) causes an MTU of 576 bytes to be used for all connections that are not to destinations on a locally attached subnet.

IGMPLevel

Key: TcpipParameters

Value Type: REG_DWORD—Number

Valid Range: 0,1,2

Default: 2

Description: This value determines to what extent the system supports IPv4 multicasting and participates in the Internet Group Management Protocol (IGMP). At level 0, the system provides no multicast support. At level 1, the system can send IPv4 multicast packets but cannot receive them. At level 2, the system can send IPv4 multicast packets and fully participate in IGMP to receive multicast packets.

IGMPVersion

Key: TcpipParameters

Value Type: REG_DWORD—Number

Valid Range: 2, 3, 4

Default: 4

Description: This value specifies the version of IGMP to use. Specify 2 for IGMP version 1, 3 for IGMP version 2, or 4 for IGMP version 3.

IPAutoconfigurationMask

Key: TcpipParameters

Value Type: REG_SZ—String

Valid Range: A valid IP subnet mask

Default: 255.255.0.0

Description: This value controls the subnet mask assigned to the client using Automatic Private IP Addressing (APIPA) autoconfiguration. This value can only be set globally.

IPAutoconfigurationSubnet

Key: TcpipParameters

Value Type: REG_SZ—String

Valid Range: A valid IP subnet

Default: 169.254.0.0

Description: This value controls the initial address prefix used by APIPA autoconfiguration when selecting an IPv4 address for the client. This value can only be set globally.

IPEnableRouter

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value controls whether the TCP/IP stack will behave as an IPv4 router. Setting this value to 1 (true) causes the TCP/IP stack to forward unicast IP packets that have a destination address that is not assigned to an interface of the stack.

KeepAliveInterval

Key: TcpipParameters

Value Type: REG_DWORD—time in milliseconds

Valid Range: 1–0xFFFFFFFF

Default: 1000 (one second)

Description: This value determines the interval between TCP keep-alive retransmissions until a response is received. Once a response is received, the delay until the next keep-alive transmission is again controlled by the KeepAliveTime registry value. The connection is aborted after 10 retransmissions have gone unanswered.

KeepAliveTime

Key: TcpipParameters

Value Type: REG_DWORD—time in milliseconds

Valid Range: 1–0xFFFFFFFF

Default: 7,200,000 (two hours)

Description: This value controls how often TCP attempts to verify that an idle connection is still intact by sending a keep-alive packet. If the remote system is still reachable and functioning, it acknowledges the keep-alive transmission. Keep-alive packets are not sent by default. This feature may be enabled on a connection by an application.

MTU

Key: TcpipParametersInterfacesinterfaceGUID

Value Type: REG_DWORD—number

Valid Range: From 576 to the MTU of the underlying network

Default: 0xFFFFFFFF

Description: This value overrides the default Maximum Transmission Unit (MTU) for a network interface. The MTU is the maximum IP packet size, in bytes, that can be transmitted over the underlying network. For values larger than the default for the underlying network, the network default MTU is used. For values smaller than 576, the MTU of 576 is used. This setting only applies to IPv4.

Note: Windows Vista TCP/IP uses path MTU (PMTU) detection by default and queries the network adapter driver to find out what local MTU is supported. Altering the MTU value is typically not necessary and might result in reduced performance.

PerformRouterDiscovery

Key: TcpipParametersInterfacesinterfaceGUID

Value Type: REG_DWORD

Valid Range: 0, 1, 2

0 (disabled)
1 (enabled)
2 (enable only if DHCP sends the Perform Router Discovery option)

Default: 2, DHCP-controlled but off by default.

Description: This value controls whether the TCP/IP stack attempts to perform IPv4 router discovery (RFC 1256) on a per-interface basis. See also SolicitationAddressBcast.

SolicitationAddressBcast

Key: TcpipParametersInterfacesinterfaceGUID

Value Type: REG_DWORD

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value controls whether the TCP/IP stack will send IPv4 router discovery messages as broadcasts instead of multicasts (RFC 1256). By default, if IPv4 router discovery is enabled, router discovery solicitations are sent to the all-routers multicast group (224.0.0.2). See also PerformRouterDiscovery.

Tcp1323Opts

Key: TcpipParameters

Value Type: REG_DWORD—number (flags)

Valid Range: 0 or 2

0 (disable the use of the TCP timestamps option)
2 (enable the use of the TCP timestamps option)

Default: No value.

Description: This value controls the use of the RFC 1323 TCP Timestamp option. The default behavior of the TCP/IP stack is to not use the Timestamp options when initiating TCP connections, but use them if the TCP peer that is initiating communication includes them in their synchronize (SYN) segment.

TcpAckFrequency

Key: TcpipParametersInterfacesinterfaceGUID

Value Type: REG_DWORD—number

Valid Range: 0–255

Default: 2

Description: Specifies the number of TCP acknowledgements (ACKs) that will be outstanding before the delayed ACK timer is ignored. Microsoft does not recommend changing this value from the default without careful study of the environment.

TcpDelAckTicks

Key: TcpipParametersInterfacesinterfaceGUID

Value Type: REG_DWORD—number

Valid Range: 2–6

Default: 2

Description: Specifies the number of 100-millisecond intervals to use for the delayed-ACK timer on a per-interface basis. By default, the delayed-ACK timer is 200 milliseconds. If you set this value to 0 or 1, the delayed-ACK time is 200 milliseconds. Microsoft does not recommend changing this value from the default without careful study of the environment.

TcpFinWait2Delay

Key: TcpipParameters

Value Type: REG_DWORD—number

Valid Range: 30–294,967,295

Default: 120

Description: This value controls the maximum number of seconds that a TCP connection will remain in the FIN_WAIT_2 state. For more information, see RFC 793.

TcpMaxDataRetransmissions

Key: TcpipParameters

Value Type: REG_DWORD—number

Valid Range: 0–0xFFFFFFFF

Default: 5

Description: This value controls the number of times that TCP retransmits an individual data segment (not connection request segments) before aborting the connection. The retransmission time-out is doubled with each successive retransmission on a connection and is reset when responses resume. The Retransmission Timeout (RTO) value is dynamically adjusted, using the historical measured round-trip time (the smoothed round trip time) on each connection.

TcpTimedWaitDelay

Key: TcpipParameters

Value Type: REG_DWORD—time in seconds

Valid Range: 30-300 (decimal)

Default: 0x78 (120 decimal)

Description: This value determines the length of time that a connection stays in the TIME_WAIT state when being closed. While a connection is in the TIME_WAIT state, the socket pair cannot be reused. This is also known as the 2MSL state because the value should be twice the maximum segment lifetime on the network. For more information, see RFC 793.

TcpUseRFC1122UrgentPointer

Key: TcpipParameters

Value Type: REG_DWORD—Boolean

Valid Range: 0, 1 (false, true)

Default: 0 (false)

Description: This value determines whether TCP uses RFC 793 or RFC 1122 to interpret the value of the Urgent Pointer field in the TCP header. RFC 793 defines the value as indicating the first byte of normal data. RFC 1122 defines the value as indicating the last byte of urgent data. These two interpretations are not interoperable. Windows Vista and Windows Server 2008 TCP/IP defaults to the RFC 793 interpretation (used by BSD-derived systems).

ここまで**************************************************

Windows Server BackupをPowerShellで操作する

またまた、検証してみました

今回はWindows Server BackupをPowerShellからいじってみました。まずはインストールです

PowerShell

サーバーマネージャーの機能より「Windows Server Backup バックアップの機能」の「コマンドラインツール」を選択します。ここで間違えてはいけないのがWSBのコマンドラインであるwbadminは「Windows Server Backup バックアップ」を選択するとGUIのツールと一緒にインストールされます。「コマンドラインツール」はWindows PowerShell のコマンドレット (スナップイン)がインストールされます。

しかし、これですぐにPowerShell 上でインストールされたスナップインが使えるわけではありません。

PowerShell 上で次のコマンドをたたくことによって組み込まれます

PS C:> Add-PSSnapin windows.serverbackup

ここで本当に組み込まれたか確認

PS C:> Get-PSSnapin

Name        : Microsoft.PowerShell.Core
PSVersion   : 1.0
Description : この Windows PowerShell スナップインには、Windows PowerShell のコンポーネントを管理するために使用する Windows PowerShell 管理コマンドレットがあります。

Name        : Microsoft.PowerShell.Host
PSVersion   : 1.0
Description : この Windows PowerShell スナップインには、Windows PowerShell ホストで使用するコマンドレットが含まれています。

Name        : Microsoft.PowerShell.Management
PSVersion   : 1.0
Description : この Windows PowerShell スナップインには、Windows コンポーネントの管理に使用する管理コマンドレットが含まれています。

Name        : Microsoft.PowerShell.Security
PSVersion   : 1.0
Description : この Windows PowerShell スナップインには、Windows PowerShell のセキュリティを管理するためのコマンドレット が含まれています。

Name        : Microsoft.PowerShell.Utility
PSVersion   : 1.0
Description : この Windows PowerShell スナップインには、データの操作に使用できるユーティリティ コマンドレットが含まれて います。

Name        : windows.serverbackup
PSVersion   : 1.0
Description :

このスナップインを追加することによって15個のコマンドレットが追加されました。ということで確認してみます。

PS C:> Get-Command -CommandType cmdlet | Where-Object{$_.ImplementingType -like “*wb*”}| Format-Table name

Name
—-
Add-WBBackupTarget
Add-WBVolume
Get-WBBackupTarget
Get-WBDisk
Get-WBPolicy
Get-WBSchedule
Get-WBSummary
Get-WBVolume
New-WBBackupTarget
New-WBPolicy
Remove-WBBackupTarget
Remove-WBPolicy
Remove-WBVolume
Set-WBPolicy
Set-WBSchedule

現在接続されているディスクの状況を確認してみます。

PS C:> Get-WBDisk

DiskName       : FUJITSU MHY2160BH ATA Device
DiskNumber     : 0
DiskId         : 7c297c29-0000-0000-0000-000000000000
TotalSpace     : 160041885696
FreeSpace      : 54449995776
Volumes        : {Microsoft.Windows.ServerBackup.Commands.WBVolume, Microsoft.Windows.ServerBackup.Commands.WBVolume}
Properties     : None
ContainsBackup : False
BackupVolumeId : 00000000-0000-0000-0000-000000000000

DiskName       :
DiskNumber     : 1
DiskId         : 760cb29f-0000-0000-0000-000000000000
TotalSpace     : 1000204886016
FreeSpace      : 999959649280
Volumes        : {Microsoft.Windows.ServerBackup.Commands.WBVolume}
Properties     : External, ValidTarget
ContainsBackup : False
BackupVolumeId : 00000000-0000-0000-0000-000000000000

それでは外付けHDDをバックアップディスクとする設定をこれから行います。ちなみに外付けHDDはDiskNumberが1です。ですので$diskを変数として設定します。

PS C:> $disk = Get-WBDisk | where{$_.DiskNumber -eq 1}
PS C:> $disk

DiskName       :
DiskNumber     : 1
DiskId         : 760cb29f-0000-0000-0000-000000000000
TotalSpace     : 1000204886016
FreeSpace      : 999959649280
Volumes        : {Microsoft.Windows.ServerBackup.Commands.WBVolume}
Properties     : External, ValidTarget
ContainsBackup : False
BackupVolumeId : 00000000-0000-0000-0000-000000000000

ターゲットディスクの設定です。

PS C:> $tgt = New-WBBackupTarget -Disk $disk -Label “NewBackup”
PS C:> $tgt

Label                  : NewBackup
WBDisk                 : Microsoft.Windows.ServerBackup.Commands.WBDisk
Path                   :
TargetType             : Volume
PreserveExistingBackup : False

そしてポリシーの作成です。まだ何も入っていませんね。

PS C:> $pol = New-WBPolicy
PS C:> $pol

Schedule                                BackupTargets                           VolumesToBackup
——–                                ————-                           —————

 

ここでポリシーを追加します。

PS C:> Add-WBBackupTarget -Policy $pol -Target $tgt

Label                  : NewBackup
WBDisk                 : Microsoft.Windows.ServerBackup.Commands.WBDisk
Path                   :
TargetType             : Volume
PreserveExistingBackup : False

次にどのボリュームをバックアップするかを指定します。まずは全体のボリューム情報の確認です。

PS C:> Get-WBVolume -AllVolumes

VolumeLabel :
MountPath   : D:
MountPoint  : ?Volume{c948a59a-4794-11dd-995f-806e6f6e6963}
FileSystem  : NTFS
Property    : ValidSource
FreeSpace   : 25328717824
TotalSpace  : 52428800000

VolumeLabel :
MountPath   : C:
MountPoint  : ?Volume{c948a59b-4794-11dd-995f-806e6f6e6963}
FileSystem  : NTFS
Property    : Critical, ValidSource
FreeSpace   : 29117566976
TotalSpace  : 107610112000

VolumeLabel : HD-CNU2
MountPath   : F:
MountPoint  : ?Volume{1d553c30-7d8c-11de-afe2-001cc4d190f9}
FileSystem  : FAT32
Property    : None
FreeSpace   : 999958052864
TotalSpace  : 1000202241024

今回はC:ドライブをバックアップしますので指定します。

PS C:> $vol = Get-WBVolume -AllVolumes | Where{$_.MountPath -eq “C:”}
PS C:> Add-WBVolume -Policy $pol -Volume $vol

VolumeLabel :
MountPath   : C:
MountPoint  : ?Volume{c948a59b-4794-11dd-995f-806e6f6e6963}
FileSystem  : NTFS
Property    : Critical, ValidSource
FreeSpace   : 29117517824
TotalSpace  : 107610112000

そしてスケジュールの指定です。とりあえず変数$schedにぶち込みます。

PS C:> $sched = [datetime]”07/08/2009 16:00:00″
PS C:> $sched

2009年7月8日 16:00:00

当然ながらまだこの状態ではポリシーを見てもスケジュールされていません。

PS C:> $pol | fl

Schedule        :
BackupTargets   : {Microsoft.Windows.ServerBackup.Commands.WBBackupTarget}
VolumesToBackup : {Microsoft.Windows.ServerBackup.Commands.WBVolume}

ではスケジュールを設定します。

PS C:> Set-WBSchedule -Policy $pol -Schedule $sched

2009年8月7日 16:00:00

これでポリシーを確認するとスケジュールが入っていますね

PS C:> $pol | fl

Schedule        : {2009/08/07 16:00:00}
BackupTargets   : {Microsoft.Windows.ServerBackup.Commands.WBBackupTarget}
VolumesToBackup : {Microsoft.Windows.ServerBackup.Commands.WBVolume}

じゃあ、バックアップの設定をしますか~このHDDは初めて接続するのでフォーマットしちゃいます

PS C:> Set-WBPolicy -Policy $pol

警告!
をフォーマットしますか?
[Y] はい(Y)  [A] すべて続行(A)  [N] いいえ(N)  [L] すべて無視(L)  [S] 中断(S)  [?] ヘルプ (既定値は “Y”): y

ここで全体のボリューム確認

PS C:> Get-WBVolume -AllVolumes

VolumeLabel :
MountPath   : D:
MountPoint  : ?Volume{c948a59a-4794-11dd-995f-806e6f6e6963}
FileSystem  : NTFS
Property    : ValidSource
FreeSpace   : 25328717824
TotalSpace  : 52428800000

VolumeLabel :
MountPath   : C:
MountPoint  : ?Volume{c948a59b-4794-11dd-995f-806e6f6e6963}
FileSystem  : NTFS
Property    : Critical, ValidSource
FreeSpace   : 29117366272
TotalSpace  : 107610112000

VolumeLabel : NewBackup
MountPath   :
MountPoint  : ?Volume{1d553c33-7d8c-11de-afe2-001cc4d190f9}
FileSystem  : NTFS
Property    : None
FreeSpace   : 1000059502592
TotalSpace  : 1000183914496

確かに新しいHDDがNewBackupとして存在していますね

そしてサマリーを確認すると・・・

PS C:> Get-WBSummary

NextBackupTime                  : 2009/08/07 16:00:00
NumberOfVersions                : 0
LastSuccessfulBackupTime        : 0001/01/01 0:00:00
LastSuccessfulBackupTargetPath  :
LastSuccessfulBackupTargetLabel :
LastBackupTime                  : 0001/01/01 0:00:00
LastBackupTarget                :
LastBackupResultHR              : 0
LastBackupResultDetailedHR      : 0
CurrentOperationStatus          : NoOperationInProgress
DetailedMessage                 :

確かにスケジュールがされているのがわかりますね。

PS C:> Get-WBSummary

NextBackupTime                  : 2009/08/08 16:00:00
NumberOfVersions                : 1
LastSuccessfulBackupTime        : 2009/08/07 16:00:01
LastSuccessfulBackupTargetPath  : ?Volume{1d553c33-7d8c-11de-afe2-001cc4d190f9}
LastSuccessfulBackupTargetLabel : NewBackup
LastBackupTime                  : 2009/08/07 16:00:01
LastBackupTarget                : NewBackup
LastBackupResultHR              : 0
LastBackupResultDetailedHR      : 0
CurrentOperationStatus          : NoOperationInProgress
DetailedMessage                 :

バックアップが終わりました~

やっとActive Directory Recycle Binを試しました

いや~、やっといろいろと検証を行う時間が取れるようになりました。

そこで、R2の機能でActive Directory Recycle Binを試してみました。この話は既に安納さんのブログをみるといろいろと検証しているので楽にできるかな?なんて思っていました。

まずは、環境作成です。私の場合はHyper-V環境にR2を入れ込んでDCをそのまま立てましたのでフォレスト機能レベルもR2にしました。これで条件は整っています。

が、フォレスト機能レベルがR2だからと言って初期設定ではActive Directory Recycle Binは有効ではありません。そこで有効にするためにはPowershellを使ってコマンドをたたかなくてはいけません。(ただし、RTMではGUIからできるかも?)

ちなみに現在の状態をイベントログで確認すると次のようになっています。ID2120,2121

イベント2120

イベント2121

[管理ツール]-[Active Directory PowerShell] を起動して

Enable-ADOptionalFeature –Identity ‘Recycle Bin Feature’ –Scope ForestOrConfigurationSet –Target 'vmm.classroom.local’

とたたきました。vmm.classroom.localはドメイン名ですね。

これで有効になりました。ちなみにこの状態のイベントログはID2136、2119

イベント2136

イベント2119

で確認できます。

さて、ここで本番

実際にユーザーを作成して、グループなんぞに入れてみて、削除してみます。

ここで本来ならldp.exeなどのツールを使用して復元するのでしょうがめんどくさい・・・

ここではadrestoreというツールを使用します。このツールはsysinternalsで提供されていますのでそれをDLして使います。

そしてコマンドプロンプトより

adrestore –r

そうすると、現在削除されているオブジェクトを見つけてくれて、復活する場合はyを押せば完了。見事に元にもどりました。また今まで所属していたグループにもきちんと入っています。

試しにOUとその配下にユーザーを作成して、OUごと削除してから、adrestoreを使って復元しました。

問題なしですね!

ただし、OUから復元しないといけないのでその点は注意が必要かな

いや~、これは便利です

R2を入れるのであれば、是非この機能はオンにするべきですね

Hyper-Vのエクスポート・インポートに関して

■エクスポート・インポート機能

仮想マシンの構成情報、スナップショットの情報を含めて仮想マシンを移動する機能

仮想マシン毎に保持する関連ファイルを一括処理
・構成ファイル(.xml)
・仮想ディスク(.vhd)
・状態データ(.bin、.vsv)
・スナップショット(.avhd)

エクスポート

構成ファイルのみのエクスポートが可能

インポート

インポート時にIDの再使用可能
ただし、同一ホストに同じGUIDの仮想マシンがすでに存在する場合は、インポートエラーとなる

■エクスポート・インポート利用上の留意事項

パススルーディスクはエクスポート・インポートできない

より確実に仮想マシンの移動を行うには、全てのスナップショットを削除し、仮想マシンを停止した状態でエクスポートを行うことを推奨

仮想ネットワーク構成の設定
・<外部ネットワーク>の構成情報は、インポート時に初期化される。インポート後に、再設定する必要がある
・<内部ネットワーク>または<プライベートネットワーク>の構成情報は、同名の仮想ネットワークがある場合のみネットワーク情報も復元される

オフラインバックアップの手段として、エクスポートを使用する際は外部ネットワークの構成をインポート後に再構成する必要があることに注意する必要がある。

仮想マシンのバックアップに関して

オンラインバックアップ

Windows Server Backup(WSB)ホストレベルバックアップ を使用する方法

WSBとはWindows Server 2008に標準で搭載されているバックアップツールになります。

WSBはVSSに対応しているため、WSBを使用して仮想マシンを停止せずにバックアップすることが可能になります。

ただし、事前にHyper-VのVSSライタをWSBに登録する必要があります。

http://support.microsoft.com/kb/958662/

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionApplication Support{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}Application Identifier

Application Support以下のキーは自分で作成する

REG_SZ:Hyper-V

必要なアップデートモジュール

■KB956697(VSS writerの問題を修正)
Windows Server 2008 Hyper-V VSS writer is not used during a backup job because of corrupted or invalid virtual machine configuration files
http://support.microsoft.com/?kbid=956697

■KB958665(ゲストOS復元後に正常に起動しない問題を修正)
You do not receive an error message after you restore a Windows Server 2008 Hyper-V virtual machine
http://support.microsoft.com/kb/958665/en-us

■KB971394(たまにバックアップが失敗する:特定のエラーが出たときに対処するHOTFIX)
A backup of virtual machines fails when you use the Hyper-V VSS writer to back up virtual machines concurrently on a computer that is running Windows Server 2008
http://support.microsoft.com/kb/971394/en-us

オンラインバックアップを行うための条件

・統合サービスがインストールされ、バックアップ統合サービスが無効になっていない。

・仮想マシンが使用しているすべてのディスクが、ゲスト オペレーティング システム内で NTFS 形式のベーシック ディスクとして構成されている。物理パーティションがダイナミック ディスクまたは FAT 32 ファイル システムとしてフォーマットされている記憶域を使用する仮想マシンでは、オンライン バックアップを実行できません。これは、バックアップおよび復元操作によって完全にサポートされている、容量可変の拡張ハード ディスクとは異なります。

・仮想マシンによって使用されているすべてのボリュームで、ボリューム シャドウ コピー サービスが特定の構成で有効になっている。各ボリュームを、ボリュームのシャドウ コピーを格納する記憶域として使用できることも必要です。たとえば、ボリューム C のシャドウ コピーの記憶域は C: である必要があります。

参考:Planning for Backup
http://technet.microsoft.com/ja-jp/library/dd252619(WS.10).aspx

オフラインバックアップ

オフラインバックアップに関しては2つのアプローチが考えられます。

  • Hyper-Vマネージャより、エクスポート(オフライン)を行う。そのエクスポートしたファイルをバックアップとして保管する方法。
  • WSBやSCDPMなどのバックアップツールを使用して、ホストマシンはオフラインにしてバックアップを取得する方法。