分类 技术分享 下的文章

先停止该服务 sudo systemctl stop systemd-resolved

编辑 /etc/systemd/resolved.conf 文件中[Resolve] 部分为下面代码

[Resolve]
DNS=8.8.8.8
DNSStubListener=no

最后创建修改文件链接

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

dd if=/dev/zero of=/var/swapfile bs=1M count=128
mkswap /var/swapfile
swapon /var/swapfile

128代表设置128M大小的虚拟内存,根据情况自行修改
最后,修改/etc/fstab,添加一行(保证重启系统后,swap依然生效)

/var/swapfile none swap sw 0 0

前面有篇文章讲述如何搭建proxmox,这次主要讲述如何配置网络
开启IPv4,IPv6转发,编辑/etc/sysctl.conf,添加以下内容到尾部:

net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv6.conf.enp3s0.autoconf=0
net.ipv6.conf.enp3s0.accept_ra=2
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.proxy_ndp=1
net.ipv6.conf.all.proxy_ndp=1

其中的enp3s0需要修改为自己的网卡名
最后,编辑/etc/network/interfaces,在下方添加内容如下:

auto vmbr0
#private sub network
iface vmbr0 inet static
        address  10.10.10.1
        netmask  255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0

iface vmbr0 inet6 static
#母鸡的ipv6地址
        address 2400:38e0:1:4191::1/64
  
        post-up iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o enp3s0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o enp3s0 -j MASQUERADE
        post-up ip neigh add proxy 2400:38e0:1:4191::11 dev enp3s0
        pre-downip neigh del proxy 2400:38e0:1:4191::11 dev enp3s0

这样配置好后,开小鸡时,选择桥接 vmbr0,IPv4 和 IPv6 都配置为静态,然后手动输入:

IPv4/CIDR:10.10.10.2/24
网关(IPV4):10.10.10.1

IPv6/CIDR:2400:38e0:1:4191::11/64
网关(IPV6):2400:38e0:1:4191::1