ãŠãŒãã£ãªãã£ã¯ãAPIãçŽæ¥åŒã³åºããŠNetworkManageré¢æ°ã«ã¢ã¯ã»ã¹ããŸãã ããã¯2010幎ã«ç»å Žããå€ãã®å Žåããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ãšæ¥ç¶ãæ§æããããã®ä»£æ¿æ¹æ³ã«ãªããŸããã誰ãããŸã ifconfigã䜿çšããŠããŸãããnmcliã¯ãã¿ãŒããã«ãŠã£ã³ããŠããã³ã¹ã¯ãªããã§äœ¿çšããããã«èšèšãããã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ã€ã¹ïŒCLIïŒããŒã«ã§ãããããGUI以å€ã®sysadminã«æé©ã§ãã
Ncmliã³ãã³ãæ§æ
äžè¬ã«ãæ§æã¯æ¬¡ã®ããã«ãªããŸãã
$ nmcli <options> <section> <action>
- ãªãã·ã§ã³ã¯ãnmcliã®åŸ®åŠããå®çŸ©ãããã©ã¡ãŒã¿ã§ãã
- ã»ã¯ã·ã§ã³-䜿çšãããŠãŒãã£ãªãã£ã®æ©èœãå®çŸ©ããŸãã
- ã¢ã¯ã·ã§ã³-å®éã«å®è¡ããå¿ èŠãããããšãæå®ã§ããŸãã
åèš8ã€ã®ã»ã¯ã·ã§ã³ãããããããããäžé£ã®ã³ãã³ãïŒã¢ã¯ã·ã§ã³ïŒã«é¢é£ä»ããããŠããŸãã
- ãã«ãã¯ãncmcliã³ãã³ããšãã®äœ¿çšæ³ã«é¢ããæ å ±ãæäŸããŸãã
- Generalã¯ãNetworkManagerã¹ããŒã¿ã¹ãšã°ããŒãã«æ§æãè¿ããŸãã
- ãããã¯ãŒãã³ã°ã«ã¯ããããã¯ãŒã¯æ¥ç¶ã®ã¹ããŒã¿ã¹ãç §äŒããæ¥ç¶ãæå¹/ç¡å¹ã«ããã³ãã³ããå«ãŸããŠããŸãã
- Radioã«ã¯ãWiFiæ¥ç¶ã¹ããŒã¿ã¹ãç §äŒããæ¥ç¶ãæå¹/ç¡å¹ã«ããã³ãã³ããå«ãŸããŠããŸãã
- Monitorã«ã¯ãNetworkManagerã¢ã¯ãã£ããã£ãç£èŠãããããã¯ãŒã¯æ¥ç¶ã®ç¶æ ã®å€åãç£èŠããã³ãã³ããå«ãŸããŠããŸãã
- æ¥ç¶ã«ã¯ããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ã管çããããæ°ããæ¥ç¶ãè¿œå ããããæ¢åã®æ¥ç¶ãåé€ãããããããã®ã³ãã³ããå«ãŸããŠããŸãã
- ããã€ã¹ã¯äž»ã«ãããã€ã¹ã«é¢é£ãããã©ã¡ãŒã¿ïŒã€ã³ã¿ãŒãã§ã€ã¹åãªã©ïŒãå€æŽããããæ¢åã®æ¥ç¶ã䜿çšããŠããã€ã¹ãæ¥ç¶ãããããããã«äœ¿çšãããŸãã
- ã·ãŒã¯ã¬ããã¯ãnmcliãã·ãŒã¯ã¬ããã¡ãã»ãŒãžããªãã¹ã³ãããã·ãŒã¯ã¬ãããšãŒãžã§ã³ããNetworkManagerãšããŠç»é²ããŸããnmcliã¯ããã©ã«ãã§ãããã¯ãŒã¯ã«æ¥ç¶ãããšãã«ãã®ããã«æ©èœããããããã®ã»ã¯ã·ã§ã³ã䜿çšãããããšã¯ãã£ãã«ãããŸããã
ç°¡åãªäŸ
éå§ããåã«ãNetworkManagerãå®è¡ãããŠãããnmcliãããã«éä¿¡ã§ããããšã確èªããŠãã ããã
$ nmcli general
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
å€ãã®å Žåãäœæ¥ã¯ãã¹ãŠã®ãããã¯ãŒã¯æ¥ç¶ãããã¡ã€ã«ã確èªããããšããå§ãŸããŸãã
$ nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 ac3241e4-b424-35d6-aaa7-07498561688d ethernet enp0s3
Wired connection 2 2279d917-fa02-390c-8603-3083ec5a1d3e ethernet enp0s8
Wired connection 3 52d89737-de92-35ec-b082-8cf2e5ac36e6 ethernet enp0s9
ãã®ã³ãã³ãã¯ãæ¥ç¶ã»ã¯ã·ã§ã³ã«showã¢ã¯ã·ã§ã³ã䜿çšããŸãã
ãã¹ããã·ã³ã¯Ubuntu20.04ãå®è¡ããŠããŸãããã®å Žåãenp0s3ãenp0s8ãããã³enp0s9ã®3ã€ã®æç·æ¥ç¶ãèŠã€ãããŸããã
æ¥ç¶ç®¡ç
nmcliã§ã¯ãæ¥ç¶ãšããçšèªã¯ãæ¥ç¶ã«é¢ãããã¹ãŠã®æ å ±ãå«ããšã³ãã£ãã£ãæå³ããããšãç解ããããšãéèŠã§ããèšãæããã°ãããã¯ãããã¯ãŒã¯æ§æã§ããConnectionã¯ããªã³ã¯å±€ãIPã¢ãã¬ã¹æ å ±ãªã©ããã¹ãŠã®æ¥ç¶é¢é£æ å ±ãã«ãã»ã«åããŸãããããã¯ãOSIãããã¯ãŒãã³ã°ã¢ãã«ã®ã¬ã€ã€ãŒ2ãšã¬ã€ã€ãŒ3ã§ãã
Linuxã§ãããã¯ãŒã¯ãã»ããã¢ãããããšãã¯ãéåžžãæçµçã«ãããã¯ãŒã¯ããã€ã¹ã«ãã€ã³ããããæ¥ç¶ãã»ããã¢ããããŸããããã¯ãã³ã³ãã¥ãŒã¿ãŒã«ã€ã³ã¹ããŒã«ãããŠãããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ã§ããããã€ã¹ãæ¥ç¶ã䜿çšããå Žåãããã€ã¹ã¯ã¢ã¯ãã£ããŸãã¯ã¢ããããŠãããšèŠãªãããŸããæ¥ç¶ã䜿çšãããŠããªãå Žåã¯ãéã¢ã¯ãã£ãã§ããããåæãããŠããŸãã
ãããã¯ãŒã¯æ¥ç¶ã®è¿œå
ncmliãŠãŒãã£ãªãã£ã䜿çšãããšãæ¥ç¶ããã°ããè¿œå ããŠããã«æ§æã§ããŸããããšãã°ãæç·æ¥ç¶2ïŒenp0s8ã䜿çšïŒãè¿œå ããã«ã¯ãã¹ãŒããŒãŠãŒã¶ãŒãšããŠæ¬¡ã®ã³ãã³ããå®è¡ããå¿ èŠããããŸãã
$ sudo nmcli connection add type ethernet ifname enp0s8
Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully added.
typeãªãã·ã§ã³ã§ã¯ããããã€ãŒãµãããæ¥ç¶ã«ãªãããšã瀺ããifnameïŒã€ã³ã¿ãŒãã§ã€ã¹åïŒãªãã·ã§ã³ã§ã¯ã䜿çšãããããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ã瀺ããŸãã
ã³ãã³ãã®å®è¡åŸã«äœãèµ·ãããã次ã«ç€ºããŸãã
$ nmcli connection show
NAME UUID TYPE DEVICE
Wired connection 1 ac3241e4-b424-35d6-aaa7-07498561688d ethernet enp0s3
Wired connection 2 2279d917-fa02-390c-8603-3083ec5a1d3e ethernet enp0s8
Wired connection 3 52d89737-de92-35ec-b082-8cf2e5ac36e6 ethernet enp0s9
ethernet-enp0s8 09d26960-25a0-440f-8b20-c684d7adc2f5 ethernet --
æ°ããæ¥ç¶ãethernet-enp0s8ãäœæãããŸãããUUIDãå²ãåœãŠãããæ¥ç¶ã¿ã€ãã¯ã€ãŒãµãããã§ãããupã³ãã³ãã§èµ·åããŠã¿ãŸãããã
$ nmcli connection up ethernet-enp0s8
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
ã¢ã¯ãã£ããªæ¥ç¶ã®ãªã¹ããããäžåºŠç¢ºèªããŠãã ããã
$ nmcli connection show --active
NAME UUID TYPE DEVICE
Wired connection 1 ac3241e4-b424-35d6-aaa7-07498561688d ethernet enp0s3
ethernet-enp0s8 09d26960-25a0-440f-8b20-c684d7adc2f5 ethernet enp0s8
Wired connection 3 52d89737-de92-35ec-b082-8cf2e5ac36e6 ethernet enp0s9
æ°ããæ¥ç¶ethernet-enp0s8ãè¿œå ãããŸãããããã¯ã¢ã¯ãã£ãã§ãenp0s8ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŸãã
æ¥ç¶ã®èšå®
ncmliãŠãŒãã£ãªãã£ã䜿çšãããšãæ¢åã®æ¥ç¶ã®ãã©ã¡ãŒã¿ãç°¡åã«å€æŽã§ããŸããããšãã°ãåçïŒDHCPïŒãéçIPã¢ãã¬ã¹ã«å€æŽããå¿ èŠããããŸãã
IPã¢ãã¬ã¹ã192.168.4.26ã«èšå®ããå¿ èŠããããšããŸãããããã®ããã«ã2ã€ã®ã³ãã³ãã䜿çšããŸãã1ã€ç®ã¯IPã¢ãã¬ã¹ãçŽæ¥èšå®ãã2ã€ç®ã¯IPã¢ãã¬ã¹ã®èšå®æ¹æ³ãæåã«åãæ¿ããŸãã
$ nmcli connection modify ethernet-enp0s8 ipv4.address 192.168.4.26/24
$ nmcli connection modify ethernet-enp0s8 ipv4.method manual
ãµãããããã¹ã¯ãèšå®ããããšãå¿ããªãã§ãã ããããã¹ãæ¥ç¶ã®å Žåãããã¯255.255.255.0ããŸãã¯ã¯ã©ã¹ã¬ã¹ã«ãŒãã£ã³ã°ïŒCIDRïŒã®å Žåã¯s / 24ã§ãã
å€æŽãæå¹ã«ããã«ã¯ãæ¥ç¶ãéã¢ã¯ãã£ãåããŠããå床ã¢ã¯ãã£ãåããå¿ èŠããããŸãã
$ nmcli connection down ethernet-enp0s8
Connection 'ethernet-enp0s8' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
$ nmcli connection up ethernet-enp0s8
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveC
代ããã«DHCPãã€ã³ã¹ããŒã«ããå¿ èŠãããå Žåã¯ãæåã§ã¯ãªãèªåã䜿çšããŠãã ããã
$ nmcli connection modify ethernet-enp0s8 ipv4.method auto
ããã€ã¹ã®æäœ
ãã®ããã«ãããã€ã¹ã»ã¯ã·ã§ã³ã䜿çšããŸãã
ããã€ã¹ã®ã¹ããŒã¿ã¹ã確èªããŠããŸã
$ nmcli device status
DEVICE TYPE STATE CONNECTION
enp0s3 ethernet connected Wired connection 1
enp0s8 ethernet connected ethernet-enp0s8
enp0s9 ethernet connected Wired connection 3
lo loopback unmanaged --
ããã€ã¹æ å ±ã®èŠæ±
ãããè¡ãã«ã¯ã[ããã€ã¹]ã»ã¯ã·ã§ã³ã®showã¢ã¯ã·ã§ã³ã䜿çšããŸãïŒããã€ã¹åãæå®ããå¿ èŠããããŸãïŒããã®ãŠãŒãã£ãªãã£ã¯ãå€ãã®å Žåãè€æ°ã®ããŒãžã«å€ãã®æ å ±ã衚瀺ããŸãã
æ°ããæ¥ç¶ã§äœ¿çšãããenp0s8ã€ã³ã¿ãŒãã§ã€ã¹ãèŠãŠã¿ãŸããããåã«èšå®ãããã®ãšãŸã£ããåãIPã¢ãã¬ã¹ã䜿çšããŠããããšã確èªããŸãããã
$ nmcli device show enp0s8
GENERAL.DEVICE: enp0s8
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 08:00:27:81:16:20
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: ethernet-enp0s8
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/6
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.4.26/24
IP4.GATEWAY: --
IP4.ROUTE[1]: dst = 192.168.4.0/24, nh = 0.0.0.0, mt = 103
IP6.ADDRESS[1]: fe80::6d70:90de:cb83:4491/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 103
IP6.ROUTE[2]: dst = ff00::/8, nh = ::, mt = 256, table=255
ããããã®æ å ±ããããŸããäž»ãªãã®ã匷調ããŸãããïŒ
- ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹åïŒ enp0s8ã
- æ¥ç¶ã¿ã€ãïŒæç·ã€ãŒãµãããæ¥ç¶ã
- ããã€ã¹ã®MACã¢ãã¬ã¹ã衚瀺ãããŸãã
- æå®æ倧éä¿¡ãŠãããïŒMTUïŒ -ãã©ã°ã¡ã³ããŒã·ã§ã³ãªãã§ãããã³ã«ã«ãã£ãŠéä¿¡ã§ãã1ãã±ããã®æçšãªããŒã¿ãŠãããã®æ倧ãµã€ãºã
- ããã€ã¹ã¯çŸåšæ¥ç¶ãããŠããŸãã
- ããã€ã¹ã䜿çšããŠããæ¥ç¶ã®ååã¯ethernet-enp0s8ã§ãã
- ããã€ã¹ã¯ãåã«èšå®ãããã®ãšåãIPã¢ãã¬ã¹192.168.4.26/24ã䜿çšããŸãã
ãã®ä»ã®æ å ±ã¯ãæ¥ç¶ã®ããã©ã«ãã®ã«ãŒãã£ã³ã°ããã³ã²ãŒããŠã§ã€èšå®ã«é¢é£ããŠããŸãããããã¯ãããã¯ãŒã¯åºæã§ãã
ã€ã³ã¿ã©ã¯ãã£ãnmcliãšãã£ã¿ãŒ
Nmcliã«ã¯ã誰ããããå¿«é©ã«äœæ¥ã§ããã·ã³ãã«ãªã€ã³ã¿ã©ã¯ãã£ããšãã£ã¿ããããŸãããããå®è¡ããã«ã¯ãããšãã°ethernet-enp0s8æ¥ç¶ã®å Žåãç·šéã¢ã¯ã·ã§ã³ã䜿çšããŸãã
$ nmcli connection edit ethernet-enp0s8
圌ã«ã¯å°ãå©ãããããŸãããã³ã³ãœãŒã«ããŒãžã§ã³ããããµã€ãºãå°ãããªã£ãŠããŸãã
===| nmcli interactive connection editor |===
Editing existing '802-3-ethernet' connection: 'ethernet-enp0s8'
Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [<setting>.<prop>]' for detailed property description.
You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy
nmcli>
printã³ãã³ããå ¥åããŠEnterããŒãæŒããšãnmcliã¯ãã¹ãŠã®æ¥ç¶ããããã£ã衚瀺ããŸãã
===============================================================================
Connection profile details (ethernet-enp0s8)
===============================================================================
connection.id: ethernet-enp0s8
connection.uuid: 09d26960-25a0-440f-8b20-c684d7adc2f5
connection.stable-id: --
connection.type: 802-3-ethernet
connection.interface-name: enp0s8
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.multi-connect: 0 (default)
connection.auth-retries: -1
connection.timestamp: 1593967212
connection.read-only: no
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
ããšãã°ãæ¥ç¶ã®DHCPããããã£ãèšå®ããã«ã¯ãgoto ipv4ãšå ¥åããŠãEnterããŒãæŒããŸãã
nmcli> goto ipv4
You may edit the following properties: method, dns, dns-search,
dns-options, dns-priority, addresses, gateway, routes, route-metric,
route-table, routing-rules, ignore-auto-routes, ignore-auto-dns,
dhcp-client-id, dhcp-iaid, dhcp-timeout, dhcp-send-hostname,
dhcp-hostname, dhcp-fqdn, dhcp-hostname-flags, never-default, may-fail,
dad-timeout
nmcli ipv4>
次ã«ãset method autoãšèšè¿°ããEnterããŒãæŒããŸãã
nmcli ipv4> set method auto
Do you also want to clear 'ipv4.addresses'? [yes]:
éçIPãã¯ãªã¢ããå Žåã¯ãEnterããŒãæŒããŸãããã以å€ã®å Žåã¯ãããããããšå ¥åããŠEnterããŒãæŒããŸããå°æ¥å¿ èŠã«ãªããšæãããå Žåã¯ãä¿ç®¡ããŠããããšãã§ããŸãããã ããéçIPã¢ãã¬ã¹ãä¿åãããŠããå Žåã§ããmethodãautoã«èšå®ãããŠãããšãDHCPã䜿çšãããŸãã
saveã³ãã³ãã䜿çšããŠãå€æŽãä¿åããŸãã
nmcli ipv4> save
Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully updated.
nmcli ipv4>
quitãšå ¥åããŠãnmcli InteractiveEditorãçµäºããŸããé¢ããããšã«æ°ãå€ãã£ãå Žåã¯ãbackã³ãã³ãã䜿çšããŠãã ããã
ãããŠããã ãã§ã¯ãããŸãã
nmcli Interactive Editorãéããèšå®ã®æ°ãšåèšå®ã®ããããã£ã®æ°ã確èªããŸããã€ã³ã¿ã©ã¯ãã£ããšãã£ã¿ã¯åªããããŒã«ã§ãããã¯ã³ã©ã€ããŒãŸãã¯ã¹ã¯ãªããã§nmcliã䜿çšããå Žåã¯ãéåžžã®ã³ãã³ãã©ã€ã³ããŒãžã§ã³ãå¿ èŠã§ãã
åºæ¬ãããã£ãã®ã§ã nmcliã®manããŒãžããã§ãã¯ããŠãä»ã«ã©ã®ããã«åœ¹ç«ã€ãã確èªããŠãã ããã
åºå
Epic Serverã¯ã匷åãªAMDEPYCããã»ããµãšéåžžã«é«éãªIntelNVMeãã©ã€ããåããWindowsãŸãã¯Linuxä»®æ³ãµãŒããŒã§ãããæ¥ããã ããïŒ