PVE 迁移新网络网段配置
举例
当前网络环境
ip address : 192.168.31.119/24
gateway: 192.168.31.1
dns:192.168.31.1
目标网络环境
ip address : 192.168.1.119/24
gateway: 192.168.1.1
dns: 192.168.1.1
修改 IP 地址
编辑 /etc/network/interfaces。
auto lo
iface lo inet loopback
iface enp1s0 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.31.119/24
gateway 192.168.31.1
bridge-ports enp1s0
bridge-stp off
bridge-fd 0
iface enp2s0 inet manual
iface wlo1 inet manual
修改后
auto lo
iface lo inet loopback
iface enp1s0 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.1.119/24
gateway 192.168.1.1
bridge-ports enp1s0
bridge-stp off
bridge-fd 0
iface enp2s0 inet manual
iface wlo1 inet manual
这里有一点需要注意,如果是更换主板或者添加新网卡,可能导致配置文件里面的网卡名不一样,注意修改成一致的。
使用命令 ip addr 查看网卡名
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000 link/ether 6c:4b:90:42:7e:57 brd ff:ff:ff:ff:ff:ff再编辑interfaces里面网卡名部分修改对应的
vi /etc/network/interfaces auto lo iface lo inet loopback auto enp0s31f6 iface enp0s31f6 inet manual auto vmbr0 iface vmbr0 inet static address 172.16.1.119/24 gateway 172.16.1.1 bridge-ports enp0s31f6 bridge-stp off bridge-fd 0 iface wlo1 inet manual source /etc/network/interfaces.d/*这里网卡名为
enp0s31f6
修改 hosts
编辑 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.31.119 pve.lan pve
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
主要修改的就是映射地址 192.168.31.119→pve.lan pve
修改后:
127.0.0.1 localhost.localdomain localhost
192.168.1.119 pve.lan pve
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
修改 DNS (必要时修改)
编辑 /etc/resolv.conf。
search lan
nameserver 192.168.31.1
修改后:
search lan
nameserver 192.168.1.1
修改终端提示的 URL(可改可不该,只是提示,自己记住就行)
编辑 /etc/issue。
------------------------------------------------------------------------------
Welcome to the Proxmox Virtual Environment. Please use your web browser to
configure this server - connect to:
https://192.168.31.119:8006/
------------------------------------------------------------------------------
修改后:
------------------------------------------------------------------------------
Welcome to the Proxmox Virtual Environment. Please use your web browser to
configure this server - connect to:
https://192.168.1.119:8006/
------------------------------------------------------------------------------
所有修改玩成后关机,然后新网络环境连接网线并开机。
版权所有 © 【代码谷】 欢迎非商用转载,转载请按下面格式注明出处,商业转载请联系授权,违者必究。(提示:点击下方内容复制出处)
源文:《PVE 迁移新网络网段配置》,链接:https://www.daimagu.com/article/2406071000293063.html,来源:【代码谷】
评论