常用配置
更改中科大镜像源(国内食用)
Proxmox6食用
echo "deb http://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription " >> /etc/apt/sources.list.d/pve-no-sub.list
# 注释掉企业源
echo "#deb https://enterprise.proxmox.com/debian/pve buster pve-enterprise" > cat /etc/apt/sources.list.d/pve-enterprise.lis
导入Debian10 CloudInit Image
PVE6中可以直接用Debian10的OpenStack镜像( 国内下载可能比较慢 )
$0请填写虚拟机ID ,$1 为存储地点,例如 ( qm importdisk 1145 debian-10-openstack-amd64.qcow2 local-lvm)
#!/bin/bash
# YFsama PVE导入Debian10 鏡像使用
apt install -y wget
# 国内放个镜像
wget "http://cdimage.debian.org/cdimage/cloud/OpenStack/current-10/debian-10-openstack-amd64.qcow2"
qm importdisk $0 debian-10-openstack-amd64.qcow2 $1
qm set $0 --virtio0 $1:vm-$0-disk-0
qm set $0 --boot c --bootdisk virtio0
qm set $0 --serial0 socket --vga serial0
qm set $0 --ide2 $1:cloudinit
qm template $0
http://bash.rbq.sh/bash/pve_get_debian10_ci.sh
添加NAT网卡
#!/bin/bash
#添加網卡
echo "
auto vmbr1
iface vmbr1 inet static
address 172.24.31.254
netmask 24
bridge-ports none
bridge-stp off
bridge-fd 0
" >> /etc/network/interfaces
ifup vmbr1
# 開啓IP轉發
echo "
net.ipv4.conf.all.forwarding = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.proxy_ndp = 1
net.ipv6.conf.all.accept_ra = 2
" > /etc/sysctl.conf
sysctl -p
# IPtable初始化 保存
iptables -t nat -A POSTROUTING -s '172.24.31.0/24' -o vmbr0 -j MASQUERADE
touch /etc/network/if-pre-up.d/iptables
echo "
#!/bin/sh
/sbin/iptables-restore < /etc/iptables
" > /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
iptables-save > /etc/iptables
奇怪问题
WARNING: Device /dev/dm-45 not initialized in udev database even after waiting 10000000 microseconds.
解决方法(命令行)
udevadm trigger