Remove only the temporary 192.0.2.10/24 address from enp1s0.
Keep the interface and other addresses.
Which command is appropriate?
ip address delete ADDRESS/PREFIX dev INTERFACE removes the specified address. flush can remove a broader set and does not match the requirement.
Detailed explanation
ip address flush dev enp1s0Incorrect. flush may delete multiple addresses from the interface.
ip link delete enp1s0Incorrect. ip link delete removes the link itself.
ip route delete 192.0.2.10/24 dev enp1s0Incorrect. ip route delete removes a route, not the local address.
ip address delete 192.0.2.10/24 dev enp1s0Correct. It deletes the specified address from enp1s0.
Try it yourself
An example you can run in a temporary verification environment.
ip address help 2>&1 | sed -n '1,3p'Expected result
ip addressのadd、delete、showなどの構文概要Key points
- address delete
- Name the exact address
- Understand flush scope
Notes
- Environment: iproute2 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.