0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ip ruleコマンドでのポート指定のメモ

Posted at

ip ruleでは以下のような方法でポートの指定ができる

sudo ip rule add ipproto tcp dport 80 blackhole

確認

$ wget -O - http://www.google.com
--2021-08-21 11:30:24--  http://www.google.com/
www.google.com (www.google.com) をDNSに問いあわせています... 172.217.25.68, 2404:6800:4004:818::2004
www.google.com (www.google.com)|172.217.25.68|:80 に接続しています... 失敗しました: 無効な引数です.
www.google.com (www.google.com)|2404:6800:4004:818::2004|:80 に接続しています... 失敗しました: ネットワークに届きません.

ポートを指定するときに使うもの

  • ipproto
    プロトコル
  • sport
    送信元ポート
  • dport
    送信先ポート

ポートを指定する際は 80-81のように範囲で指定することもできる

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?