Scenario
You have been asked to configure enp1s0 with a static IPv4 address for a staging subnet
and confirm the host can reach the network beyond its default gateway. Target configuration:
192.168.50.10/24 with default gateway 192.168.50.1.
This workflow is common during provisioning, temporary migrations, and controlled connectivity testing.
You are making direct, explicit changes using ip, then verifying the outcome immediately.
Objective
- Assign
192.168.50.10/24toenp1s0. - Bring
enp1s0to an UP state. - Add a default route via
192.168.50.1. - Verify external reachability with a single ICMP echo.
Concepts
- Addressing and link state are separate: you can configure an IP on a DOWN interface, but it will not pass traffic.
- A default route is required for traffic destined outside your directly connected subnets.
-
ipchanges made this way are not persistent across reboot unless you also configure your network manager. - A single-packet ping is a fast validation step that reduces noise while confirming reachability.
- If external ping fails, verify gateway reachability first, then routing, then firewall policy.
Walkthrough
192.168.50.10/24 to enp1s0.
ip addr add 192.168.50.10/24 dev enp1s0
This adds the address to the interface. If the same address already exists, the command will fail, which is useful feedback during repeatable testing.
# Verify address:
ip -br addr show dev enp1s0
# Expected to include:
# enp1s0 ... 192.168.50.10/24
enp1s0 up.
ip link set enp1s0 up
The interface must be UP to send and receive traffic. Validate link state before diagnosing routing or reachability.
# Confirm link state:
ip -br link show dev enp1s0
# Expected:
# enp1s0 UP ...
192.168.50.1.
ip route add default via 192.168.50.1 dev enp1s0
The default route determines where traffic goes when no more specific route matches. Without it, external pings may fail even when local addressing is correct.
# Verify routing table:
ip route
# Expected to include:
# default via 192.168.50.1 dev enp1s0
ping -c 1 192.168.50.1
This is the most important intermediate validation step. If you cannot reach the gateway, external reachability will fail, and you should focus on link, addressing, VLAN, or switchport state.
1 packets transmitted, 1 received, 0% packet loss
ping -c 1 8.8.8.8
This confirms basic reachability beyond the local subnet. Using an IP avoids DNS variables and isolates routing/forwarding.
1 packets transmitted, 1 received, 0% packet loss
Breakpoints
If adding the address or default route fails with “File exists,” list current config, then remove the conflicting entry before re-adding the target configuration.
If ip link set shows UP but traffic still fails, confirm physical link or virtual NIC connection and check for
carrier state using ip -br link.
If ping 192.168.50.1 fails, verify subnet correctness, VLAN placement, and switchport state. Do not troubleshoot
external routing until the gateway is reachable.
Cleanup checklist
- Remove the static IP from
enp1s0. - Remove the default route you added (if it was not pre-existing).
ip addr del 192.168.50.10/24 dev enp1s0
ip route del default via 192.168.50.1 dev enp1s0
Reference
-
ip addr add <ip>/<prefix> dev <iface>: Add an address to an interface. -
ip addr del <ip>/<prefix> dev <iface>: Remove an address from an interface. -
ip link set <iface> up: Bring an interface up. -
ip route add default via <gateway> dev <iface>: Add a default route. -
ip route del default via <gateway> dev <iface>: Remove a default route. -
ip -br addr show dev <iface>: Brief address view for an interface.-br: brief output
-
ip -br link show dev <iface>: Brief link-state view for an interface.-br: brief output
-
ping -c 1 <ip>: Send one ICMP echo request.-c 1: exactly one packet