Configure a static IPv4 address using ip tooling, bring the interface online,
and add a default route. Validate end-to-end connectivity with a controlled ping test.
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.
192.168.50.10/24 to enp1s0.enp1s0 to an UP state.192.168.50.1.ip changes made this way are not persistent across reboot unless you also configure your network manager.
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
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.
enp1s0.ip addr del 192.168.50.10/24 dev enp1s0
ip route del default via 192.168.50.1 dev enp1s0
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 outputip -br link show dev <iface>
: Brief link-state view for an interface.
-br: brief outputping -c 1 <ip>
: Send one ICMP echo request.
-c 1: exactly one packet