coreosでdtrfs、RH系でxfsと、ファイルシステムが色々と採用されているっぽいのですが、initについては以下の参考サイトによると意外なことに。
Linux Daily Topics
2014年2月14日 問題の核心はinitにあらず ─Ubuntuの孤立
タイトルにも書いてありますが、Fedora/Red Hat,openSUSE、など比較的メジャーなディストリはsystemdを採用しつつあるらしく、Debianも一応利用可能という事でsystemdが使えるそうだ。
そんな訳で、CentOSもsystemdなんだけど、ファイアウォール回りも結構変わっていて、タイトルの通り、sshの入り口をローカルだけにしたいとき、例えば入口となるサーバーだけsshを開けておいて、他のサーバーはグローバルなsshは閉じているという構成にしたい時に、iptablesでは簡単にできていたのだけど、firewalldというものになったら少しステップを踏む必要があったので、作業メモしておこうと思います。
とりあえず、よく使いそうなコマンドたちを。
[root@cent7 ~]# firewall-cmd -h | grep service
--get-services Print predefined services [P]
--new-service=<service>
Add a new service [P only]
--delete-service=<service>
Delete and existing service [P only]
--list-services List services added for a zone [P] [Z]
--add-service=<service>
Add a service for a zone [P] [Z] [T]
--remove-service=<service>
Remove a service from a zone [P] [Z]
--query-service=<service>
Return whether service has been added for a zone [P] [Z]
[root@cent7 ~]# firewall-cmd -h | grep inter
--get-default-zone Print default zone for connections and interfaces
--get-zone-of-interface=<interface>
Print name of the zone the interface is bound to [P]
--list-interfaces List interfaces that are bound to a zone [P] [Z]
--add-interface=<interface>
Bind the <interface> to a zone [P] [Z]
--change-interface=<interface>
Change zone the <interface> is bound to [Z]
--query-interface=<interface>
Query whether <interface> is bound to a zone [P] [Z]
--remove-interface=<interface>
Remove binding of <interface> from a zone [P] [Z]
自己流にやったので、何かあれば教えてください。
まずはLAN側のインターフェースをpublicからhomeへ。
remove>addじゃなく、changeさせます。
[root@cent7 ~]# firewall-cmd --change-interface=ens4 --zone=home
success
home (active)
interfaces: ens4
services: dhcpv6-client ipp-client mdns samba-client ssh
icmp-blocks:
public (default, active)
interfaces: ens3
services: dhcpv6-client ssh
icmp-blocks:
続いて、publicのsshを拒否しますというか、削除します。
[root@cent7 ~]# firewall-cmd --remove-service=ssh --zone=public
success
home (active)
interfaces: ens4
services: dhcpv6-client ipp-client mdns samba-client ssh
icmp-blocks:
public (default, active)
interfaces: ens3
services: dhcpv6-client
icmp-blocks:
終わりです。
ifconfigもデフォではなくなり、ipコマンドが中心になるのかどうか知りませんが、今のデファクトスタンダードでもipコマンドは入っているようなので、今のうちから意識してつかっておくのもいいかもしれないですね。
面白いことに
$ ip
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
ip [ -force ] -batch filename
where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |
tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm |
netns | l2tp | tcp_metrics | token }
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
-f[amily] { inet | inet6 | ipx | dnet | bridge | link } |
-4 | -6 | -I | -D | -B | -0 |
-l[oops] { maximum-addr-flush-attempts } |
-o[neline] | -t[imestamp] | -b[atch] [filename] |
-rc[vbuf] [size]}
頭文字だけでもいけるようです。
最初が被ってるやつは2文字目まで入れたらいけるっぽい。
$ ip to
token :: dev ens3
token :: dev ens4