pve 一個(gè)ip轉(zhuǎn)個(gè)其下虛擬機(jī)ip

1、配置/etc/network/interfaces

參考官方文檔地址https://pve.proxmox.com/wiki/Network_Configuration

## 真實(shí)ip
auto eno1
iface eno1 inet static
        address 192.168.1.196/24
        gateway 192.168.1.204

## 通過bridge 分配給虛擬機(jī)的子ip
auto vmbr0
iface vmbr0 inet static
        address 192.168.2.1/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '192.168.2.0/24' -o eno1 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.2.0/24' -o eno1 -j MASQUERADE
        post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
        post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1

2、配置虛擬機(jī)的ip(我這邊是ubuntu20)

執(zhí)行nano /etc/netplan/00-installer-config.yaml,在這個(gè)文件中配置具體ip

network:
  ethernets:
    ens18:
      addresses:
        - 192.168.2.100/24
      gateway4: 192.168.2.1
      nameservers:
        addresses:
          - 8.8.8.8

重啟網(wǎng)卡執(zhí)行 netplan apply

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容