「OpenWrtで OpenVPN(4) Firewallの設定」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
*OpenWrtで OpenVPN(4) Firewallの設定
DD-WRTではiptablesコマンドを利用してFirewallを設定していましたが、OpneWrtのLuCIにはFirewall設定用のGUIが用意されています。
iptablesの使用例は多数ありますので、ここではGUIからの設定を紹介します。
Zone設定についてはほぼ以下のサイト中の"Modify your firewall"の通リです。
>Openwrt configuration example with 2 OpenVpn Tunnel
>http://wiki.openwrt.org/doc/howto/vpn.client.openvpn.tun
**1.LuCIを利用したZone設定
LuCI の Network → Interfaces画面
Add new Interfaces ボタン
Create interface画面での設定
Name of the new interface: vpn
Protocol of the new interface: Unmanaged
Cover the following interface: Ehternet Adapter: tun0
Submitボタンを押すと、Firewallの Zone 設定画面へ画面が遷移します。
Zone Settings - Zone "vpn" 画面での設定
Zone "vpn"
Name: vpn
Input: accept
Output: accept
Forward: accept
Masquerading: x ("x"はチェック)
Covered networks: vpn=x
Inter-Zone Forwarding
Allow forward to destination zones: lan=x
Allow forward from source zones: lan=x
----
LuCI画面スクリーンショット
&ref(FWゾーン設定1.PNG)
&ref(FWゾーン設定2.PNG)
----
**2.Traffic Rules の追加
***(1)ACCEPT INPUT
FirewallのTraffic Rulesタブ → Open ports on router のAddボタン
※以下の内容になるよう各項目を設定して下さい。
Any UDP
From [any host] in [wan]
To [any router IP] at port [1194] on [this device]
***(2)ACCEPT FORWARD
クライアントがVPN経由でWANへ接続できるようにForwardルールを追加します。
FirewallのTraffic Rulesタブ → New forward rule のAddボタン
※以下の内容になるよう各項目を設定して下さい。
Any traffic
From [any host] in [vpn]
To [any host] in [wan]
----
LuCI画面スクリーンショット
&ref(FWトラフィックルール設定.PNG)
----
**3.生成されたコンフィグの内容
LuCIで設定した内容は以下のようにコンフィグに反映されます。
***(1)Interface
/etc/config/network
config interface 'vpn'
option proto 'none'
option ifname 'tun0'
***(2)Firewall
/etc/config/firewall
config zone
option name 'vpn'
option input 'ACCEPT'
option output 'ACCEPT'
option network 'vpn'
option forward 'ACCEPT'
option masq '1'
config forwarding
option dest 'lan'
option src 'vpn'
config forwarding
option dest 'vpn'
option src 'lan'
config rule
option target 'ACCEPT'
option src 'wan'
option proto 'udp'
option dest_port '1194'
option name 'vpn-input'
config rule
option target 'ACCEPT'
option src 'vpn'
option dest 'wan'
option name 'vpn-forward'
-以上-
*OpenWrtで OpenVPN(4) Firewallの設定
DD-WRTではiptablesコマンドを利用してFirewallを設定していましたが、OpneWrtのLuCIにはFirewall設定用のGUIが用意されています。
iptablesの使用例は多数ありますので、ここではGUIからの設定を紹介します。
Zone設定についてはほぼ以下のサイト中の"Modify your firewall"の通リです。
>Openwrt configuration example with 2 OpenVpn Tunnel
>http://wiki.openwrt.org/doc/howto/vpn.client.openvpn.tun
**1.LuCIを利用したZone設定
LuCI の Network → Interfaces画面
Add new Interfaces ボタン
Create interface画面での設定
Name of the new interface: vpn
Protocol of the new interface: Unmanaged
Cover the following interface: Ehternet Adapter: tun0
Submitボタンを押すと、Firewallの Zone 設定画面へ画面が遷移します。
Zone Settings - Zone "vpn" 画面での設定
Zone "vpn"
Name: vpn
Input: accept
Output: accept
Forward: accept
Masquerading: x ("x"はチェック)
Covered networks: vpn=x
Inter-Zone Forwarding
Allow forward to destination zones: lan=x
Allow forward from source zones: lan=x
----
LuCI画面スクリーンショット
&ref(FWゾーン設定1.PNG)
&ref(FWゾーン設定2.PNG)
----
**2.Traffic Rules の追加
***(1)ACCEPT INPUT
FirewallのTraffic Rulesタブ → Open ports on router のAddボタン
※以下の内容になるよう各項目を設定して下さい。
Any UDP
From [any host] in [wan]
To [any router IP] at port [1194] on [this device]
***(2)ACCEPT FORWARD
クライアントがVPN経由でWANへ接続できるようにForwardルールを追加します。
FirewallのTraffic Rulesタブ → New forward rule のAddボタン
※以下の内容になるよう各項目を設定して下さい。
Any traffic
From [any host] in [vpn]
To [any host] in [wan]
----
LuCI画面スクリーンショット
&ref(FWトラフィックルール設定-1.PNG)
----
**3.生成されたコンフィグの内容
LuCIで設定した内容は以下のようにコンフィグに反映されます。
***(1)Interface
/etc/config/network
config interface 'vpn'
option proto 'none'
option ifname 'tun0'
***(2)Firewall
/etc/config/firewall
config zone
option name 'vpn'
option input 'ACCEPT'
option output 'ACCEPT'
option network 'vpn'
option forward 'ACCEPT'
option masq '1'
config forwarding
option dest 'lan'
option src 'vpn'
config forwarding
option dest 'vpn'
option src 'lan'
config rule
option target 'ACCEPT'
option src 'wan'
option proto 'udp'
option dest_port '1194'
option name 'vpn-input'
config rule
option target 'ACCEPT'
option src 'vpn'
option dest 'wan'
option name 'vpn-forward'
-以上-