Set office to 192.0.2.10/24 with gateway 192.0.2.1 and do not use DHCP.
Which command is appropriate?
Set ipv4.method manual, a prefix-bearing address, and the gateway for a static profile.
Detailed explanation
nmcli con mod office ipv4.method manual ipv4.addresses 192.0.2.10/24 ipv4.gateway 192.0.2.1Correct. It sets manual mode, address, and gateway.
Correct. It sets manual mode, address, and gateway.
nmcli con mod office ipv4.method auto ipv4.addresses 192.0.2.10/24Incorrect. auto requests automatic configuration.
Incorrect. auto requests automatic configuration.
nmcli dev show office ipv4.addresses 192.0.2.10/24Incorrect. device show is not a profile modification command.
Incorrect. device show is not a profile modification command.
nmcli con mod office ipv4.gateway 192.0.2.10/24 ipv4.addresses 192.0.2.1Incorrect. Address and gateway values are swapped.
Incorrect. Address and gateway values are swapped.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'method=manual address=192.0.2.10/24 gateway=192.0.2.1'Expected result
method=manual address=192.0.2.10/24 gateway=192.0.2.1Key points
- manual is static
- Address includes prefix
- Gateway is next hop
Notes
- Environment: 設定値の表示のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.