管理IPv6網絡鏈接

如下操做創建在Linux功能-管理IPv4網絡鏈接之上,請先完成該部分操做後進行如下測試。html

1. 修改 net1,配置 IPv6 地址爲 2001:X/64 ,網關爲 2001:254 網絡

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

2.修改 net1,將 IPv6 地址配置方法改成手動oop

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

3. 檢查 net1 的 ipv6 配置參數確認前面的配置post

[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 ~]# spa

6. 確認你的機器能ping通ipv6網關code

[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 htm

[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 ~]# 
相關文章
相關標籤/搜索