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 1 year has passed since last update.

エイリアスについて

Posted at

●ネットワークインターフェースには、複数のアドレスを割り当てることができる。基本的に、最初に割り当てたアドレスを「プライマリ」アドレス、追加で割り当てたアドレスを「セカンダリ」アドレスと呼ぶ。3つ目、4つ目と複数設定したアドレスも「セカンダリ」アドレスと呼びます。これは、アドレス設定に順位があるわけではなく、「プライマリ」以外のもの、という意味で「セカンダリ」と呼んでいる。

セカンダリアドレスの設定方法は、使用するコマンドによって異なります。

ifconfig コマンドでは、直接セカンダリアドレスを設定することができません。インターフェースに別名(エイリアス)を付与し、そのインターフェースにアドレスを割り当てることで、セカンダリアドレスを設定。

以下のコマンドは、eth0のエイリアスとしてeth0:0を作成し、セカンダリアドレス 192.168.200.1/24 を設定

ifconfig eth0:0 192.168.200.1/24

この手法は現在では非推奨。かわりに ip コマンドによるアドレス設定が推奨。

ip コマンドによるセカンダリアドレスの設定は、プライマリアドレスの設定と同じコマンドを使います。

ip addr add 192.168.200.1/24 dev eth0

※ipコマンドで設定したセカンダリアドレスは ifconfig では参照できない。

●ifconfig コマンドで参照できるようにするには、ipコマンドでのセカンダリアドレス設定時に、labelオプションを使ってインターフェースのエイリアスを設定。

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?