next up previous contents
Next: IPv6 互 ping Up: IPv6 網路 Previous: IPv6 子網   Contents

IPv6 設定

  1. 先查看目前 kvm5.deyu.wang 有 eth0, eth1, eth2 三張網卡。
    [root@kvm5 ~]# ip link
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
        link/ether 52:54:00:4a:c9:67 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
        link/ether 52:54:00:00:00:51 brd ff:ff:ff:ff:ff:ff
    4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
        link/ether 52:54:00:00:00:52 brd ff:ff:ff:ff:ff:ff
    
  2. 查看目前只有 eth0 一個網路連線。
    [root@kvm5 ~]# nmcli connection show 
    NAME  UUID                                  TYPE            DEVICE 
    eth0  166b5ab1-1581-402d-b821-8823acb33dee  802-3-ethernet  eth0
    
  3. 查看目前 eth0 沒有 ipv6 位址。
    [root@kvm5 ~]# nmcli connection show eth0 | grep ipv6
    ipv6.method:                            auto
    ipv6.dns:                               
    ipv6.dns-search:                        
    ipv6.addresses:                         
    ipv6.gateway:                           --
    ipv6.routes:                            
    ipv6.route-metric:                      -1
    ipv6.ignore-auto-routes:                no
    ipv6.ignore-auto-dns:                   no
    ipv6.never-default:                     no
    ipv6.may-fail:                          yes
    ipv6.ip6-privacy:                       -1 (unknown)
    ipv6.dhcp-send-hostname:                yes
    ipv6.dhcp-hostname:                     --
    
  4. 沒有指定那個連線設定 ipv6,則可以直接修改 eth0 網路連線,增加 ipv6 位址。
    [root@kvm5 ~]# nmcli connection modify eth0 ipv6.addresses '2001:ac18::135/64' ipv6.method manual
    
  5. 重新啟動網路。
    [root@kvm5 ~]# systemctl restart network.service
    
  6. 網卡 eth0 已有 ipv6 的 ip。
    [root@kvm5 ~]# ip addr show dev eth0 
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 52:54:00:4a:c9:67 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.5/24 brd 192.168.122.255 scope global eth0
           valid_lft forever preferred_lft forever
        inet6 2001:ac18::135/64 scope global 
           valid_lft forever preferred_lft forever
        inet6 fe80::5054:ff:fe4a:c967/64 scope link 
           valid_lft forever preferred_lft forever
    
  7. 使用 ping6 ping 自己。
    [root@kvm5 ~]# ping6 -c3 2001:ac18::135
    PING 2001:ac18::135(2001:ac18::135) 56 data bytes
    64 bytes from 2001:ac18::135: icmp_seq=1 ttl=64 time=0.068 ms
    64 bytes from 2001:ac18::135: icmp_seq=2 ttl=64 time=0.058 ms
    64 bytes from 2001:ac18::135: icmp_seq=3 ttl=64 time=0.050 ms
    
    --- 2001:ac18::135 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2000ms
    rtt min/avg/max/mdev = 0.050/0.058/0.068/0.011 ms
    



De-Yu Wang 2018-09-07