ubuntu server 18.04 ipv6 設定? [論壇 - 伺服器架設]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊



ubuntu server 18.04 ipv6 設定?
會員一級
註冊日期:
2009/4/10 9:11
所屬群組:
已註冊使用者
等級: 1
HP : 0 / 18
MP : 2 / 778
EXP: 73
離線
在網路上查到如下
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.1.2/24, '2001:1::2/64']
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]

這是正確的嗎?沒有看到 gateway6: 不用嗎?請指點,疑惑中...

找到答案了

ens33:
dhcp4: false
dhcp6: false
addresses: [192.168.1.2/24, '2001:1::2/64']
gateway4: 192.168.1.1
gateway6: 2001:1::ff
nameservers:
addresses: [8.8.8.8,8.8.4.4]

2018/9/6 17:20
應用擴展 工具箱
回覆: ubuntu server 18.04 ipv6 設定?
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30289
EXP: 23
離線
小王 寫到:
在網路上查到如下
 ens33:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.2/24, '2001:1::2/64']
     gateway4: 192.168.1.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]

這是正確的嗎?沒有看到 gateway6: 不用嗎?請指點,疑惑中...



關於IPv6的設定,我並不懂,先貼一下剛找到的參考網址,
也許您研究了,您有心得,可以來分享怎麼設定,感恩先

我先從「Ubuntu Server Guide」,

找到「Networking」,

接著找到「Network Configuration」,

接著找到「netplan man page」,

然後使用「IPv6」當關鍵字,可以找到相關的說明,有您提到的「gateway6」的範例。


       addresses (sequence of scalars)
              Add static addresses to the interface in addition to the ones received through DHCP
              or  RA.   Each  sequence  entry  is  in  CIDR  notation,  i.   e.   of   the   form
              addr/prefixlen.   addr is an IPv4 or IPv6 address as recognized by inet_pton(3) and
              prefixlen the number of bits of the subnet.

              Example: addresses: [192.168.14.2/24, "2001:1::1/64"]

       gateway4, gateway6 (scalar)
              Set default gateway for IPv4/6, for manual address  configuration.   This  requires
              setting addresses too.  Gateway IPs must be in a form recognized by inet_pton(3).

              Example for IPv4: gateway4: 172.16.0.1 Example for IPv6: gateway6: "2001:4::1"




也可以執行指令下面指令,來閱讀「netplan man page


$ man netplan



或是查詢「ubuntu 18.04 ipv6」,

查到兩篇參考文章,「1」,「2」,

裡面都有提到是參考「這篇」,對照您提供的範例,猜測您應該也是參考「這篇」。

以上提供參考,我還沒實際去測試,只是先貼出來找到的參考資料



## netplan 相關網址

* https://netplan.io/
* https://netplan.io/examples
* https://github.com/CanonicalLtd/netplan
* https://github.com/CanonicalLtd/netplan/tree/master/doc
* https://github.com/CanonicalLtd/netplan/blob/master/doc/example-config

## yaml

* http://yaml.org/
* https://zh.wikipedia.org/zh-tw/YAML

## 簡易套件探索

執行


$ apt-cache search netplan



顯示


