在运行在PVE上的pfsense安装qemu guest agent

进入pfsense的命令行,按F8进入命令行运行如下的命令:

pkg install -y qemu-guest-agent

cat > /etc/rc.conf.local << EOF

qemu_guest_agent_enable="YES"

qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"

#virtio_console_load="YES"

EOF

cat > /usr/local/etc/rc.d/qemu-agent.sh << EOF

#!/bin/sh

sleep 5

service qemu-guest-agent start

EOF

chmod +x /usr/local/etc/rc.d/qemu-agent.sh
service qemu-guest-agent start

然后重启pfsense虚拟机,VMID是你的pfsense虚拟机编号

qm stop VMID && qm start VMID

如果你就像一键搞定,就用脚本。

https://github.com/Weehooey/pfSense-scripts

Log into the pfSense command line as root
Run curl -LJO https://raw.githubusercontent.com/Weehooey/pfSense-scripts/main/install-qemu-guest-agent.sh
READ THE DOWNLOADED FILE! You should never blindly run scripts from the internet.
Make the file executable chmod +x install-qemu-guest-agent.sh
Run the installation script ./install-qemu-guest-agent.sh
You should now see the IP addresses for the interfaces on the VMs summary page (click the More button to see all of them)

或者如果你访问不了github,就自己本地创建脚本

#!/bin/sh

pkg install -y qemu-guest-agent > /dev/null

cat > /etc/rc.conf.local << EOF
qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
#virtio_console_load="YES"
EOF

cat > /usr/local/etc/rc.d/qemu-agent.sh << EOF
#!/bin/sh
sleep 3
service qemu-guest-agent start
EOF

chmod +x /usr/local/etc/rc.d/qemu-agent.sh

service qemu-guest-agent start

参考资料:

https://www.reddit.com/r/PFSENSE/comments/18l8ibz/easily_install_qemuguestagent_on_pfsenseproxmox/

https://github.com/Weehooey/pfSense-scripts