LoginSignup
0
0

More than 3 years have passed since last update.

BSD 系の Network に関する手動設定について

Posted at

FreeNAS などで BSD に触れる機会があり、Linuxと微妙にネットワーク設定が異なり、よく忘れるのでメモ。
以下例のfxp0は自環境のデバイス名に読み替える。

現在の IPアドレスを確認

複数のネットワークデバイスがある場合は一覧が表示される。

# ifconfig

ネットワークデバイスfxp0にIPアドレスの指定 (192.168.0.10/24)

# ifconfig fxp0 inet 192.168.0.10 netmask 255.255.255.0

エイリアスの設定 (192.168.0.10 を追加)

# ifconfig fxp0 inet 192.168.0.10 netmask 255.255.255.255 alias

エイリアスを無効にする (192.168.10.10 を無効)

# ifconfig fxp0 inet 192.168.0.10 netmask 255.255.255.255 -alias

メディアタイプの指定 (100base-TX)

# ifconfig fxp0 media 100baseTX

メディアタイプの指定 (10base-T)

# ifconfig fxp0 media 10baseT/UTP

duplex の指定 (full fuplex)

# ifconfig fxp0 media 100baseTX mediaopt full-duplex

auto の設定

# ifconfig fxp0 media autoselect

ネットワークデバイスの up down

DHCP クライアントでIP アドレスを取得したい時も up する。

# ifconfig fxp0 down
# ifconfig fxp0 up

ルーティングテーブルの表示

Linuxの場合。

# route

FreeBSDの場合。

# netstat -nr

default gateway の指定 (192.168.0.254 を指定)

# route add default 192.168.0.254

defalut gateway の削除

# route delete default

経路の追加 -net (172.16.1.0/24 を 192.168.0.253 に)

# route add -net 172.16.1.0 -netmask 255.255.255.0 192.168.0.253

経路の削除

# route delete 172.16.1.0

経路の追加 -host (172.16.1.1 を 192.168.0.253 に)

# route add -host 172.16.1.1 192.168.0.253

経路の検索

# route get 172.16.1.1

経路のモニタ

ルーティングテーブルの変更、検索の失敗、などをモニタリングする。

# route monitor
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