LoginSignup
2
4

More than 3 years have passed since last update.

【CentOS7】CentOS7でIPv6をFirewalldで真面目に使う【Firewalld】

Posted at

はじめに

CentOS7(RHEL7系)のfirewalldを使用して、IPv6通信を許可するための設定手順についてちゃんと使ってる事例ないのかなぁと思ったのでメモをまとめました。

設定ファイル置き場

Zone: public の場合以下に置かれているかと思います
- /etc/firewalld/zones/public.xml
デフォルトではsshd,dhcpv6-client等のサービスのみかと思います

  • 確認コマンド
$ sudo firewall-cmd --get-active-zones
public
  interfaces: eth1 eth0
trusted
  interfaces: lo

デフォルト拒否

デフォルト拒否の設定の場合、zoneの設定ファイルの「zone target」がDROPになっているはずです

public..xml
<zone target="DROP">

この場合、IPv6のいくつかの挙動はサービスに紐付かない場合は拒否されると思います。
例えば、
- アドレス付与がRA(SLAAC)の場合
- 同一セグメントユーザとの通信
- IPv6での名前解決

IPv6の基本プロトコル許可

IPv6の基本プロトコル許可をする場合は、以下のようにすると
- リンクローカルユニキャストアドレス (fe80::/10)
- マルチキャストアドレス (ff00::/8)
などの通信を許容することができます

public..xml
<?xml version="1.0" encoding="utf-8"?>
<zone target="DROP">
  <short>Public</short>
  <description>hello</description>
  <interface name="eth0"/>
  <rule family="ipv6">
    <destination address="fe80::/10"/>
    <accept/>
  </rule>
  <rule family="ipv6">
    <destination address="ff00::/8"/>
    <accept/>
  </rule>
</zone>

適用

以下コマンドで適用

$ sudo firewall-cmd --reload

IPv6サービスをアドレスで許可

IPv6サービスをアドレス+ポートで許可するには以下を追加

public.xml
  <rule family="ipv4">
    <source address="xxx.xxx.xxx.xxx"/>
    <port protocol="tcp" port="443"/>
    <accept/>
  </rule>
  <rule family="ipv6">
    <source address="2xxx:xxxx:xxxx:xxxx::xxxx"/>
    <port protocol="tcp" port="443"/>
    <accept/>
  </rule>
2
4
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
2
4