Ubuntu 網路設定


參考

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

#Ubuntu Linux






Related Posts

MTR04_0922

MTR04_0922

[Day 07] 總結

[Day 07] 總結

CDS2019 Next-generation web styling 整理介紹

CDS2019 Next-generation web styling 整理介紹




Sponsored



Comments