CuBoxのArch Linuxにiptablesを設定

なかなかCuBoxにまとまった時間をかけて設定作業ができてませんが、今日はiptablesだけでも設定しようと思います。

なにはともあれArchWikiで確認です。
iptables – ArchWiki
インストールは
[bash]
pacman -S iptables
[/bash]
ですが、CuBox用のArch Linuxだと最初からインストール済だったようです。
さて、CentOSだと、設定は、
[bash]
/etc/sysconfig/iptables
[/bash]
でしたが、Arch Linuxの場合には、
[bash]
/etc/iptables/iptables.rules
[/bash]
だとのこと。このファイルはなくって、最初からあったsimple_firewall.rulesの中身は、
[bash]
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p icmp -j ACCEPT
-A INPUT -m conntrack –ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -j REJECT –reject-with tcp-reset
-A INPUT -p udp -j REJECT –reject-with icmp-port-unreachable
-A INPUT -j REJECT –reject-with icmp-proto-unreachable
[/bash]
と見慣れたものだったので、新たにiptables.rulesとして作成しました。

でもって、iptablesを起動。
[bash]
systemctl enable iptables
systemctl start iptables
[/bash]

通常通り、
[bash]
iptables -L
[/bash]
で、内容を確認。

ちなみに、設定ファイルを修正したら、
[bash]
systemctl reload iptables
[/bash]
で再読み込み。

※もしも下記のようなエラーが出てうまく動作しなかった場合(実は僕もそうだったのですが)には、
[bash]
iptables: can’t initialize iptables table `filter’: Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
[/bash]
インストール記事のPost Instllation部分を参考にカーネルを最新のものにアップグレードしてみてください。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください