配置IPv6

http://serverfault.com/questions/405661/centos-eth0-not-starting-on-boot?rq=1

http://ipv6.tsinghua.edu.cn/guide/linux-ipv6-di-zhi/


1、加载ipv6模块:
insmod ipv6

lsmod |grep ipv6

ipv6                  321422  63 streams_strmip

2、设置ipv6:
在/etc/sysconfig/network中增加

  • NETWORKING_IPV6=yes
在/etc/sysconfig/network-scripts/ifcfg-XXX中增加:
  • IPV6INIT=yes
  • IPV6ADDR=YOURIPV6ADDRESS

/etc/sysconfig/network"中增加:

  • IPV6_DEFAULTGW=YOURGATEWAY

在/etc/sysconfig/network-scripts/ifup-ipv6得到如下信息:

# Uses following information from "/etc/sysconfig/network":

#  IPV6_DEFAULTDEV=: controls default route (optional)

#  IPV6_DEFAULTGW=

: controls default route (optional)

#

# Uses following information from "/etc/sysconfig/network-scripts/ifcfg-$1":

#  IPV6INIT=yes|no: controls IPv6 configuration for this interface

#  IPV6ADDR=[/]: specify primary static IPv6 address

#  IPV6ADDR_SECONDARIES="[/] ..." (optional)

#  IPV6_ROUTER=yes|no: controls IPv6 autoconfiguration (no: multi-homed interface without routing)

#  IPV6_AUTOCONF=yes|no: controls IPv6 autoconfiguration

#   defaults:

#    IPV6FORWARDING=yes: IPV6_AUTOCONF=no, IPV6_ROUTER=yes

#    IPV6FORWARDING=no: IPV6_AUTOCONF=yes

#  IPV6_MTU=: controls IPv6 MTU for this link (optional)

#  IPV6_PRIVACY="rfc3041": control IPv6 privacy (optional)

#    This script only supports "rfc3041" (if kernel supports it)

#

# Optional for 6to4 tunneling (hardwired name of tunnel device is "tun6to4"):

#  IPV6TO4INIT=yes|no: controls 6to4 tunneling setup

#  IPV6TO4_RELAY=: IPv4 address of the remote 6to4 relay (default: 192.88.99.1)

#  IPV6TO4_MTU=: controls IPv6 MTU for the 6to4 link (optional, default is MTU of interface - 20)

#  IPV6TO4_IPV4ADDR=: overwrite local IPv4 address (optional)

#  IPV6TO4_ROUTING="-/ ...": information to setup additional interfaces

#    Example: IPV6TO4_ROUTING="eth0-:f101::1/64 eth1-:f102::1/64"

#

# Optional for 6to4 tunneling to trigger radvd:

#  IPV6_CONTROL_RADVD=yes|no: controls radvd triggering (optional)

#  IPV6_RADVD_PIDFILE=: PID file of radvd for sending signals, default is "/var/run/radvd/radvd.pid" (optional)

#  IPV6_RADVD_TRIGGER_ACTION=startstop|reload|restart|SIGHUP: how to trigger radvd (optional, default is SIGHUP)

#

#  Required version of radvd to use 6to4 prefix recalculation

#   0.6.2p3 or newer supporting option "Base6to4Interface"

#  Required version of radvd to use dynamic ppp links

#   0.7.0 + fixes or newer


  • Debian: /etc/network/interfaces中维护;
  • Redhat CentOS Fedora: /etc/sysconfig/network-scripts/ifcfg-eth0中维护:
    • 在/etc/sysconfig/network中添加
      • NETWORKING_IPV6=yes
    • 在/etc/sysconfig/network-scripts/ifcfg-eth0中添加
      • IPV6INIT=yes
      • IPV6ADDR=2001:da8:8003:801:202:120:1:1
      • IPV6_DEFAULTGW=2001:da8:8003:801::1%eth0 
/etc/init.d/network  --- 传统方法
NetworkManager  --- 一个工具;
system-config-network  --- ??
system-config-services --- ??

疑问:

  •       发现在ifcfg-eth0中添加,可以成功。
  •       但在ifcfg-anzi(其中包含DEVICE=eth0:oam)中添加,则失败。通过set -x打开shell跟踪语句,可以看到如下流程:

               /etc/init.d/network --> ifup-eth -> ifup-ipv6, ifup-post ---> /sbin/ifup-local

               在ifup-ipv6和/sbin/ifup-local中都会执行/sbin/ip -6 addr add 2001:da8:8003:801:202:120:1:2/64 dev eth0,而第二次执行会返回“RTNETLINK answers: File exists”错误。why???

有些时候没有ifcfg-eth0文件,但可以手动写一个。


你可能感兴趣的:(linux,Command)