Suse Linux(SLES10)如何配置IPv6

时间:2019-11-20 08:53:55  来源:igfitidea点击:

在SUSE Linux Enterprise Server(SLES v10.2)或OpenSuse Linux中如何配置IPv6网络?

SLES10 IPv6配置

添加IPv6地址

语法:

ip -6 address add {IPv6-Address}/{NetMask} dev {device-name}

例如将2607:f0d0:1002:0011:0000:0000:0000:0002/64 IP添加到eth0

# ip -6 address add 2607:f0d0:1002:0011:0000:0000:0000:0002/64 dev eth0

添加默认路由

语法

ip -6 route add default via {IP6-Router-IP} dev {device-name}

示例:添加默认的IPv6路由器IP

# ip -6 route add default via 2607:f0d0:1002:0011:0000:0000:0000:0001 dev eth0

Suse Linux如何查看IPV6地址

查看IPv6设置:

# ip -6 address show dev eth0

查看IPv6路由表:

# ip -6 route show

Suse Linux如何测试IPv6

执行以下命令:

# ping6 ipv6.google.com
# ping6 www.theitroad.local

Suse Linux永久设置IPv6地址

SLES/OpenSuse Linux IPv6配置文件

  • eth0 IPv6配置文件:/etc/sysconfig/network/ifcfg-eth-id-${ETHIDFILE}
  • 默认的IPv6路由配置文件:/etc/sysconfig/network/routes

查看ETHIDFILE的值:

# ip link show dev eth0 | awk '/link/{ print  }'
# ETHIDFILE=$(ip link show dev eth0 | awk '/link/{ print  }')

备份并编辑配置文件:

# cp /etc/sysconfig/network/ifcfg-eth-id-${ETHIDFILE} /root/ifcfg-eth-id-${ETHIDFILE}.bak
vi /etc/sysconfig/network/ifcfg-eth-id-${ETHIDFILE}

填写IPv6地址:

LABEL_0='0'
IPADDR_0='2607:f0d0:1002:0011:0000:0000:0000:0002'
PREFIXLEN_0='64'

更改默认的IPv6路由:

# cp /etc/sysconfig/network/routes /root/routes.bak
# echo 'default 2607:f0d0:1002:0011:0000:0000:0000:0001 - -' >> /etc/sysconfig/network/routes

在SLES10下重启网络服务,使设置生效:

# service network restart