服务器运维之家
    • 服务器运维之家
    服务器运维之家
    • 首页
    • 服务器运维
      • Linux技巧
      • Linux教程
      • 环境搭建
      • 运维编程
      • Windows系统
    • DNS/CDN相关
    • VPS优惠
      • 韩国VPS
      • 香港VPS
      • 美国VPS
    • 域名
    • 白嫖的知识
    • 工具干货
    • 网站主题
      • WordPress
      • Typecho
    • 开源代码
    服务器运维之家
    首页 » 服务器运维 » Linux教程 » Centos7 添加 IPV6 地址
    Linux教程

    Centos7 添加 IPV6 地址

    2022年08月14日
    收录于话题
    #centos7 3 #添加IPv6地址

    Centos7 添加 IPV6 地址

    前言

    大家应该买过含IPV6地址的服务器,或者多个IPV4地址的服务器,但是有的商家不会自动绑定,需要我们手动绑定.

     

    正文

    临时添加

    ip -6 addr add 2605:6400:0020:130d::2/64 dev eth0
    

    使用ifcongfig

     
    eth0: flags=4163 mtu 1500
     
    inet xxx.xxx.xxx.xxx netmask 255.255.255.0 broadcast 205.185.121.255
     
    inet6 2605:6400:20:130d::2 prefixlen 64 scopeid 0x0
     
    inet6 fe80::216:45ff:fe97:af56 prefixlen 64 scopeid 0x20
     
    inet6 2605:6400:20:130d:: prefixlen 128 scopeid 0x0
     
    ether 00:16:45:97:af:56 txqueuelen 1000 (Ethernet)
     
    RX packets 126686795 bytes 31465397496 (29.3 GiB)
     
    RX errors 0 dropped 7 overruns 0 frame 0
     
    TX packets 90533440 bytes 747906361963 (696.5 GiB)
     
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    可以发现已经绑定上了

    永久添加

    首先使用ifconfig查看网卡信息

     
    docker0: flags=4099 mtu 1500
     
    inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
     
    ether 02:42:8d:3b:c1:b2 txqueuelen 0 (Ethernet)
     
    RX packets 0 bytes 0 (0.0 B)
     
    RX errors 0 dropped 0 overruns 0 frame 0
     
    TX packets 0 bytes 0 (0.0 B)
     
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
     
     
     
    eth0: flags=4163 mtu 1500
     
    inet xxx.xxx.xxx.xxx netmask 255.255.255.0 broadcast 205.185.121.255
     
    inet6 fe80::216:45ff:fe97:af56 prefixlen 64 scopeid 0x20
     
    ether 00:16:45:97:af:56 txqueuelen 1000 (Ethernet)
     
    RX packets 126662654 bytes 31463073997 (29.3 GiB)
     
    RX errors 0 dropped 7 overruns 0 frame 0
     
    TX packets 90509939 bytes 747690271954 (696.3 GiB)
     
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
     
     
     
    lo: flags=73 mtu 65536
     
    inet 127.0.0.1 netmask 255.0.0.0
     
    inet6 ::1 prefixlen 128 scopeid 0x10
     
    loop txqueuelen 1000 (Local Loopback)
     
    RX packets 66726308 bytes 30552961591 (28.4 GiB)
     
    RX errors 0 dropped 0 overruns 0 frame 0
     
    TX packets 66726308 bytes 30552961591 (28.4 GiB)
     
    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

    从中可以看到eth0为主网卡,目前绑定的IPV6为fe80::即内网地址

    之后切换到/etc/sysconfig/network-scripts文件夹

    修改对应得配置文件,在最后添加:

     
    IPV6INIT=yes
     
    DNS1=1.1.1.1
     
    DNS2=2a06:98c1:54::bc6
     
    DNS3=2001:4860:4860::8888
     
    IPV6ADDR=2605:6400:0020:130d:0000:0000:0000:0000

    之后systemctl restart network重启网络

    上一篇 Centos7查看用户和用户组的方法
    下一篇 Nginx反向代理之端口转发TCP/UDP

    相关信息

    linux 一键安装 docker,docker-compose

    2022年08月27日

    centos7下安装指定版本gitlab方法(联网+本地两种方法)

    2022年08月11日

    Iptables数据包大小匹配模块length应用

    2022年09月04日

    centos怎么查看端口是否被占用

    2022年08月25日

    热门推荐信息

    Nginx反向代理之端口转发TCP/UDP

    2022年08月14日

    Nginx反向代理之端口转发

    Linux 如何进行多线程下载

    2022年08月10日

    Ubuntu20.04环境下手动编译并安装Redis6.2

    2022年08月09日

    linux centOS7自动同步时间

    2022年08月15日

    linux centOS7自动同步时间

    Iptables数据包大小匹配模块length应用

    2022年09月04日

    Iptables数据包大小匹配模块length应用

    最新内容

    Iptables数据包大小匹配模块length应用

    2022年09月04日

    centos怎么查看端口是否被占用

    2022年08月25日

    linux centOS7自动同步时间

    2022年08月15日

    Linux 系统添加 Swap 交换分区

    2022年08月14日

    Nginx反向代理之端口转发TCP/UDP

    2022年08月14日
    文章导航
    关于本站
    服务器运维之家

    服务器运维,VPS运维,VPS选择,云主机选择,Linux命令

    © 2025 服务器运维之家.
    • 联系我们
    • 返回首页

    按 回车 搜索. 按 Esc 取消.