给Debian12增加ipv6地址

给Debian12增加ipv6地址

ipv6 普及后,ipv6 用不完。太多了。但是呢,需要自己添加ipv6,很多运营商会分配ipv6地址,但是需要手动添加到系统中,这里以Debian 12作为演示的例子:
编辑:nano /etc/network/interfaces 在文件下边添加ip就可以了。

auto lo
 iface lo inet loopback

auto eth0
 iface eth0 inet static        #IPv4配置
  address 132.98.174.248       #IPv4
  gateway 132.98.174.193       #IPv4网关
  netmask 255.255.255.192      #子网掩码

 iface eth0 inet6 static       #IPv6配置
  address 1200:7e45:0:f6::1e4a:3705    #IPv6地址
  netmask 48   #掩码
  gateway 1200:7e45:0:f6::1    #IPv6网关

  iface eth0 inet6 static
  address 1200:7e45:0:f6::235e:3b7e  #添加额外IPv6地址
  netmask 48 #掩码

如果这个文件夹没有这些参数设置,提示要去/etc/network/interfaces.d去找配置文件,进入指定文件夹之后就可以看到对应的配置文件,用nano命令来编辑配置文件即可。

还有一个简单的办法就是:

auto lo
 iface lo inet loopback

auto eth0
 iface eth0 inet static
  address 132.98.174.248/26       #IPv4和掩码
  gateway 132.98.174.193

 iface eth0 inet6 static
  address 1200:7e45:0:f6::1e4a:3705/64    #IPv6地址和掩码
  gateway 1200:7e45:0:f6::1
  up ip addr add 1200:7e45:0:f6::1/64 dev eth0 #添加额外IPv6地址
  up ip addr add 1200:7e45:0:f6::2/64 dev eth0 #添加额外IPv6地址
  up ip addr add 1200:7e45:0:f6::3/64 dev eth0 #添加额外IPv6地址

重启网络

/etc/init.d/networking restart

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容