管理IPv6网络连接

以下操作建立在Linux功能-管理IPv4网络连接之上,请先完成该部分操作后进行以下测试。

1. 修改 net1,配置 IPv6 地址为 2001:X/64 ,网关为 2001:254 

[root@desktop1 ~]# nmcli connection modify net1 ipv6.addresses '2001::1/64 2001::254'

2.修改 net1,将 IPv6 地址配置方法改为手动

[root@desktop1 ~]# nmcli connection modify net1 ipv6.method manual

3. 检查 net1 的 ipv6 配置参数确认前面的配置

[root@desktop1 ~]# nmcli connection show net1 | grep ipv6
ipv6.method:                            manual
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.addresses:                         { ip = 2001::1/64, gw = 2001::254 }
ipv6.routes:                            
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-hostname:                     --
[root@desktop1 ~]# 

4. 重新激活net1,确认ipv6地址生效

[root@desktop1 ~]# nmcli connection up net1 
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@desktop1 ~]# 

[root@desktop1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:94:d3:7a brd ff:ff:ff:ff:ff:ff
3: eno33554960: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:94:d3:84 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global eno33554960
valid_lft forever preferred_lft forever
inet6 2001::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe94:d384/64 scope link
valid_lft forever preferred_lft forever
4: eno50332184: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:94:d3:8e brd ff:ff:ff:ff:ff:ff
6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether a2:11:a8:b3:ca:97 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
[root@desktop1 ~]#

6. 确认你的机器能ping通ipv6网关

[root@desktop1 ~]# ping6 2001::254
PING 2001::254(2001::254) 56 data bytes
64 bytes from 2001::254: icmp_seq=1 ttl=64 time=2.07 ms
64 bytes from 2001::254: icmp_seq=2 ttl=64 time=0.680 ms
64 bytes from 2001::254: icmp_seq=3 ttl=64 time=0.575 ms
64 bytes from 2001::254: icmp_seq=4 ttl=64 time=0.517 ms

7. 编辑/etc/hosts 文件,确保 myip6gateway 映射为 2001:254 

[root@desktop1 ~]# echo '2001::254 myip6gateway' >> /etc/hosts
[root@desktop1 ~]# ping6 myip6gateway 
PING myip6gateway(myip6gateway) 56 data bytes
64 bytes from myip6gateway: icmp_seq=1 ttl=64 time=0.493 ms
64 bytes from myip6gateway: icmp_seq=2 ttl=64 time=2.32 ms
64 bytes from myip6gateway: icmp_seq=3 ttl=64 time=0.630 ms
64 bytes from myip6gateway: icmp_seq=4 ttl=64 time=0.891 ms
^C
--- myip6gateway ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3007ms
rtt min/avg/max/mdev = 0.493/1.085/2.328/0.732 ms
[root@desktop1 ~]# 
posted @ 2016-11-10 12:42  北海悟空  阅读(678)  评论(0编辑  收藏  举报