首页/技术/文章阅读

更换IP以及新增IP不重启的情况下绑定静态IP

技术 2024-10-21 39 0

由于各种原因,经历了更换IP段以及新增IPV6地址的情形。

一共两台机器,一台下手有点快直接重装了,另外一台上面有点搬家麻烦的服务,所以问了问cluade,给出了解决方法,经过测试成功解决,不用再一次花时间重新部署服务了。

打开配置:

sudo nano /etc/network/interfaces

填写静态配置:

# The loopback network interface
auto lo
iface lo inet loopback

The primary network interface

auto eth0

IPv4 configuration

iface eth0 inet static address 1.1.1.222 netmask 255.255.255.1 gateway 1.1.1.1 dns-nameservers 8.8.8.8 8.8.4.4

IPv6 configuration

iface eth0 inet6 static address 2aff:aaaa:cccc::abc/48 netmask 48 gateway 2aff:aaaa:cccc::1 dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844

PS:一般后台都有信息,参考vps内的信息可以得到完整的IP配置。

仔细检查IP配置是否与自己实际情况有出入,检查无误即可重启网络。

重启网络:

sudo systemctl restart networking
至此成功解决。

正文结束

哪吒面板/nezha 使用nginx配置反向代理目前性价比最高的上网vps搭配推荐

评论区

还没有评论,来坐沙发吧。