參考
https://www.ipv6.hinet.net/form/HiNet_IPv6_fixed_setting.pdf
Ubuntu 18.04 用 NetPlan 設定網路固定 IP
Ubuntu 18.04
最近開始要安裝測試環境,想想16.04的支援期限也快到了,不如直接上18.04,沒想到設定網路就遇到和之前不同了....
一開始的dhcp設定
$ cat /etc/netplan/00-installer-config.yaml
network:
ethernets:
ens160:
dhcp4: true
version: 2
設定固定ipv4 IP
$ sudo vi /etc/netplan/00-installer-config.yaml
network:
ethernets:
ens160:
addresses: [ 192.168.11.21/24 ]
gateway4: 192.168.11.1
nameservers:
addresses: [ 168.95.1.1,8.8.8.8 ]
version: 2
$ sudo netplan try
$ sudo netplan apply
Ubuntu 16.04
設定DHCP
# vi /etc/network/interfaces
auto enp2s0
iface enp2s0 inet dhcp
設定固定ipv4 IP
# vi /etc/network/interfaces
auto enp2s0
iface enp2s0 inet static
address 203.69.6.130
netmask 255.255.255.0
gateway 203.69.6.1
dns-nameservers 168.95.1.1 8.8.8.8
設定固定IPv6 IP
# vi /etc/network/interfaces
在既有的auto eth0
新增v6描述
iface eth0 inet6 static
address 2001:B030:000C:FF01::135
netmask 64
gateway 2001:B030:000C:FF01::FFFF
dns-nameservers 8.8.8.8 2001:B000:168::1
# ifdown eth0
# ifup eth0
測試ipv6
- 用指令測試
# ping6 2001:b030:c:ff01::FFFF 64 bytes from 2001:b030:c:ff01::ffff: icmp_seq=1 ttl=255 time=4.98 ms 64 bytes from 2001:b030:c:ff01::ffff: icmp_seq=2 ttl=255 time=4.85 ms ....略
- 或是到測試網站
IPv6 test - IPv6/4 connectivity and speed test
測試你的 IPv6 連線。
http://[2001:b030:800f::243]/