次の方法で共有


既定の FTP ファイアウォールのサポート設定 <firewallSupport>

概要

<siteDefaults> 要素の <ftpServer/firewallSupport> 要素は、FTP サービスが既定でファイアウォールと連携する方法を構成するために使用されます。

この要素を使用すると、サーバー管理者は、パッシブ接続が使用されるときに FTP サービスが FTP クライアントに送信するファイアウォールの外部アドレスを構成できます。

FTP PASV コマンドを使ってパッシブ接続がネゴシエートされると、FTP サーバーはサーバーの IP アドレスとポートを含む応答を送信します。 externalIp4Address 属性を指定すると、FTP クライアントがファイアウォールと通信するように指示でき、クライアント トラフィックが FTP サーバーにルーティングされます。 ファイアウォールの外部 IP アドレスをサイトごとに指定すると、ファイアウォール トラフィックを FTP サイトごとに異なるファイアウォール経由でルーティングできます。

Note

外部 IP アドレスをサイトごとに構成できるだけでなく、FTP サービスがグローバル <system.ftpServer/firewallSupport> 要素で使用するデータ チャネル ポート範囲も指定できます。

互換性

バージョン メモ
IIS 8.5 <firewallSupport> 要素は IIS 8.5 では変更されませんでした。
IIS 8.0 <firewallSupport> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <ftpServer> 要素の <firewallSupport> 要素は、IIS 7.5 の機能として付属しています。
IIS 7.0 <ftpServer> 要素の <firewallSupport> 要素が、IIS 7.0 用の別個のダウンロードとして FTP 7.0 で導入されました。
IIS 6.0 該当なし

Note

FTP 7.0 サービスと FTP 7.5 サービスは IIS 7.0 とは別に出荷され、次の URL からモジュールをダウンロードしてインストールする必要がありました。

https://www.iis.net/expand/FTP

Windows 7 と Windows Server 2008 R2 では、FTP 7.5 サービスは IIS 7.5 の機能として付属しているため、FTP サービスのダウンロードは必要なくなりました。

段取り

Web サーバーの FTP 公開をサポートするには、FTP サービスをインストールする必要があります。 そのためには、次のステップに従います。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。

  2. [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。

  3. [役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。

  4. [サーバーの役割] ページで、[Web サーバー (IIS)] を展開して、[FTP サーバー] を選びます。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP Service] に加えて[FTP 拡張] も選択する必要があります。
    展開された Web サーバー (I S) の一覧の [F T P サーバー] で選択されている F T P サービスと F T P 拡張機能のスクリーンショット。 .

  5. [次へ] をクリックし、[機能の選択] ページで再度 [次へ] をクリックします。

  6. [インストール オプションの確認] ページで、[インストール] をクリックします。

  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。

  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。

  3. [インターネット インフォメーション サービス] を展開し、[FTP サーバー] を展開します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
    Windows 8 インターフェイスで選択された F T P 拡張機能と F T P サービスのスクリーンショット。

  4. OK をクリックします。

  5. 閉じるをクリックします。

Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。

  2. [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。

  3. [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。

  4. [役割サービスの追加] ウィザード[役割サービスの選択] ページで [FTP サーバー] を展開します。

  5. [FTP Service] を選択します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
    展開された F T P サーバーの一覧で選択されている F T P サービスと F T P 拡張機能のスクリーンショット。

  6. 次へ をクリックします。

  7. [インストール オプションの確認] ページで、[インストール] をクリックします。

  8. [結果] ページで、 [閉じる]をクリックします。

Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。

  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。

  3. [インターネット インフォメーション サービス][FTP サーバー] の順に展開します。

  4. [FTP Service] を選択します。

    Note

    FTP サービスに対して ASP.NET メンバーシップ認証または IIS マネージャー認証をサポートするには、[FTP 拡張] も選択する必要があります。
    Windows 7 インターフェイスで選択されている F T P 拡張機能と F T P サービスのスクリーンショット。

  5. OK をクリックします。

Windows Server 2008 または Windows Vista

  1. 次の URL からインストール パッケージをダウンロードします。

  2. 次のチュートリアルの手順に従って、FTP サービスをインストールします。

操作方法

ファイアウォールに既定の外部 IP アドレスを使用するように FTP サービスを構成する方法

  1. 次のようにインターネット インフォメーション サービス (IIS) マネージャーを開きます。

    • Windows Server 2012 または Windows Server 2012 R2 を使用している場合:

      • タスク バーで、[サーバー マネージャー] をクリックし、[ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows 8 または Windows 8.1 を使用している場合:

      • Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
      • [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
    • Windows Server 2008 または Windows Server 2008 R2 を使用している場合:

      • タスク バーで、[スタート] ボタンをクリックし、[管理ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows Vista または Windows 7 を使用している場合:

      • タスク バーで、[スタート][コントロール パネル] の順にクリックします。
      • [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
  2. [接続] ウィンドウでサーバー名をクリックします。

  3. サーバーの [ホーム] ウィンドウで、[FTP ファイアウォールのサポート] をダブルクリックします。

  4. [ファイアウォールの外部 IP アドレス] ボックスに、ファイアウォールのインターネット接続ネットワーク アダプターの IPv4 アドレスを入力します。
    データ チャネル ポート範囲が 0 ダッシュ 0 に設定されている [F T P ファイアウォールサポート] ウィンドウのスクリーンショット。

  5. [操作] ウィンドウで、[適用] をクリックします。

Note

データ チャネルのポート範囲は、グローバル <system.ftpServer/firewallSupport> 要素で構成する必要があります。

FTP サービスのファイアウォール設定を構成する方法の詳細については、Microsoft IIS.NET Web サイトの次のトピックを参照してください。

FTP ファイアウォール設定の構成
https://www.iis.net/learn/publish/using-the-ftp-service/configuring-ftp-firewall-settings-in-iis-7

構成

属性

属性 説明
externalIp4Address 省略可能な文字列属性。

ファイアウォールの外部 IPv4 アドレスを指定します。

既定値はありません。

子要素

なし。

構成サンプル

次の構成サンプルは、既定のファイアウォール設定を定義するサーバーの <firewallSupport> 要素の例を示しています。

<siteDefaults>
   <ftpServer>
      <firewallSupport externalIp4Address="169.254.10.10" />
   </ftpServer>
</siteDefaults>

サンプル コード

次のコード サンプルは、FTP サービスの既定のファイアウォール設定を構成する方法を示しています。

AppCmd.exe

REM Configure the default external IP address of a firewall.
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.ftpServer.firewallSupport.externalIp4Address:"169.254.10.10" /commit:apphost

Note

AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();
         ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");
         ConfigurationElement siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");
         ConfigurationElement ftpServerElement = siteDefaultsElement.GetChildElement("ftpServer");

         ConfigurationElement firewallSupportElement = ftpServerElement.GetChildElement("firewallSupport");
            firewallSupportElement["externalIp4Address"] = @"169.254.10.10";

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample
   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration
      Dim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
      Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")
      Dim ftpServerElement As ConfigurationElement = siteDefaultsElement.GetChildElement("ftpServer")

      Dim firewallSupportElement As ConfigurationElement = ftpServerElement.GetChildElement("firewallSupport")
         firewallSupportElement("externalIp4Address") = "169.254.10.10"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");
var ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer");

var firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport");
   firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10";

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")
Set ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer")

Set firewallSupportElement = ftpServerElement.ChildElements.Item("firewallSupport")
   firewallSupportElement.Properties.Item("externalIp4Address").Value = "169.254.10.10"

adminManager.CommitChanges()