1、实战规划图

2、多个公网IP模式

2.1 SDN功能开启
# SDN Core:
apt install libpve-network-perl

# 编辑/etc/network/interfaces
# vim /etc/network/interfaces
...
source /etc/network/interfaces.d/*    #最后一行增加

# DHCP IPAM:
apt install dnsmasq

# 禁用服务开机自启动
systemctl disable --now dnsmasq

# FRRouting:
apt install frr-pythontools

# 创建Zones、VNets、Subnets(勾选SNAT)
# vim /etc/pve/sdn/zones.cfg 
simple: simple
        dhcp dnsmasq
        ipam pve

# vim /etc/pve/sdn/vnets.cfg 
vnet: vnet1
        zone simple

# vim /etc/pve/sdn/subnets.cfg 
subnet: simple-192.168.20.0-24
        vnet vnet1
        dhcp-range start-address=192.168.20.100,end-address=192.168.20.150
        gateway 192.168.20.1
        snat 1

2.2 网卡桥接配置
# vim /etc/network/interfaces
...
auto lo
iface lo inet loopback

iface ens18 inet manual
        up route add -net 12.12.12.0 netmask 255.255.255.0 gw 12.12.12.254 dev ens18

auto vmbr0
iface vmbr0 inet static
        address 12.12.12.12/24
        gateway 12.12.12.254
        bridge-ports ens18
        bridge-stp off
        bridge-fd 0

source /etc/network/interfaces.d/*

2.3 开启路由转发
# vim /etc/sysctl.d/99-sysctl.conf 
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1

3、单个公网IP模式

3.1 SDN功能开启:
# SDN Core:
apt install libpve-network-perl

# 编辑/etc/network/interfaces
# vim /etc/network/interfaces
...
source /etc/network/interfaces.d/*    #最后一行增加

# DHCP IPAM:
apt install dnsmasq

# 禁用服务开机自启动
systemctl disable --now dnsmasq

# FRRouting:
apt install frr-pythontools

# 创建Zones、VNets、Subnets(勾选SNAT)
# vim /etc/pve/sdn/zones.cfg 
simple: simple
        dhcp dnsmasq
        ipam pve

# vim /etc/pve/sdn/vnets.cfg 
vnet: vnet1
        zone simple

# vim /etc/pve/sdn/subnets.cfg 
subnet: simple-192.168.20.0-24
        vnet vnet1
        dhcp-range start-address=192.168.20.100,end-address=192.168.20.150
        gateway 192.168.20.1
        snat 1

3.2 网卡桥接配置:
# vim /etc/network/interfaces
...
auto lo
iface lo inet loopback

iface ens18 inet manual

auto vmbr0
iface vmbr0 inet static
        address 12.12.12.12/24
        gateway 12.12.12.254
        bridge-ports ens18
        bridge-stp off
        bridge-fd 0

source /etc/network/interfaces.d/*

3.3 开启路由转发:
# vim /etc/sysctl.d/99-sysctl.conf 
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1

参考:

https://pve.proxmox.com/pve-docs/chapter-pvesdn.html
https://cloud.tencent.com/developer/article/1987346
https://pve-doc-cn.readthedocs.io/zh-cn/latest/index.html

  

posted on 2023-12-28 09:36  a120608yby  阅读(56)  评论(0编辑  收藏  举报