LoginSignup
4
1

More than 5 years have passed since last update.

CentOS6でVLANマッピング

Last updated at Posted at 2016-03-30

はじめに

あるネットワークと別のネットワークでVLAN番号を変えたい場合があると思いますが
お高いスイッチを準備しなくてもNIC2枚挿しのサーバで代替可能です

設定方法

CentOS6をサーバにインストールします 最小構成で十分です
VLANタグを認識するようにします

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.0.2.254
VLAN=yes
VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD

再起動してちゃんとモジュールがロードされているか確認します

% lsmod |grep 8021q
8021q                  20362  0 
garp                    7152  1 8021q

NIC2枚はeth0とeth1としてudevに認識されますが
MACアドレスでちゃんと固定したい場合は/etc/udev/rules.d/70-persistent-net.rulesに設定してください

このeth0とeth1の各VLANをブリッジインターフェースで紐付けます
例えばeth0のVLAN番号100をeth1のVLAN番号200にマッピングしたい場合は

/etc/sysconfig/network-scripts/ifcfg-eth0.100
DEVICE=eth0.100
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
BRIDGE=br200
/etc/sysconfig/network-scripts/ifcfg-eth1.200
DEVICE=eth1.200
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
BRIDGE=br200
/etc/sysconfig/network-scripts/ifcfg-br200
DEVICE=br200
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
STP=off

としてそれぞれのインターフェースをUPするか
ネットワークサービスを再起動します

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