如何在 Fedora 上设定和取消 IPv6 地址
1、列出当前的IPv6地址
使用 "ip"
使用方法:
# /sbin/ip -6 addr show dev
例子:一个静态的主机地址
# /sbin/ip -6 addr show dev eth0
2:eth0:mtu1500qdisc pfifo_ fast qlen100
inet6 fe80::210:a4ff:fee3:9566/10scope link
inet63ffe:ffff:0:f101::1/64scopeglobal
inet6 fec0:0:0:f101::1/64scope site
自动设定的地址和它的存活时间:
# /sbin/ip -6 addr show dev eth0
3:eth0:mtu1500qdisc pfifo_fast qlen100
inet62002:d950:f5f8:f101:2e0:18ff:fe90:9205/64scopeglobaldynamic
valid_lft16secpreferred_lft6sec
inet63ffe:400:100:f101:2e0:18ff:fe90:9205/64scopeglobaldynamic
valid_lft2591997secpreferred_lft604797secinet6 fe80::2e0:18ff:fe90:9205/10scope link
使用 "ifconfig"
使用方法:
# /sbin/ifconfig
例子, 它只列出IPv6地址:
# /sbin/ifconfig eth0 |grep "inet6 addr:"
inet6 addr:fe80::210:a4ff:fee3:9566/10Scope:Link
inet6 addr:3ffe:ffff:0:f101::1/64Scope:Global
inet6 addr:fec0:0:0:f101::1/64Scope:Site
2、增加一个IPv6地址
其原理同IPv4的"IP ALIAS"(IP别名)相同
使用 "ip"
使用方法:
# /sbin/ip -6 addr add / dev
例子:
# /sbin/ip -6 addr add 3ffe:ffff:0:f101::1/64 dev eth0
使用 "ifconfig"
使用方法:
# /sbin/ifconfig inet6 add /
例子:
# /sbin/ifconfig eth0 inet6 add 3ffe:ffff:0:f101::1/64
3、移除IPv6地址
这个不常用, 不要用它移除不存在的地址,一些早期的核心会因为受不了而挂掉。
使用 "ip"
使用方法:
# /sbin/ip -6 addr del / dev
例子:
# /sbin/ip -6 addr del 3ffe:ffff:0:f101::1/64 dev eth0
使用 "ifconfig"
使用方法:
# /sbin/ifconfig inet6 del /
例子:
# /sbin/ifconfig eth0 inet6 del 3ffe:ffff:0:f101::1/64