<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE feed [
      <!ENTITY lt "&#38;#60;">
      <!ENTITY gt "&#62;">
      <!ENTITY amp "&#38;#38;">
      <!ENTITY apos "&#39;">
      <!ENTITY quot "&#34;">
      <!ENTITY nbsp "&#160;">
      <!ENTITY copy "&#169;">
]>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">ブログ</title>
    <subtitle type="text">UJP-Unwired Job Professional</subtitle>
    <updated>2026-05-02T01:31:52+09:00</updated>
    <id>http://www.ujp.jp/modules/d3blog/index.php</id>
    <link rel="alternate" type="text/xhtml" hreflang="ja" href="http://www.ujp.jp/" />
    <link rel="self" type="application/atom+xml" href="http://www.ujp.jp/modules/d3blog/index.php?page=atom" />
    <rights>Copyright (c) 1995-2020</rights>
    <generator uri="http://www.ujp.jp/">D3BLOG - XOOPS BLOG MODULE</generator>
    <entry>
        <title>FWX120でURLフィルタを使ってみる</title>
        <link rel="alternate" type="text/xhtml" href="http://www.ujp.jp/modules/d3blog/details.php?bid=9666" />
        <id>http://www.ujp.jp/modules/d3blog/details.php?bid=9666</id>
        <published>2023-11-10T01:55:08+09:00</published>
        <updated>2023-12-07T15:39:57+09:00</updated>
        <category term="FWX120" label="FWX120" />
        <author>
            <name>ujpblog</name>
        </author>
        <summary type="html" xml:base="http://www.ujp.jp/" xml:lang="ja">　ヤマハのファイアウォールルータには，「外部データベース参照型URLフィルター」という機能があって，トレンドマイクロとかの外部の会社が提供するURLリストとレピテーション情報を...</summary>
       <content type="html" xml:lang="ja" xml:base="http://www.ujp.jp/">
