FreeBSD 13でbhyveを使用してUbuntu 21.04をエミュレートすると、インターネットに接続できません。

FreeBSD 13でbhyveを使用してUbuntu 21.04をエミュレートすると、インターネットに接続できません。

FreeBSD 13では、bhyveのネットワークスタックを以下のように設定しましたが、ubuntu VMはインターネットに接続できませんでした。

1) on /etc/rc.conf : gateway_enable="YES"
    
2) root@marietto:/home/marietto # sysctl net.inet.ip.forwarding=1
net.inet.ip.forwarding: 1 -> 1

3) root@marietto:/home/marietto # sysctl net.link.tap.up_on_open=1
net.link.tap.up_on_open: 1 -> 1

次に、コンソールで次の操作を行います。

root@marietto:/home/marietto # kldload vmm

kldload: can't load vmm: module already loaded or in kernel

root@marietto:/home/marietto # ifconfig tap0 create up

root@marietto:/home/marietto # ifconfig bridge0 create up

root@marietto:/home/marietto # ifconfig bridge0 addm em0
ifconfig: BRDGADD em0: File exists

root@marietto:/home/marietto # ifconfig bridge0 addm tap0

root@marietto:/home/marietto/Desktop/Files/Bhyve/bhyve # ifconfig

em0: flags=8963<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=4810099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWFILTER,NOMAP>
ether e0:d5:5e:e2:1f:22
inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 58:9c:fc:10:ff:b7
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
       ifmaxaddr 0 port 5 priority 128 path cost 2000000
member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
       ifmaxaddr 0 port 1 priority 128 path cost 2000000
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>

vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether fe:40:5d:c8:de:75
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
groups: bridge vm-switch viid-4c918@
nd6 options=9<PERFORMNUD,IFDISABLED>

tap0: flags=8903<UP,BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
ether 58:9c:fc:10:ff:8e
groups: tap
media: Ethernet autoselect
status: no carrier
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

次のコマンドを使用してubuntu 21.04 VMを起動します。

bhyve -c 4 -m 8G -w -H \
        -s 0,hostbridge \
        -s 4,virtio-blk,/mnt/da1p1/vms/os/ubuntu-budgie-gpu/ubuntu-2104-gpu.img \
        -s 5,virtio-net,tap0 \
        -s 29,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
        -s 30,xhci,tablet \
        -s 31,lpc -l com1,stdio \
        -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
        -s 6,hda,play=/dev/dsp8,rec=/dev/dsp8 \
        vm0

添付の写真に示すように、Ubuntu VMはインターネットに接続できません。理由を理解するのに役立ちますか? Ubuntuに何か問題があると確信しています。

ここに画像の説明を入力してください。 ここに画像の説明を入力してください。 ここに画像の説明を入力してください。 ここに画像の説明を入力してください。

ベストアンサー1

おすすめ記事