Closed2

[解決済み] Docker が動いてる環境の KVM仮想マシンから外部へIPv4通信ができない

mnodmnod

環境は Raspberrypi OS buster。
KVM仮想マシンのNWはブリッジ接続。

brctl show 抜粋
br0             8000.dca632bf8c70       no              eth0
                                                        tap0
ip link show tap0 抜粋
8144: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT group default qlen 1000
sysctl net.ipv4.ip_forward 結果
net.ipv4.ip_forward = 1
  • IPv6 だとKVM仮想マシンから外部へ通信することができる。
  • IPv4 だとKVMホストまでしか通信できない。
  • KVM仮想マシン間での通信はためしていない。ブリッジ接続以外もためしていない。

関連すると思われる情報
https://vivinko.com/inoue/blog/2018/05/17/161848.html
https://askubuntu.com/questions/895109/with-ubuntu-16-04-and-kvm-i-cant-get-vms-to-network-without-using-nat
https://qiita.com/mochizuki875/items/c69bb7fb2ef3a73dc1a9

mnodmnod

https://inoccu.com/blog/2018/05/17/161848.html
まさに、Dockerを動かしてる環境でKVMを動かそうとしていた。
上記を参考にして設定したら通信可能になった。

下記の Example 2 にも記載がある。
https://manpages.ubuntu.com/manpages/xenial/man5/sysctl.d.5.html

具体的には、下記の2ファイルを新規作成して、OS再起動する。

/etc/udev/rules.d/99-bridge.rules
ACTION=="add", SUBSYSTEM=="module", KERNEL=="br_netfilter", RUN+="/lib/systemd/systemd-sysctl --prefix=/net/bridge"
/etc/sysctl.d/bridge.conf
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
このスクラップは2023/04/05にクローズされました