<![CDATA[<div>　ヤマハのファイアウォールルータには，「外部データベース参照型URLフィルター」という機能があって，トレンドマイクロとかの外部の会社が提供するURLリストとレピテーション情報をリスト化して参照する仕組みがあるのだけど，それを使わないでただのファイアウォールとして使う場合のURLフィルタを使ってみることにした．<br />　つまり，今回の場合「内部データベース参照型URLフィルター」を使うということになる．<br /><br />　GUIじゃなくてコマンドラインで入れたいタイプなので，試行錯誤したけど，想定通りうまくいかなかった．それは次の３つの視点について理解が足りてなかった．<br /><br /><li>URLフィルタは，HTTP向けが先で，HTTPS用は後から追加された<br /><li>HTTP向けのフィルタはルータへの入り口で効き，HTTPSはルータに入った後で効く<br /><li>世の中のWebサイトはHTTPとHTTPS両方用意されているわけでは無い<br /><br />　特に３つ目の部分でハマった．<br /><br />　まずは最小限のHTTPのみのURLフィルタを設定した例．<br /><br /><div class="xoopsCode"><pre><code>ip route default gateway 192.168.20.1
ip lan1 address 192.168.100.1/24
ip lan2 address 192.168.20.50/24
ip lan2 nat descriptor 200
url lan2 filter out 10600 10727 🈁
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
url filter 10600 reject toyota * 🈁
url filter 10727 pass * * 🈁
dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
dns server 1.1.1.1
dns private address spoof on</code></pre></div>　この例では，url filterの10600でtoyotaという文字がURLに含まれているとブロックされ，それ以外は10727によって通過できる．<br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11928&FWX120_2a.jpg" align="center" alt="" /></center><br />　この設定で，toyotaにアクセスしようとするとこうなる．<br /><br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11925&FWX120_1.jpg" align="center" alt="" /></center><br />　ちなみに，トヨタにアクセスしたく無いのではなく，HTTPサイトが用意されているのでtoyotaがちょうどよかった．．．<br /><br />　次に，HTTPSでのURLフィルタを追加設定した例．<br /><br /><div class="xoopsCode"><pre><code>ip route default gateway 192.168.20.1
ip lan1 address 192.168.100.1/24
url lan1 proxy filter in https-proxy 1010000 1010127 🈁
ip lan2 address 192.168.20.50/24
ip lan2 nat descriptor 200
url lan2 filter out 10600 10727
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
url filter 10600 reject toyota *
url filter 10727 pass * *
url filter 1010000 reject nissan * 🈁
url filter 1010127 pass * * 🈁
url filter https-proxy use on 🈁
dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
dns server 1.1.1.1
dns private address spoof on</code></pre></div>　この例では，url filterの1010000でnissanという文字が含まれているとブロックされ，それ以外は1010127によって通過できる．<br /><br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11927&FWX120_2b.jpg" align="center" alt="" /></center><br />　この設定を生かすためには，url filter https-proxy use onによってルータ内(今回はFWX120)でHTTPSプロキシを稼働させておく必要がある．<br />　定義した1010000と1010127は，url lan1 proxyによって評価される．<br /><br />　PCなどの通信元ではルータ(FWX120)上で動作するHTTPSプロキシに接続するように設定が必要になる．<br /><br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11924&FWX120_3.jpg" align="center" alt="" /></center><br />　例えば，Windows 10のプロキシ設定．<br />　「設定を自動的に検出する」となっている場合，wpad.datファイルがダウンロードされてプロキシが設定される．<br /><br />　暗黙的にダウンロードされるwpad.datファイルは次のようなものでした．<br /><div class="xoopsCode"><pre><code>function FindProxyForURL(url, host)
{
  var hostip = dnsResolve(host);
  if (isInNet(hostip, &quot;127.0.0.1&quot;, &quot;255.255.255.255&quot;) ||
      isInNet(hostip, &quot;192.168.100.0&quot;, &quot;255.255.255.0&quot;)) {
    return &quot;DIRECT&quot;;
  }
  if (url.substring(0, 6) == &quot;https:&quot; ||
      shExpMatch(host, &quot;update.microsoft.com&quot;) ||
      shExpMatch(host, &quot;*.update.microsoft.com&quot;)) {
    return &quot;PROXY 192.168.100.1:8080&quot;;
  }
  return &quot;DIRECT&quot;;
}</code></pre></div>　ちなみに，デフォルトで，8080ポートになるが，url filter https-proxy liten 8081などでポートを変更することも可能．<br />　<br />　URLフィルタでブロックされたサイトにアクセスした場合，HTTPSだとエラーページが用意されてないので，次のようになる．<br /><br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11926&FWX120_4.jpg" align="center" alt="" /></center><br /><br />　おまけとして今回使った全設定．<br /><br /><div class="xoopsCode"><pre><code>login password *
administrator password *
console character ascii
console prompt [FWX120-1]
login timer 6666666
ip route default gateway 192.168.20.1
ip keepalive 1 icmp-echo 10 5 192.168.20.1
ip lan1 address 192.168.100.1/24
url lan1 proxy filter in https-proxy 1010000 1010127
ip lan2 address 192.168.20.50/24
ip lan2 nat descriptor 200
url lan2 filter out 10600 10727
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
nat descriptor masquerade static 200 1 192.168.100.20 tcp www
url filter 10600 reject toyota *
url filter 10727 pass * *
url filter 1010000 reject nissan *
url filter 1010127 pass * *
url filter https-proxy use on
syslog debug off
telnetd host lan
dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
dns server 1.1.1.1
dns private address spoof on
schedule at 1 */* 09:00:00 * ntpdate ntp.nict.jp
schedule at 2 */* 21:00:00 * ntpdate ntp.jst.mfeed.ad.jp
httpd host lan1
statistics traffic on</code></pre></div></div>]]>
       </content>
    </entry>
    <entry>
        <title>FWX120でポートフォワードしてみた</title>
        <link rel="alternate" type="text/xhtml" href="http://www.ujp.jp/modules/d3blog/details.php?bid=9664" />
        <id>http://www.ujp.jp/modules/d3blog/details.php?bid=9664</id>
        <published>2023-11-08T11:06:36+09:00</published>
        <updated>2023-12-07T15:40:33+09:00</updated>
        <category term="FWX120" label="FWX120" />
        <author>
            <name>ujpblog</name>
        </author>
        <summary type="html" xml:base="http://www.ujp.jp/" xml:lang="ja">　随分前に買ったヤマハのファイアウォールルータ，FWX1200をどうにか活用しようとしている計画のうちの検証の１つ．　ポートフォワード機能を使って，特定のIPアドレスの特定のポート...</summary>
       <content type="html" xml:lang="ja" xml:base="http://www.ujp.jp/">
