差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
linux:network:test_ipv6 [2020/01/24 15:19] tony 建立 |
linux:network:test_ipv6 [2020/02/20 11:01] tony |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | {{tag>linux ipv6}} | ||
====== Test IPv6 functions on Linux ====== | ====== Test IPv6 functions on Linux ====== | ||
===== Introduction ===== | ===== Introduction ===== | ||
本篇文章主要記錄測試IPv6功能時,會使用到的一些指令與方法。 | 本篇文章主要記錄測試IPv6功能時,會使用到的一些指令與方法。 | ||
+ | ===== Add/Delete IPv6 address ===== | ||
+ | Add: | ||
+ | <code bash> | ||
+ | ip -6 addr add 2001:db8:0:f101::1/64 dev eth0 | ||
+ | </code> | ||
+ | Delete: | ||
+ | <code bash> | ||
+ | ip addr del 2001:db8:0:f101::1/64 dev eth0 | ||
+ | </code> | ||
===== Delete IPv4 address===== | ===== Delete IPv4 address===== | ||
刪除IPv4 loopback: | 刪除IPv4 loopback: | ||
<code bash> | <code bash> | ||
- | ip addr del 127.0.0.1 dev lo | + | ip addr del 127.0.0.1/32 dev lo |
+ | </code> | ||
+ | 刪除IPv4 address: | ||
+ | <code bash> | ||
+ | ip addr del 192.168.0.1/16 dev eno1 | ||
+ | </code> | ||
+ | 用這種方法要還原設定只要重啟網路服務即可: | ||
+ | <code bash> | ||
+ | service network restart | ||
+ | </code> | ||
+ | ===== DHCP Configuration ===== | ||
+ | 先在某張網卡上設定static fc00::1/64,接著在dhcp的設定中加入: | ||
+ | <code bash> | ||
+ | default-lease-time 2592000; | ||
+ | preferred-lifetime 604800; | ||
+ | option dhcp-renewal-time 3600; | ||
+ | option dhcp-rebinding-time 7200; | ||
+ | allow leasequery; | ||
+ | option dhcp6.info-refresh-time 21600; | ||
+ | dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases"; | ||
+ | |||
+ | |||
+ | subnet6 fc00::/64 { | ||
+ | range6 fc00:0:0:0::10 fc00:0:0:0::1000; | ||
+ | } | ||
</code> | </code> | ||
+ | 最後重新啟動dhcpd6服務即可。 | ||
+ | ===== Reference ===== | ||
+ | * [[https://askubuntu.com/questions/1181511/disable-ipv4-on-ubuntu-16-04-lts|Disable IPv4 on Ubuntu 16.04 LTS]] | ||
+ | * [[https://blog.csdn.net/qq_36297359/article/details/86774608|如何使用Linux下的dhclient获取IPv6地址?]] | ||
+ | ===== ===== | ||
+ | ---- | ||
+ | \\ | ||
+ | ~~DISQUS~~ |