LoginSignup
1
2

More than 5 years have passed since last update.

OpenStack neutronのrouter, firewall, security_groupを外部仕様から理解する

Last updated at Posted at 2016-05-16

OpenStack(Icehouse)を前提。
(注意点のいくつかは最新のバージョンでは直っているかも?)

Neutronとはなにか

お客さんごとに独立した通信(=マルチテナント)を実現するための、ネットワーク管理機能を提供するコンポーネント

以下説明は、networkとsubnet,およびportについての理解を前提としています。

router

subnet同士を接続し、L3レベルのルーティングを行う。
(一般的なルーターと概念はよく似ている)

【最も簡単な構成例】

-subnet 1-------------------------------
         |
       [router 1]
         |
-subnet 2-------------------------------

上記の構成で、subnet1上のマシンからrouter1に向けてパケットが送られると、
宛先をsubnet2上でも探す。

【routerにルーティングを設定する場合】

routerは以下のように、ルーティングを設定できる。

neutron router-update router1 --routes type=dict list=true \
destination=XX.XX.XX.0/24,nexthop=[router 2のIP]
neutron router-update router2 --routes type=dict list=true \
destination=YY.YY.YY.0/24(subnet2のCIDR),nexthop=[router 1のIP]

例えば、上記のルーティングを以下のネットワーク構成で設定すると、
subnet2のマシンとrouter2を経由した外のsubnetと通信することが可能になる。

                       ︙ 
                   [router 2] 
                       |
-subnet 1-------------------------------
         |←(デフォルトゲートウェイ)
       [router 1]
         |←(デフォルトゲートウェイ)
-subnet 2-------------------------------

注意点:

routerが所属するサブネットへのルーティングには注意が必要
例えば、「100.100.10.0/24」のサブネットに属するrouterに
destination=100.100.10.0/24のルーティングを追加すると、
他のルーティングが無効になる。
そのため、「destination=100.100.10.0/25」と「destination=100.100.10.128/25」に分割するなどの工夫が必要

firewall

firewallはrouterに被せて設定する。各概念は以下の対応関係となっている。

[router]---1:1---[firewall]---1:1---[firewall policy]---1:N---[firewall rule]

firewall-ruleに通信の許可/拒否ルールを設定する。
設定できるのは以下

  • source-ip-address(通信元IP)
  • destination-ip-address (通信先IP)
  • source-port (通信元ポート番号)
  • destination-port (通信先ポート番号)
  • protocol (tcp,udp,icmp,any)
  • action (allow,deny,reject)
  • ip-version (4,6)

firewall-policyに設定されたfirewall-ruleは、設定順に評価される。
順序の制御は、neutron firewall-policy-insert-rule
で行う。

注意点:

firewallを設定すると、firewallが設定されたrouterを経由した通信は、
行きと帰りの通信経路を一致させなければいけない

security_group

security_groupはportごとに設定可能。

[port]---1:N---[security_group]---1:N---[security_group_rule]

※portはVMのNICごとと考えて良い

security_groupは許可のルールのみしか設定できない
なにも設定されていない場合は、すべての通信ができない

security_group_ruleに設定できる項目は以下

  • direction (ingress,egress) ※portの入ってくる通信か出て行く通信か
  • protocol tcp, ipなどを設定(プロトコル番号を指定することもできる)
  • port-range-min ポート番号の範囲の最小
  • port-range-max ポート番号の範囲の最大
  • remote-ip-prefix 通信を許可する、CIDRを指定する
  • remote-group-id 通信を許可する相手先のsecurity_group_idを指定する
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2