<![CDATA[<div>　随分前に買ったヤマハのファイアウォールルータ，FWX1200をどうにか活用しようとしている計画のうちの検証の１つ．<br /><br />　ポートフォワード機能を使って，特定のIPアドレスの特定のポートにきたデータを，別のネットワークにあるサーバに転送しようというもの．<br /><br />　今回実現した設定の構成図はこちら．<br /><br /><center><img src="http://www.ujp.jp/modules/xelfinder/index.php?page=view&file=11917&FWX1200portforward.jpg" align="center" alt="" /></center><br />　RTX1200のLAN1ポート配下にある，FWX120(192.168.20.50)へ，同じネットワークにあるClientPCから80番ポートにアクセスすると，FWX120のLAN1ポートにあるWebサーバ(192.168.100.20)にポート転送するというもの．<br /><br /><div class="xoopsCode"><pre><code>ip route default gateway 192.168.20.1
ip keepalive 1 icmp-echo 10 5 192.168.20.1
ip lan1 address 192.168.100.1/24 
ip lan2 address 192.168.20.50/24
ip lan2 inbound filter list 201 202 203 204 205 206 207 299
ip lan2 nat descriptor 200
ip filter 500000 restrict * * * * *
ip inbound filter 201 reject-nolog * * tcp,udp * 135
ip inbound filter 202 reject-nolog * * tcp,udp 135 *
ip inbound filter 203 reject-nolog * * tcp,udp * netbios_ns-netbios_ssn
ip inbound filter 204 reject-nolog * * tcp,udp netbios_ns-netbios_ssn *
ip inbound filter 205 reject-nolog * * tcp,udp * 445
ip inbound filter 206 reject-nolog * * tcp,udp 445 *
ip inbound filter 207 reject-nolog 192.168.100.0/24 * * * *
ip inbound filter 299 pass-nolog * * * * *
ip policy interface group 101 name=Private local lan1
ip policy address group 101 name=Private 192.168.100.0/24
ip policy address group 102 name=Any *
ip policy service 1000 @tcp/80 tcp * 80
ip policy service 1001 @tcp/22 tcp * 22
ip policy service group 101 name=&quot;Open Services&quot;
ip policy service group 102 name=General dns
ip policy service group 103 name=Mail pop3 smtp submission
ip policy service group 1100 name=Masq1100 @tcp/80 @tcp/22
ip policy filter 1100 reject-nolog lan1 * * * *
ip policy filter 1110 pass-nolog * * * * 102
ip policy filter 1122 static-pass-nolog * lan1 * * *
ip policy filter 1123 static-pass-nolog * local * * *
ip policy filter 1124 static-pass-log * * 192.168.100.0/24 * http
ip policy filter 1460 pass-nolog * lan2 * * *
ip policy filter 1700 pass-nolog local * * * *
ip policy filter 1710 static-pass-nolog * lan1 * * *
ip policy filter 1900 reject-nolog lan2 * * * *
ip policy filter 1920 pass-log * lan1 * * 101
ip policy filter 3000 reject-nolog * * * * *
ip policy filter 4100 pass-nolog * * * 192.168.100.20 1100
ip policy filter set 101 name=&quot;Internet Access&quot; 1100 [1110 1123 [1124] 1122 1460] 1900 [4100 1920] 1700 [1710] 3000
ip policy filter set enable 101
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
nat descriptor masquerade static 200 1 192.168.100.20 tcp www
dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
dns server 192.168.20.1
dns private address spoof on</code></pre></div>　分解しながら，明日の自分のためようの解説を．<div class="xoopsCode"><pre><code>ip route default gateway 192.168.20.1
👉上位ルータ（ゲートウェイ）を指定

ip lan2 address 192.168.20.50/24
👉LAN2のIPアドレスの設定

ip lan1 address 192.168.100.1/24 
👉LAN1のIPアドレスの設定


dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
👉LAN1でDHCPサーバを稼働させて割り振るIPアドレスを定義

dns server 192.168.20.1
dns private address spoof on
👉DNSサーバを定義．LAN1でDHCPでIPアドレスをもらったクライアントはこのDNS情報も受け取る

ip lan2 nat descriptor 200
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
👉LAN1に接続したクライアントから上位(外部)のネットワーク通信するためのNATを定義．

nat descriptor masquerade static 200 1 192.168.100.20 tcp www
👉LAN2(192.168.20.50)の80番ポートに来た通信をLAN1の192.168.100.20に転送する


ip inbound filter 201 reject-nolog * * tcp,udp * 135
ip inbound filter 202 reject-nolog * * tcp,udp 135 *
ip inbound filter 203 reject-nolog * * tcp,udp * netbios_ns-netbios_ssn
ip inbound filter 204 reject-nolog * * tcp,udp netbios_ns-netbios_ssn *
ip inbound filter 205 reject-nolog * * tcp,udp * 445
ip inbound filter 206 reject-nolog * * tcp,udp 445 *
ip inbound filter 207 reject-nolog 192.168.100.0/24 * * * *
ip inbound filter 299 pass-nolog * * * * *
ip lan2 inbound filter list 201 202 203 204 205 206 207 299
👉LAN2側から不要な通信がきた場合に通信を拒否する
👉207番のルールは，外部からLAN1のネットワークを偽装してアクセスしてきた場合の通信の遮断

ip keepalive 1 icmp-echo 10 5 192.168.20.1
ip filter 500000 restrict * * * * *

ip policy interface group 101 name=Private local lan1
ip policy address group 101 name=Private 192.168.100.0/24
ip policy address group 102 name=Any *
ip policy service 1000 @tcp/80 tcp * 80
ip policy service group 101 name=&quot;Open Services&quot;
ip policy service group 102 name=General dns
ip policy service group 103 name=Mail pop3 smtp submission
ip policy service group 1100 name=Masq1100 @tcp/80 @tcp/22
ip policy filter 1100 reject-nolog lan1 * * * *
ip policy filter 1110 pass-nolog * * * * 102
ip policy filter 1122 static-pass-nolog * lan1 * * *
ip policy filter 1123 static-pass-nolog * local * * *
ip policy filter 1124 static-pass-log * * 192.168.100.0/24 * http
ip policy filter 1460 pass-nolog * lan2 * * *
ip policy filter 1700 pass-nolog local * * * *
ip policy filter 1710 static-pass-nolog * lan1 * * *
ip policy filter 1900 reject-nolog lan2 * * * *
ip policy filter 1920 pass-log * lan1 * * 101
ip policy filter 3000 reject-nolog * * * * *
ip policy filter 4100 pass-nolog * * * 192.168.100.20 1100
ip policy filter set 101 name=&quot;Internet Access&quot; 1100 [1110 1123 [1124] 1122 1460] 1900 [4100 1920] 1700 [1710] 3000
ip policy filter set enable 101
👉FWX120 GUI「プロバイダ情報の設定」で設定されるフィルタ．
👉1100 LAN1への通信は破棄
👉1110 サービスグループ102(General dns)のパケットは通過させる
👉1122 送信インタフェイスがLAN1のパケットを通過させる静的フィルタ
👉1123 送信インタフェイスがルータ自身(local)のパケットを通過させる
👉1124 送信元が192.168.100.0/24のHTTPプロトコルを通過させる
👉1700 受信インタフェイスがルータ自身(local)のパケットを通過させる
👉1710 送信インタフェイスがLAN1のパケットを通過させる静的フィルタ
👉3000 全てのパケットを破棄
👉Internet Access　各フィルタの評価順を階層構造で定義してInternet Accessという名前で定義
</code></pre></div><br />　ip policy filter set 101の意味を整理してみる．<br /><br /><div class="xoopsCode"><pre><code>1100 [1110 1123 [1124] 1122 1460]
1900 [4100 1920]
1700 [1710] 3000


1100　LAN1への通信は破棄するが，以下は例外
 [
　1110　General Dnsのパケット
　1123 ルータ自身の通信
　[1124] 192.168.100.0/24のHTTPプロトコル
　1122 
　1460
]
1900 LAN2への通信は破棄するが，以下は例外
 [
　4100　LAN1にある192.168.100.20へのパケットと，1100(General Dns)のパケットを通過させる
　1920　送信インタフェイスがLAN1で，101のサービス(LAN1とルータローカル)を通過させる
]
1700　受信インタフェイスがlocalの通信を通過させる
[
　1710 LAN1のパケットを通過させる
]
3000　ここまでで通過できなかった全てのパケットを廃棄</code></pre></div>　ただポートフォワードするだけじゃなくて，不要なプロトコルは厳密に遮断しているので定義がたくさんになっている模様．<br /><br />　フィルタ定義も削って最小限にしてみた設定．<br /><div class="xoopsCode"><pre><code>ip route default gateway 192.168.20.1
ip lan1 address 192.168.100.1/24
ip lan2 address 192.168.20.50/24
ip lan2 nat descriptor 200
nat descriptor type 200 masquerade
nat descriptor address outer 200 primary
nat descriptor masquerade static 200 1 192.168.100.20 tcp www
nat descriptor masquerade static 200 2 192.168.100.20 tcp 22
nat descriptor masquerade static 200 3 192.168.100.20 tcp https
dhcp service server
dhcp server rfc2131 compliant except remain-silent
dhcp scope 1 192.168.100.2-192.168.100.191/24
dns server 1.1.1.1
dns private address spoof on</code></pre></div>　これでシンプルかな．<br /><br />　あと，これを上位のルータ(今回の場合はRTX1200)に入れとかないといけない．<br /><div class="xoopsCode"><pre><code>ip route 192.168.100.0/24 gateway 192.168.20.50</code></pre></div></div>]]>
       </content>
    </entry>
</feed>