Help us understand the problem. What is going on with this article?

5行で出来るブリッジネットワークの作り方 in CentOS7.X

More than 3 years have passed since last update.

ブリッジ接続便利ですよね、かなり使ってます。
DockerとかKVMとか利用用途が広いので覚えておくと便利です。
この作り方ならNetworkManagerを止めなくてもOK

ブリッジネットワークの作り方

1行目

# nmcli connection add type bridge con-name br0 ifname br0 stp no

ブリッジ「br0」を作成します。作成の際にSTPは止めておきます。

2行目

# nmcli connection modify br0 ipv4.method manual ipv4.addresses "192.168.0.1/24" ipv4.gateway "192.168.0.254" ipv4.dns 8.8.8.8

今回のキモですipv4.addressesにはブリッジ先のIPを割り当て、ipv4.gatewayにはそのGatewayを、ipv4.dnsには言わずもがなDNSを割り当てます。

3行目

# nmcli connection add type bridge ifname eth0 master br0

このコマンドでeth0とbr0をブリッジ接続しています。

4行目

# nmcli con del eth0

不要になったeth0を削除します。

5行目

# systemctl restart network

ネットワークを再起動して完成です。

昔みたく/etc/sysconfig/network-script/ifcfg-ethXを弄くったりしなくて良くて楽ちんですね!

まとめ(コピペ用)

nmcli connection add type bridge con-name br0 ifname br0 stp no
nmcli connection modify br0 ipv4.method manual ipv4.addresses "IPAddr/24" ipv4.gateway "Gateway" ipv4.dns 8.8.8.8
nmcli connection add type bridge ifname eth0 master br0
nmcli con del eth0
systemctl restart network
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした