0
1

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.

【環境構築】VyOS

Last updated at Posted at 2023-02-19

はじめに

私は2021年に新卒でインフラエンジニアとして働いています。
その中で、個人的な学習としてESXiのサーバを構築しました。
自分専用のESXiがあると、何かと勉強の幅が広がるので、初級インフラエンジニアの方は持っておくことをおすすめします!

話がそれましたが、ルータやファイヤーウォールとして使用することとができるVyOSを、自由壊れることを気にせずいじりまくれるVM環境の作成手順をまとめました。

VM作成と簡単な設定についてメモ程度で書いていくので、参考にしてみてください。

VM作成手順は下記サイトへ移動しました。

各種設定

他の設定については、随時追加していこうと思います。

ter len 0

セッションごとにコマンド入力する必要があります。

set terminal length 0

基本設定全般

# ホスト名
set system host-name <ホスト名>

# タイムゾーン
set system time-zone <タイムゾーン>
## 例:東京
set system time-zone Asia/Tokyo

# ドメイン名
set system domain-name <ドメイン名>

NTPサーバ設定

# デフォルトNTP設定削除
delete service ntp 

# NTPサーバ設定
set service ntp server <NTPサーバのIP>

# NTP同期で使用するインターフェース
set service ntp interface <インターフェース名>

# 同期確認
$ show ntp

ユーザ作成

# 作成コマンド
set system login user <ユーザ名> authentication plaintext-password <パスワード>

IPアドレス設定

# 物理インターフェースにIP設定
set interfaces ethernet <インターフェース名> address <IP>
## 例:eth0に192.168.1.1/24を設定
set interfaces ethernet eth0 address '192.168.1.1/24'

## VLANインターフェースにIP設定
set interfaces ethernet <インターフェース名> vif <vlan番号> address <IP>
## 例:eth0にvlan10として192.168.1.1/24を設定
set interfaces ethernet eth0 vif 10 address '192.168.1.1/24'

スタティックルーティング設定

# 設定コマンド
set protocols static route <宛先IPアドレス>/<サブネット> next-hop <ネクストホップIPアドレス>
## 例:ネクストホップ192.168.1.1のデフォルトゲートウェイ
 set protocols static route 0.0.0.0/0 next-hop 192.168.1.1

# ルーティングテーブル確認
$ show ip route

VRF設定

# VRFインスタンス作成
set vrf name <VRF名>

# ルーティングテーブル作成
set vrf name <VRF名> table <番号>
## ※番号は100~65535

# VRFが各プロトコルを使用できるようにする
set vrf bind-to-all

# インターフェースを割り当てる
set interfaces ethernet <インターフェース名> vrf <VRF名>
## VLANの場合
set interfaces ethernet <インターフェース名> vif <vlan番号> vrf <VRF名>

# vrf別のスタティックルーティング設定
set vrf name <vrf名> protocols static route <NWセグメン>/<サブネット> next-hop <IP>

参考にしたリンク集

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?