RedHat / CentOS配置静态IPv6及路由设置

发表于 2016-01-14   |   分类于 技术

一、通过命令配置临时ip

  1. ifconfig

    ifconfig eth0 inet6 add 1920:1680:2470::82/64

2.ip

ip -6 addr add 1920:1680:2470::82/64 dev eth0

二、修改配置文件配置永久ip
1.编辑/etc/sysconfig/network-script/ifcfg-eth0,增加或修改以下内容

IPV6INIT=yes
IPV6ADDR=1920:1680:2470::82/64

三、配置路由
1.查看当前路由信息

ip -6 route show [dev <device>]
#例子:
ip -6 route show dev eth0

2.设定路由

ip -6 route add <ipv6network>/<prefixlength> via <ipv6address> [dev <device>]
#例子:
ip -6 route add 1920:1680:2470::/64 via 1920:1680:2470::1

或者:

route -A inet6 add <ipv6network>/<prefixlength> gw <ipv6address> [dev <device>]
#例子:
route -A inet6 add 1920:1680:2470::/64 gw 1920:1680:2470::1

3.删除路由

ip -6 route del <ipv6network>/<prefixlength> via <ipv6address> [dev <device>]
#例子:
ip -6 route del 1920:1680:2470::/64 via 1920:1680:2470::1

或者:

route -A inet6 del <ipv6network>/<prefixlength> gw <ipv6address> [dev <device>]
#例子:
route -A inet6 del 1920:1680:2470::/64 gw 1920:1680:2470::1

发表新评论

© 2017 Powered by Typecho
苏ICP备15035969号-3