Linux下配置IPv6地址的方法
Lux在内核版本2.2.0以后就支持IPv6了,可查看/proc//if_i6文件是否存在以确定你的系统是否支持IPv6
如果没有,可尝试如下命令加载IPv6模组
# modprobe ipv6
成功加载后就可以使用IPv6环境了,系统会自动获得IPv6地址。
IPv6相关命令
# ifconfig eth0 i6 add 2001:da8:2004:1000:202:116:160:41/64 (手工添加配置固定IPv6地址)
# route -A i6 add default gw 2001:da8:2004:1000::1 (添加默认路由)
# pg6 ipv6.scau.edu.
PING ipv6.scau.edu.(2001:da8:2004:1000:202:116:160:48) 56 data bytes
64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=0 ttl=64 time=0.020 ms
64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=1 ttl=64 time=0.019 ms
64 bytes from 2001:da8:2004:1000:202:116:160:48: icmp_seq=2 ttl=64 time=0.014 ms
这个显示表明IPv6已配置成功。
Lux设置isatap隧道配置IPv6
Lux 设置如下:
ip tunnel add sit1 mode sit remote 192.168.253.49 local a.b.c.d
ifconfig sit1 up
ifconfig sit1 add 2001:da8:2004:2301:0:5efe:a.b.c.d
route -A i6 add ::/0 fe80::5efe:192.168.253.49
注意: 上面的 a.b.c.d 请使用你的真实IPv4地址代替
配置好之后 ifconfig后应该看到一个2001:da8:2004:2301 为前缀的v6地址,hostid为5efe:a.b.c.d,其中a.b.c.d为你的真实的IPV4地址。
以下补充内容
Debian
复制代码
vi /etc/work/terfaces
# /etc/work/terfaces -- configuration file for ifup(8), ifdown(8)
# The loopback terface
# automatically added when upgradg
auto lo
iface lo i loopback
auto eth0
iface eth0 i6 static
address 2001:da8:2:10d::2
mask 64
up route -A i6 add default gw 2001:da8:2:10d::1 dev $IFACE
iface eth0 i static
address 58.1.4.74
mask 255.255.255.0
up route add default gw 58.1.4.1 dev $IFACE
Redhat CentOS Fedora
复制代码