Set 192.0.2.10/24 and default gateway 192.0.2.1 on the NetworkManager office profile.
Change from DHCP to manual IPv4 settings.
Which command is appropriate?
nmcli connection modify sets ipv4.method manual together with ipv4.addresses and ipv4.gateway on a saved profile.
Detailed explanation
nmcli connection modify office ipv4.method auto ipv4.addresses 192.0.2.10/24Incorrect. auto selects automatic configuration rather than manual static addressing.
nmcli device modify office address 192.0.2.10/24 gateway 192.0.2.1Incorrect. office is a profile name and this is not the standard persistent-property syntax.
nmcli connection modify office ipv4.method manual ipv4.addresses 192.0.2.10/24 ipv4.gateway 192.0.2.1Correct. It sets manual mode, address, and gateway on the office profile.
nmcli connection show office 192.0.2.10/24 192.0.2.1Incorrect. connection show only reads a profile and does not modify it.
Try it yourself
An example you can run in a temporary verification environment.
nmcli connection help 2>/dev/null | grep -E 'modify|show' | head -n 2 || printf '%s
' 'nmcli is not installed'Expected result
connection modifyなどのhelp、またはnmcli未導入メッセージKey points
- connection modify
- ipv4.method manual
- Set addresses and gateway
Notes
- Environment: NetworkManager nmcli help / 状態変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Network interface
A host attachment whose link state and addresses can be managed.
Connection profile
Saved settings used to activate a persistent network connection.
Routing table
Rules that select the next hop for each destination network.