netplan.io - YAML network configuration abstraction for various backends
nplan - YAML network configuration abstraction - transitional package
netplan - network server for `plan'
plan - X/Motif day planner



執行


$ apt-cache showsrc netplan.io | grep '^Binary:' -B 3



顯示


Package: netplan.io
Format: 3.0 (native)
Binary: netplan.io, nplan



執行


$ dpkg -l '*netplan*'



顯示


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============================-====================-====================-======
un netplan <none> <none> (no description available)
ii netplan.io 0.36.3 amd64 YAML network configuration abstraction for various backends



執行


$ dpkg -L netplan.io | sort



顯示


/.
/etc
/etc/netplan
/lib
/lib/netplan
/lib/netplan/generate
/lib/systemd
/lib/systemd/system
/lib/systemd/system-generators
/lib/systemd/system-generators/netplan
/lib/systemd/system/netplan-wpa@.service
/usr
/usr/sbin
/usr/sbin/netplan
/usr/share
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/netplan
/usr/share/doc
/usr/share/doc/netplan.io
/usr/share/doc/netplan.io/changelog.gz
/usr/share/doc/netplan.io/copyright
/usr/share/doc/netplan.io/examples
/usr/share/doc/netplan.io/examples/bonding_router.yaml
/usr/share/doc/netplan.io/examples/bonding.yaml
/usr/share/doc/netplan.io/examples/bridge_vlan.yaml
/usr/share/doc/netplan.io/examples/bridge.yaml
/usr/share/doc/netplan.io/examples/dhcp.yaml
/usr/share/doc/netplan.io/examples/direct_connect_gateway.yaml
/usr/share/doc/netplan.io/examples/loopback_interface.yaml
/usr/share/doc/netplan.io/examples/network_manager.yaml
/usr/share/doc/netplan.io/examples/source_routing.yaml
/usr/share/doc/netplan.io/examples/static_multiaddress.yaml
/usr/share/doc/netplan.io/examples/static.yaml
/usr/share/doc/netplan.io/examples/vlan.yaml
/usr/share/doc/netplan.io/examples/windows_dhcp_server.yaml
/usr/share/doc/netplan.io/examples/wireless.yaml
/usr/share/doc/netplan.io/netplan.html
/usr/share/man
/usr/share/man/man5
/usr/share/man/man5/netplan.5.gz
/usr/share/netplan
/usr/share/netplan/netplan
/usr/share/netplan/netplan/cli
/usr/share/netplan/netplan/cli/commands
/usr/share/netplan/netplan/cli/commands/apply.py
/usr/share/netplan/netplan/cli/commands/generate.py
/usr/share/netplan/netplan/cli/commands/__init__.py
/usr/share/netplan/netplan/cli/commands/ip.py
/usr/share/netplan/netplan/cli/commands/migrate.py
/usr/share/netplan/netplan/cli/commands/try_command.py
/usr/share/netplan/netplan/cli/core.py
/usr/share/netplan/netplan/cli/__init__.py
/usr/share/netplan/netplan/cli/utils.py
/usr/share/netplan/netplan/configmanager.py
/usr/share/netplan/netplan/__init__.py
/usr/share/netplan/netplan.script
/usr/share/netplan/netplan/terminal.py




執行下面指令,觀看「/usr/share/doc/netplan.io/netplan.html」


$ firefox /usr/share/doc/netplan.io/netplan.html



或是執行下面指令,觀看「/usr/share/doc/netplan.io/netplan.html」


$ lynx /usr/share/doc/netplan.io/netplan.html



或是執行下面指令,觀看「/usr/share/doc/netplan.io/netplan.html」


$ w3m /usr/share/doc/netplan.io/netplan.html



執行


$ dpkg -L nplan | sort



顯示


/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/nplan
/usr/share/doc/nplan/changelog.gz
/usr/share/doc/nplan/copyright



執行下面指令,觀看「netplan.io」這個套件的相關資訊。


$ apt-cache show netplan.io



顯示


Package: netplan.io
Architecture: amd64
Version: 0.36.3
Multi-Arch: foreign
Priority: important
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 228
Provides: nplan
Depends: libc6 (>= 2.27), libglib2.0-0 (>= 2.16.0), libuuid1 (>= 2.16), libyaml-0-2, python3, python3-yaml, systemd (>= 235-3ubuntu3)
Suggests: network-manager | wpasupplicant
Conflicts: netplan
Breaks: network-manager (<< 1.2.2-0ubuntu4~), nplan (<< 0.34~)
Replaces: nplan (<< 0.34~)
Filename: pool/main/n/netplan.io/netplan.io_0.36.3_amd64.deb
Size: 58880
MD5sum: 822bcc74e5c6c25e23cc7206cf99d4d6
SHA1: dfb4e619481bb85e116992fc8087fb76d1c099b7
SHA256: eae6d963cb161ece2b7ec04ebec6f150303b21d4b5bdd3f87e75e329727c079a
Description-en: YAML network configuration abstraction for various backends
 netplan reads YAML network configuration files which are written
 by administrators, installers, cloud image instantiations, or other OS
 deployments. During early boot it then generates backend specific
 configuration files in /run to hand off control of devices to a particular
 networking daemon.
 .
 Currently supported backends are networkd and NetworkManager.
Description-md5: 171990596b9adbbde53590d783767a6d
Task: minimal, ubuntu-core
Supported: 5y



## 「Binary Package: netplan.io

執行下面指令,下載「Binary Package: netplan.io」。


$ apt-get download netplan.io



會下載一個檔案「netplan.io_0.36.3_amd64.deb」

執行下面指令,解開「netplan.io_0.36.3_amd64.deb」


$ dpkg -x netplan.io_0.36.3_amd64.deb netplan.io



會解開到資料夾「netplan.io」

執行下面指令,觀看「netplan.io」這個資料夾結構


$ tree netplan.io



顯示


netplan.io
├── etc
│   └── netplan
├── lib
│   ├── netplan
│   │   └── generate
│   └── systemd
│       ├── system
│       │   └── netplan-wpa@.service
│       └── system-generators
│           └── netplan -> ../../netplan/generate
└── usr
    ├── sbin
    │   └── netplan -> ../share/netplan/netplan.script
    └── share
        ├── bash-completion
        │   └── completions
        │       └── netplan
        ├── doc
        │   └── netplan.io
        │       ├── changelog.gz
        │       ├── copyright
        │       ├── examples
        │       │   ├── bonding_router.yaml
        │       │   ├── bonding.yaml
        │       │   ├── bridge_vlan.yaml
        │       │   ├── bridge.yaml
        │       │   ├── dhcp.yaml
        │       │   ├── direct_connect_gateway.yaml
        │       │   ├── loopback_interface.yaml
        │       │   ├── network_manager.yaml
        │       │   ├── source_routing.yaml
        │       │   ├── static_multiaddress.yaml
        │       │   ├── static.yaml
        │       │   ├── vlan.yaml
        │       │   ├── windows_dhcp_server.yaml
        │       │   └── wireless.yaml
        │       └── netplan.html
        ├── man
        │   └── man5
        │       └── netplan.5.gz
        └── netplan
            ├── netplan
            │   ├── cli
            │   │   ├── commands
            │   │   │   ├── apply.py
            │   │   │   ├── generate.py
            │   │   │   ├── __init__.py
            │   │   │   ├── ip.py
            │   │   │   ├── migrate.py
            │   │   │   └── try_command.py
            │   │   ├── core.py
            │   │   ├── __init__.py
            │   │   └── utils.py
            │   ├── configmanager.py
            │   ├── __init__.py
            │   └── terminal.py
            └── netplan.script

21 directories, 36 files



執行下面指令,顯示「netplan.io」這個資料夾裡的檔案列表


$ find netplan.io



顯示


netplan.io
netplan.io/usr
netplan.io/usr/share
netplan.io/usr/share/man
netplan.io/usr/share/man/man5
netplan.io/usr/share/man/man5/netplan.5.gz
netplan.io/usr/share/bash-completion
netplan.io/usr/share/bash-completion/completions
netplan.io/usr/share/bash-completion/completions/netplan
netplan.io/usr/share/netplan
netplan.io/usr/share/netplan/netplan
netplan.io/usr/share/netplan/netplan/cli
netplan.io/usr/share/netplan/netplan/cli/core.py
netplan.io/usr/share/netplan/netplan/cli/__init__.py
netplan.io/usr/share/netplan/netplan/cli/utils.py
netplan.io/usr/share/netplan/netplan/cli/commands
netplan.io/usr/share/netplan/netplan/cli/commands/generate.py
netplan.io/usr/share/netplan/netplan/cli/commands/try_command.py
netplan.io/usr/share/netplan/netplan/cli/commands/apply.py
netplan.io/usr/share/netplan/netplan/cli/commands/migrate.py
netplan.io/usr/share/netplan/netplan/cli/commands/__init__.py
netplan.io/usr/share/netplan/netplan/cli/commands/ip.py
netplan.io/usr/share/netplan/netplan/__init__.py
netplan.io/usr/share/netplan/netplan/configmanager.py
netplan.io/usr/share/netplan/netplan/terminal.py
netplan.io/usr/share/netplan/netplan.script
netplan.io/usr/share/doc
netplan.io/usr/share/doc/netplan.io
netplan.io/usr/share/doc/netplan.io/changelog.gz
netplan.io/usr/share/doc/netplan.io/examples
netplan.io/usr/share/doc/netplan.io/examples/network_manager.yaml
netplan.io/usr/share/doc/netplan.io/examples/wireless.yaml
netplan.io/usr/share/doc/netplan.io/examples/bridge_vlan.yaml
netplan.io/usr/share/doc/netplan.io/examples/source_routing.yaml
netplan.io/usr/share/doc/netplan.io/examples/dhcp.yaml
netplan.io/usr/share/doc/netplan.io/examples/windows_dhcp_server.yaml
netplan.io/usr/share/doc/netplan.io/examples/direct_connect_gateway.yaml
netplan.io/usr/share/doc/netplan.io/examples/bonding_router.yaml
netplan.io/usr/share/doc/netplan.io/examples/static.yaml
netplan.io/usr/share/doc/netplan.io/examples/bridge.yaml
netplan.io/usr/share/doc/netplan.io/examples/vlan.yaml
netplan.io/usr/share/doc/netplan.io/examples/loopback_interface.yaml
netplan.io/usr/share/doc/netplan.io/examples/static_multiaddress.yaml
netplan.io/usr/share/doc/netplan.io/examples/bonding.yaml
netplan.io/usr/share/doc/netplan.io/copyright
netplan.io/usr/share/doc/netplan.io/netplan.html
netplan.io/usr/sbin
netplan.io/usr/sbin/netplan
netplan.io/etc
netplan.io/etc/netplan
netplan.io/lib
netplan.io/lib/netplan
netplan.io/lib/netplan/generate
netplan.io/lib/systemd
netplan.io/lib/systemd/system-generators
netplan.io/lib/systemd/system-generators/netplan
netplan.io/lib/systemd/system
netplan.io/lib/systemd/system/netplan-wpa@.service



或是加上「sort」,也就是執行下面指令


$ find netplan.io | sort



顯示


netplan.io
netplan.io/etc
netplan.io/etc/netplan
netplan.io/lib
netplan.io/lib/netplan
netplan.io/lib/netplan/generate
netplan.io/lib/systemd
netplan.io/lib/systemd/system
netplan.io/lib/systemd/system-generators
netplan.io/lib/systemd/system-generators/netplan
netplan.io/lib/systemd/system/netplan-wpa@.service
netplan.io/usr
netplan.io/usr/sbin
netplan.io/usr/sbin/netplan
netplan.io/usr/share
netplan.io/usr/share/bash-completion
netplan.io/usr/share/bash-completion/completions
netplan.io/usr/share/bash-completion/completions/netplan
netplan.io/usr/share/doc
netplan.io/usr/share/doc/netplan.io
netplan.io/usr/share/doc/netplan.io/changelog.gz
netplan.io/usr/share/doc/netplan.io/copyright
netplan.io/usr/share/doc/netplan.io/examples
netplan.io/usr/share/doc/netplan.io/examples/bonding_router.yaml
netplan.io/usr/share/doc/netplan.io/examples/bonding.yaml
netplan.io/usr/share/doc/netplan.io/examples/bridge_vlan.yaml
netplan.io/usr/share/doc/netplan.io/examples/bridge.yaml
netplan.io/usr/share/doc/netplan.io/examples/dhcp.yaml
netplan.io/usr/share/doc/netplan.io/examples/direct_connect_gateway.yaml
netplan.io/usr/share/doc/netplan.io/examples/loopback_interface.yaml
netplan.io/usr/share/doc/netplan.io/examples/network_manager.yaml
netplan.io/usr/share/doc/netplan.io/examples/source_routing.yaml
netplan.io/usr/share/doc/netplan.io/examples/static_multiaddress.yaml
netplan.io/usr/share/doc/netplan.io/examples/static.yaml
netplan.io/usr/share/doc/netplan.io/examples/vlan.yaml
netplan.io/usr/share/doc/netplan.io/examples/windows_dhcp_server.yaml
netplan.io/usr/share/doc/netplan.io/examples/wireless.yaml
netplan.io/usr/share/doc/netplan.io/netplan.html
netplan.io/usr/share/man
netplan.io/usr/share/man/man5
netplan.io/usr/share/man/man5/netplan.5.gz
netplan.io/usr/share/netplan
netplan.io/usr/share/netplan/netplan
netplan.io/usr/share/netplan/netplan/cli
netplan.io/usr/share/netplan/netplan/cli/commands
netplan.io/usr/share/netplan/netplan/cli/commands/apply.py
netplan.io/usr/share/netplan/netplan/cli/commands/generate.py
netplan.io/usr/share/netplan/netplan/cli/commands/__init__.py
netplan.io/usr/share/netplan/netplan/cli/commands/ip.py
netplan.io/usr/share/netplan/netplan/cli/commands/migrate.py
netplan.io/usr/share/netplan/netplan/cli/commands/try_command.py
netplan.io/usr/share/netplan/netplan/cli/core.py
netplan.io/usr/share/netplan/netplan/cli/__init__.py
netplan.io/usr/share/netplan/netplan/cli/utils.py
netplan.io/usr/share/netplan/netplan/configmanager.py
netplan.io/usr/share/netplan/netplan/__init__.py
netplan.io/usr/share/netplan/netplan.script
netplan.io/usr/share/netplan/netplan/terminal.py




執行下面指令,解開「Control File」和「MaintainerScripts


$ dpkg -e netplan.io_0.36.3_amd64.deb



會解開到資料夾「DEBIAN」

執行下面指令,觀看「DEBIAN」這個資料夾結構


$ tree DEBIAN



顯示


DEBIAN
├── control
├── md5sums
└── postinst

0 directories, 3 files



執行


$ find DEBIAN



顯示


DEBIAN
DEBIAN/postinst
DEBIAN/md5sums
DEBIAN/control



執行


$ ls /var/lib/dpkg/info/netplan.io.* -1



顯示


/var/lib/dpkg/info/netplan.io.list
/var/lib/dpkg/info/netplan.io.md5sums
/var/lib/dpkg/info/netplan.io.postinst



* 「DEBIAN/postinst」<=> 「/var/lib/dpkg/info/netplan.io.postinst」
* 「DEBIAN/md5sums」<=> 「//var/lib/dpkg/info/netplan.io.md5sums」

執行


$ grep '^Package: netplan.io' /var/lib/dpkg/available -A 25



顯示


Package: netplan.io
Architecture: amd64
Version: 0.36.1
Multi-Arch: foreign
Priority: important
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 228
Provides: nplan
Depends: libc6 (>= 2.27), libglib2.0-0 (>= 2.16.0), libuuid1 (>= 2.16), libyaml-0-2, python3, python3-yaml, systemd (>= 235-3ubuntu3)
Suggests: network-manager | wpasupplicant
Conflicts: netplan
Breaks: network-manager (<< 1.2.2-0ubuntu4~), nplan (<< 0.34~)
Replaces: nplan (<< 0.34~)
Filename: pool/main/n/netplan.io/netplan.io_0.36.1_amd64.deb
Size: 58384
MD5sum: efc46878b6ab0b096545292d0bebe4b7
SHA1: 7761a00dff7125a9ba21a6aeee77db857f0d6bb6
SHA256: 0f1fc02f7c4c9f9caf7ba10c394a36f0ab7d3e530310f779ca30a8eb1747356e
Description: YAML network configuration abstraction for various backends
Task: minimal, ubuntu-core
Description-md5: 171990596b9adbbde53590d783767a6d
Supported: 5y



執行


$ grep '^Package: netplan.io' /var/lib/dpkg/status -A 23



顯示


Package: netplan.io
Status: install ok installed
Priority: important
Section: net
Installed-Size: 228
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: foreign
Version: 0.36.3
Replaces: nplan (<< 0.34~)
Provides: nplan
Depends: libc6 (>= 2.27), libglib2.0-0 (>= 2.16.0), libuuid1 (>= 2.16), libyaml-0-2, python3, python3-yaml, systemd (>= 235-3ubuntu3)
Suggests: network-manager | wpasupplicant
Breaks: network-manager (<< 1.2.2-0ubuntu4~), nplan (<< 0.34~)
Conflicts: netplan
Description: YAML network configuration abstraction for various backends
 netplan reads YAML network configuration files which are written
 by administrators, installers, cloud image instantiations, or other OS
 deployments. During early boot it then generates backend specific
 configuration files in /run to hand off control of devices to a particular
 networking daemon.
 .
 Currently supported backends are networkd and NetworkManager.



執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/*



顯示


grep: /var/lib/apt/lists/auxfiles: Is a directory
grep: /var/lib/apt/lists/lock: Permission denied
grep: /var/lib/apt/lists/partial: Permission denied
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-i386_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_i18n_Translation-en:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_source_Sources:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-amd64_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-i386_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_i18n_Translation-en:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_source_Sources:Package: netplan.io



執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages -A 25



顯示


Package: netplan.io
Architecture: amd64
Version: 0.36.1
Multi-Arch: foreign
Priority: important
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 228
Provides: nplan
Depends: libc6 (>= 2.27), libglib2.0-0 (>= 2.16.0), libuuid1 (>= 2.16), libyaml-0-2, python3, python3-yaml, systemd (>= 235-3ubuntu3)
Suggests: network-manager | wpasupplicant
Conflicts: netplan
Breaks: network-manager (<< 1.2.2-0ubuntu4~), nplan (<< 0.34~)
Replaces: nplan (<< 0.34~)
Filename: pool/main/n/netplan.io/netplan.io_0.36.1_amd64.deb
Size: 58384
MD5sum: efc46878b6ab0b096545292d0bebe4b7
SHA1: 7761a00dff7125a9ba21a6aeee77db857f0d6bb6
SHA256: 0f1fc02f7c4c9f9caf7ba10c394a36f0ab7d3e530310f779ca30a8eb1747356e
Description: YAML network configuration abstraction for various backends
Task: minimal, ubuntu-core
Description-md5: 171990596b9adbbde53590d783767a6d
Supported: 5y



執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-amd64_Packages -A 25



顯示


Package: netplan.io
Architecture: amd64
Version: 0.36.3
Multi-Arch: foreign
Priority: important
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 228
Provides: nplan
Depends: libc6 (>= 2.27), libglib2.0-0 (>= 2.16.0), libuuid1 (>= 2.16), libyaml-0-2, python3, python3-yaml, systemd (>= 235-3ubuntu3)
Suggests: network-manager | wpasupplicant
Conflicts: netplan
Breaks: network-manager (<< 1.2.2-0ubuntu4~), nplan (<< 0.34~)
Replaces: nplan (<< 0.34~)
Filename: pool/main/n/netplan.io/netplan.io_0.36.3_amd64.deb
Size: 58880
MD5sum: 822bcc74e5c6c25e23cc7206cf99d4d6
SHA1: dfb4e619481bb85e116992fc8087fb76d1c099b7
SHA256: eae6d963cb161ece2b7ec04ebec6f150303b21d4b5bdd3f87e75e329727c079a
Description: YAML network configuration abstraction for various backends
Task: minimal, ubuntu-core
Description-md5: 171990596b9adbbde53590d783767a6d
Supported: 5y



執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_i18n_Translation-en -A 10



顯示


Package: netplan.io
Description-md5: 171990596b9adbbde53590d783767a6d
Description-en: YAML network configuration abstraction for various backends
 netplan reads YAML network configuration files which are written
 by administrators, installers, cloud image instantiations, or other OS
 deployments. During early boot it then generates backend specific
 configuration files in /run to hand off control of devices to a particular
 networking daemon.
 .
 Currently supported backends are networkd and NetworkManager.




執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_i18n_Translation-en -A 10



顯示


Package: netplan.io
Description-md5: 171990596b9adbbde53590d783767a6d
Description-en: YAML network configuration abstraction for various backends
 netplan reads YAML network configuration files which are written
 by administrators, installers, cloud image instantiations, or other OS
 deployments. During early boot it then generates backend specific
 configuration files in /run to hand off control of devices to a particular
 networking daemon.
 .
 Currently supported backends are networkd and NetworkManager.




## 「Source Package: netplan.io

執行下面指令,下載「Source Package: netplan.io」。


$ apt-get source netplan.io



會下載下面兩個檔案

* netplan.io_0.36.3.dsc
* netplan.io_0.36.3.tar.xz

並且解開到「netplan.io-0.36.3」這個資料夾

執行下面指令


$ tree netplan.io-0.36.3



觀看「netplan.io-0.36.3」這個資料夾結構


netplan.io-0.36.3
├── COPYING
├── debian
│   ├── changelog
│   ├── compat
│   ├── control
│   ├── copyright
│   ├── dirs
│   ├── docs
│   ├── netplan.io.install
│   ├── postinst
│   ├── rules
│   ├── source
│   │   └── format
│   └── tests
│       ├── autostart
│       └── control
├── doc
│   ├── example-config
│   ├── manpage.md
│   └── netplan.md
├── examples
│   ├── bonding_router.yaml
│   ├── bonding.yaml
│   ├── bridge_vlan.yaml
│   ├── bridge.yaml
│   ├── dhcp.yaml
│   ├── direct_connect_gateway.yaml
│   ├── loopback_interface.yaml
│   ├── network_manager.yaml
│   ├── source_routing.yaml
│   ├── static_multiaddress.yaml
│   ├── static.yaml
│   ├── vlan.yaml
│   ├── windows_dhcp_server.yaml
│   └── wireless.yaml
├── Makefile
├── netplan
│   ├── cli
│   │   ├── commands
│   │   │   ├── apply.py
│   │   │   ├── generate.py
│   │   │   ├── __init__.py
│   │   │   ├── ip.py
│   │   │   ├── migrate.py
│   │   │   └── try_command.py
│   │   ├── core.py
│   │   ├── __init__.py
│   │   └── utils.py
│   ├── configmanager.py
│   ├── __init__.py
│   └── terminal.py
├── netplan.completions
├── README.md
├── rpm
│   └── netplan.spec
├── src
│   ├── generate.c
│   ├── netplan.script
│   ├── netplan-wpa@.service
│   ├── networkd.c
│   ├── networkd.h
│   ├── nm.c
│   ├── nm.h
│   ├── parse.c
│   ├── parse.h
│   ├── util.c
│   └── util.h
└── tests
    ├── cli.py
    ├── generate.py
    ├── integration.py
    ├── test_configmanager.py
    └── test_terminal.py

11 directories, 62 files



執行下面指令,顯示「netplan.io-0.36.3」這個資料夾裡的檔案列表


$ find netplan.io-0.36.3



顯示


netplan.io-0.36.3/
netplan.io-0.36.3/README.md
netplan.io-0.36.3/netplan.completions
netplan.io-0.36.3/rpm
netplan.io-0.36.3/rpm/netplan.spec
netplan.io-0.36.3/netplan
netplan.io-0.36.3/netplan/cli
netplan.io-0.36.3/netplan/cli/core.py
netplan.io-0.36.3/netplan/cli/__init__.py
netplan.io-0.36.3/netplan/cli/utils.py
netplan.io-0.36.3/netplan/cli/commands
netplan.io-0.36.3/netplan/cli/commands/generate.py
netplan.io-0.36.3/netplan/cli/commands/try_command.py
netplan.io-0.36.3/netplan/cli/commands/apply.py
netplan.io-0.36.3/netplan/cli/commands/migrate.py
netplan.io-0.36.3/netplan/cli/commands/__init__.py
netplan.io-0.36.3/netplan/cli/commands/ip.py
netplan.io-0.36.3/netplan/__init__.py
netplan.io-0.36.3/netplan/configmanager.py
netplan.io-0.36.3/netplan/terminal.py
netplan.io-0.36.3/src
netplan.io-0.36.3/src/generate.c
netplan.io-0.36.3/src/nm.h
netplan.io-0.36.3/src/nm.c
netplan.io-0.36.3/src/networkd.h
netplan.io-0.36.3/src/parse.h
netplan.io-0.36.3/src/util.h
netplan.io-0.36.3/src/util.c
netplan.io-0.36.3/src/netplan-wpa@.service
netplan.io-0.36.3/src/netplan.script
netplan.io-0.36.3/src/networkd.c
netplan.io-0.36.3/src/parse.c
netplan.io-0.36.3/COPYING
netplan.io-0.36.3/examples
netplan.io-0.36.3/examples/network_manager.yaml
netplan.io-0.36.3/examples/wireless.yaml
netplan.io-0.36.3/examples/bridge_vlan.yaml
netplan.io-0.36.3/examples/source_routing.yaml
netplan.io-0.36.3/examples/dhcp.yaml
netplan.io-0.36.3/examples/windows_dhcp_server.yaml
netplan.io-0.36.3/examples/direct_connect_gateway.yaml
netplan.io-0.36.3/examples/bonding_router.yaml
netplan.io-0.36.3/examples/static.yaml
netplan.io-0.36.3/examples/bridge.yaml
netplan.io-0.36.3/examples/vlan.yaml
netplan.io-0.36.3/examples/loopback_interface.yaml
netplan.io-0.36.3/examples/static_multiaddress.yaml
netplan.io-0.36.3/examples/bonding.yaml
netplan.io-0.36.3/tests
netplan.io-0.36.3/tests/cli.py
netplan.io-0.36.3/tests/generate.py
netplan.io-0.36.3/tests/test_terminal.py
netplan.io-0.36.3/tests/integration.py
netplan.io-0.36.3/tests/test_configmanager.py
netplan.io-0.36.3/doc
netplan.io-0.36.3/doc/manpage.md
netplan.io-0.36.3/doc/netplan.md
netplan.io-0.36.3/doc/example-config
netplan.io-0.36.3/debian
netplan.io-0.36.3/debian/postinst
netplan.io-0.36.3/debian/rules
netplan.io-0.36.3/debian/source
netplan.io-0.36.3/debian/source/format
netplan.io-0.36.3/debian/netplan.io.install
netplan.io-0.36.3/debian/changelog
netplan.io-0.36.3/debian/control
netplan.io-0.36.3/debian/tests
netplan.io-0.36.3/debian/tests/control
netplan.io-0.36.3/debian/tests/autostart
netplan.io-0.36.3/debian/dirs
netplan.io-0.36.3/debian/copyright
netplan.io-0.36.3/debian/docs
netplan.io-0.36.3/debian/compat
netplan.io-0.36.3/Makefile



或是加上「sort」,也就是執行下面指令


$ find netplan.io-0.36.3 | sort



顯示


netplan.io-0.36.3
netplan.io-0.36.3/COPYING
netplan.io-0.36.3/debian
netplan.io-0.36.3/debian/changelog
netplan.io-0.36.3/debian/compat
netplan.io-0.36.3/debian/control
netplan.io-0.36.3/debian/copyright
netplan.io-0.36.3/debian/dirs
netplan.io-0.36.3/debian/docs
netplan.io-0.36.3/debian/netplan.io.install
netplan.io-0.36.3/debian/postinst
netplan.io-0.36.3/debian/rules
netplan.io-0.36.3/debian/source
netplan.io-0.36.3/debian/source/format
netplan.io-0.36.3/debian/tests
netplan.io-0.36.3/debian/tests/autostart
netplan.io-0.36.3/debian/tests/control
netplan.io-0.36.3/doc
netplan.io-0.36.3/doc/example-config
netplan.io-0.36.3/doc/manpage.md
netplan.io-0.36.3/doc/netplan.md
netplan.io-0.36.3/examples
netplan.io-0.36.3/examples/bonding_router.yaml
netplan.io-0.36.3/examples/bonding.yaml
netplan.io-0.36.3/examples/bridge_vlan.yaml
netplan.io-0.36.3/examples/bridge.yaml
netplan.io-0.36.3/examples/dhcp.yaml
netplan.io-0.36.3/examples/direct_connect_gateway.yaml
netplan.io-0.36.3/examples/loopback_interface.yaml
netplan.io-0.36.3/examples/network_manager.yaml
netplan.io-0.36.3/examples/source_routing.yaml
netplan.io-0.36.3/examples/static_multiaddress.yaml
netplan.io-0.36.3/examples/static.yaml
netplan.io-0.36.3/examples/vlan.yaml
netplan.io-0.36.3/examples/windows_dhcp_server.yaml
netplan.io-0.36.3/examples/wireless.yaml
netplan.io-0.36.3/Makefile
netplan.io-0.36.3/netplan
netplan.io-0.36.3/netplan/cli
netplan.io-0.36.3/netplan/cli/commands
netplan.io-0.36.3/netplan/cli/commands/apply.py
netplan.io-0.36.3/netplan/cli/commands/generate.py
netplan.io-0.36.3/netplan/cli/commands/__init__.py
netplan.io-0.36.3/netplan/cli/commands/ip.py
netplan.io-0.36.3/netplan/cli/commands/migrate.py
netplan.io-0.36.3/netplan/cli/commands/try_command.py
netplan.io-0.36.3/netplan/cli/core.py
netplan.io-0.36.3/netplan/cli/__init__.py
netplan.io-0.36.3/netplan/cli/utils.py
netplan.io-0.36.3/netplan.completions
netplan.io-0.36.3/netplan/configmanager.py
netplan.io-0.36.3/netplan/__init__.py
netplan.io-0.36.3/netplan/terminal.py
netplan.io-0.36.3/README.md
netplan.io-0.36.3/rpm
netplan.io-0.36.3/rpm/netplan.spec
netplan.io-0.36.3/src
netplan.io-0.36.3/src/generate.c
netplan.io-0.36.3/src/netplan.script
netplan.io-0.36.3/src/netplan-wpa@.service
netplan.io-0.36.3/src/networkd.c
netplan.io-0.36.3/src/networkd.h
netplan.io-0.36.3/src/nm.c
netplan.io-0.36.3/src/nm.h
netplan.io-0.36.3/src/parse.c
netplan.io-0.36.3/src/parse.h
netplan.io-0.36.3/src/util.c
netplan.io-0.36.3/src/util.h
netplan.io-0.36.3/tests
netplan.io-0.36.3/tests/cli.py
netplan.io-0.36.3/tests/generate.py
netplan.io-0.36.3/tests/integration.py
netplan.io-0.36.3/tests/test_configmanager.py
netplan.io-0.36.3/tests/test_terminal.py




執行


$ apt-cache showsrc netplan.io



顯示


Package: netplan.io
Format: 3.0 (native)
Binary: netplan.io, nplan
Architecture: any all
Version: 0.36.1
Priority: important
Section: net
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Standards-Version: 4.1.3
Build-Depends: debhelper (>= 11), pkg-config, bash-completion, libyaml-dev, libglib2.0-dev, uuid-dev, python3 (>= 3.1), python3-coverage, python3-yaml, systemd, pyflakes3, pycodestyle | pep8, python3-nose, pandoc
Testsuite: autopkgtest
Vcs-Browser: https://github.com/CanonicalLtd/netplan
Vcs-Git: https://github.com/CanonicalLtd/netplan
Directory: pool/main/n/netplan.io
Package-List:
 netplan.io deb net important arch=any
 nplan deb oldlibs optional arch=all
Files:
 629d49231c86a718579ca0e92ed79c59 1854 netplan.io_0.36.1.dsc
 d9e24f58373f9f32f8f2c17ca61ac41f 81184 netplan.io_0.36.1.tar.xz
Checksums-Sha1:
 31cfd10bb5bae9dce25b71faca7dea7788104364 1854 netplan.io_0.36.1.dsc
 18ea2c6d4c530c57818162452d5b03ed1b6465e6 81184 netplan.io_0.36.1.tar.xz
Checksums-Sha256:
 f9f70cf67c41f8b7bdb6a0c9fe864772727496daef8fe587930d9430eb0448b6 1854 netplan.io_0.36.1.dsc
 db199e0c278fe534f9b63d08faab9fe5d4f86c7e9a105789db519493f255ec5b 81184 netplan.io_0.36.1.tar.xz
Testsuite-Triggers: dnsmasq-base, hostapd, network-manager, systemd




執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/*



顯示


grep: /var/lib/apt/lists/auxfiles: Is a directory
grep: /var/lib/apt/lists/lock: Permission denied
grep: /var/lib/apt/lists/partial: Permission denied
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_binary-i386_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_i18n_Translation-en:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_source_Sources:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-amd64_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_binary-i386_Packages:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_i18n_Translation-en:Package: netplan.io
/var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_source_Sources:Package: netplan.io



執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic_main_source_Sources -A 27



顯示


Package: netplan.io
Format: 3.0 (native)
Binary: netplan.io, nplan
Architecture: any all
Version: 0.36.1
Priority: important
Section: net
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Standards-Version: 4.1.3
Build-Depends: debhelper (>= 11), pkg-config, bash-completion, libyaml-dev, libglib2.0-dev, uuid-dev, python3 (>= 3.1), python3-coverage, python3-yaml, systemd, pyflakes3, pycodestyle | pep8, python3-nose, pandoc
Testsuite: autopkgtest
Vcs-Browser: https://github.com/CanonicalLtd/netplan
Vcs-Git: https://github.com/CanonicalLtd/netplan
Directory: pool/main/n/netplan.io
Package-List:
 netplan.io deb net important arch=any
 nplan deb oldlibs optional arch=all
Files:
 629d49231c86a718579ca0e92ed79c59 1854 netplan.io_0.36.1.dsc
 d9e24f58373f9f32f8f2c17ca61ac41f 81184 netplan.io_0.36.1.tar.xz
Checksums-Sha1:
 31cfd10bb5bae9dce25b71faca7dea7788104364 1854 netplan.io_0.36.1.dsc
 18ea2c6d4c530c57818162452d5b03ed1b6465e6 81184 netplan.io_0.36.1.tar.xz
Checksums-Sha256:
 f9f70cf67c41f8b7bdb6a0c9fe864772727496daef8fe587930d9430eb0448b6 1854 netplan.io_0.36.1.dsc
 db199e0c278fe534f9b63d08faab9fe5d4f86c7e9a105789db519493f255ec5b 81184 netplan.io_0.36.1.tar.xz
Testsuite-Triggers: dnsmasq-base, hostapd, network-manager, systemd




執行


$ grep '^Package: netplan.io' /var/lib/apt/lists/tw.archive.ubuntu.com_ubuntu_dists_bionic-updates_main_source_Sources -A 27



顯示


Package: netplan.io
Format: 3.0 (native)
Binary: netplan.io, nplan
Architecture: any all
Version: 0.36.3
Priority: important
Section: net
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Standards-Version: 4.1.3
Build-Depends: debhelper (>= 11), pkg-config, bash-completion, libyaml-dev, libglib2.0-dev, uuid-dev, python3 (>= 3.1), python3-coverage, python3-yaml, systemd, pyflakes3, pycodestyle | pep8, python3-nose, pandoc
Testsuite: autopkgtest
Vcs-Browser: https://github.com/CanonicalLtd/netplan
Vcs-Git: https://github.com/CanonicalLtd/netplan
Directory: pool/main/n/netplan.io
Package-List:
 netplan.io deb net important arch=any
 nplan deb oldlibs optional arch=all
Files:
 ef5f37c2e144988c73cd47fd4218b57f 1854 netplan.io_0.36.3.dsc
 09c4097df48ce6ed4a0663e54febe9f8 82076 netplan.io_0.36.3.tar.xz
Checksums-Sha1:
 4f0c0a626e7fb13dd363846024237956167104bb 1854 netplan.io_0.36.3.dsc
 8a3c8e52bae7762cc10a23bce3461a306053368c 82076 netplan.io_0.36.3.tar.xz
Checksums-Sha256:
 a78cb6f12de2c96eae5d608d56bd622bc4160766f112d03358bd8d17c610d731 1854 netplan.io_0.36.3.dsc
 405d17cf1f233ee7d03d7b0ab5508626e7e7d98fcb5a9b9b5544001edc5ca91f 82076 netplan.io_0.36.3.tar.xz
Testsuite-Triggers: dnsmasq-base, hostapd, network-manager, systemd


2018/9/7 18:30
應用擴展 工具箱
回覆: ubuntu server 18.04 ipv6 設定?
會員三級
註冊日期:
2012/4/26 9:45
所屬群組:
已註冊使用者
等級: 12
HP : 0 / 298
MP : 64 / 9971
EXP: 93
離線
addresses: [8.8.8.8,8.8.4.4] ==> 這個是DNS吧?

兩個都是addresses:,應該有點問題。

不過這一行是ipv4的ip。

2018/9/14 1:47
應用擴展 工具箱
回覆: ubuntu server 18.04 ipv6 設定?
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 37
HP : 0 / 905
MP : 679 / 30289
EXP: 23
離線
redhung 寫到:
addresses: [8.8.8.8,8.8.4.4] ==> 這個是DNS吧?

兩個都是addresses:,應該有點問題。


不過這一行是ipv4的ip。



關於您提的疑問,因為顯示的時候,縮格不見了,

原本樓主的是

小王 寫到:
在網路上查到如下
ens33:
dhcp4: no
dhcp6: no
addresses: [192.168.1.2/24, '2001:1::2/64']
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]

這是正確的嗎?沒有看到 gateway6: 不用嗎?請指點,疑惑中...


我重新設定「BBCode,加入「[ code ] [ / code ]」,顯示就會有縮格。

小王 寫到:
在網路上查到如下
 ens33:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.2/24, '2001:1::2/64']
     gateway4: 192.168.1.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]

這是正確的嗎?沒有看到 gateway6: 不用嗎?請指點,疑惑中...


轉成「json」的格式,如下


{
	"ens33": {
		"dhcp4": "no",
		"dhcp6": "no",
		"addresses": [
			"192.168.1.2/24",
			"2001:1::2/64"
		],
		"gateway4": "192.168.1.1",
		"nameservers": {
			"addresses": [
				"8.8.8.8",
				"8.8.4.4"
			]
		}
	}
}





應該可以解答您的疑問

redhung 寫到:
addresses: [8.8.8.8,8.8.4.4] ==> 這個是DNS吧?

兩個都是addresses:,應該有點問題。



可以執行「$ man netplan 」觀看最下方的「Examples」

還有可以參考「Wikipedia / YAML」,了解「yaml」的格式。

上面「#2」我有列這些參考連結。

或是也可以到「https://learnxinyminutes.com/」,找到「yaml」來參考,可以用關鍵字「a_nested_map」找尋該頁面。

以上提供參考,

報告完畢


2018/9/14 6:31
應用擴展 工具箱


 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.