ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Centos7 配置ipv6地址、静态路由

2022-05-28 21:00:07  阅读:89  来源: 互联网

标签:network ipv6 Centos7 eno1 1001 IPV6 yes dd0a 路由


1. 手动配置ipv6地址

1.修改配置文件,eth0换成自己的网口名称1

vim /etc/sysconfig/network-scripts/ifcfg-eth0

具体配置信息如下:

TYPE=Ethernet
BOOTPROTO=static
NAME=eno1
DEVICE=eno1
ONBOOT=yes
IPADDR=192.168.31.3
PREFIX=24
GATEWAY=192.168.31.1
  
IPV6INIT=yes        #网卡初始化IPv6协议栈              
IPV6_AUTOCONF=no    #自动获取地址关闭
IPV6_DEFROUTE=yes   #默认路由开启
IPV6_FAILURE_FATAL=yes # 当设置为yes时,如果发生异常系统会尽可能保持连接可用
IPV6ADDR=2001::2/64    #ipv6地址
IPV6_DEFAULTGW=2001::1 #ipv6网关

2.重启服务

service network restart

2.自动获取ipv6地址2

vim /etc/sysconfig/network-scripts/ifcfg-eth0

具体配置信息如下:

TYPE=Ethernet
BOOTPROTO=static
NAME=eno1
DEVICE=eno1
ONBOOT=yes
IPADDR=192.168.31.3
PREFIX=24
GATEWAY=192.168.31.1

IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=yes
DHCPV6C=yes

2.重启服务

service network restart

3. 静态路由34

3.1 临时添加

添加静态网关:

route -A inet6 add 2400:dd0a:1001:151::1/64 gw 2400:dd0a:1001:140::1

删除:

route -A inet6 del 2400:dd0a:1001:151::1 gw 2400:dd0a:1001:140::1

3.2 永久添加

1.修改路由文件

vim /etc/sysconfig/network-scripts/route-eno1

eno1是网卡名称,对照自己的网卡名称

2400:dd0a:1001:151::1/64 via 2400:dd0a:1001:140::1 dev eno1
210.72.151.1/24 via 210.72.140.1 dev eno1

2.重启服务

service network restart

  1. https://blog.csdn.net/qq_43316775/article/details/104925384 ↩︎

  2. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s1-networkscripts-interfaces#:~:text=One%20of%20the%20most%20common,corresponding%20to%20a%20specific%20interface). ↩︎

  3. https://cloud.tencent.com/developer/article/1485335 ↩︎

  4. https://www.cnblogs.com/zhang1533590225/p/10003433.html ↩︎

标签:network,ipv6,Centos7,eno1,1001,IPV6,yes,dd0a,路由
来源: https://www.cnblogs.com/waw/p/16321917.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有