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 when validating connectivity during
provisioning, temporary migrations, or controlled network
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 addr add.
ip link set.
ip route add.
ping -c.
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.
# Quick verification:
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/receive traffic. This is the first thing to validate before diagnosing routing or reachability.
# Confirm state:
ip -br link show dev enp1s0
# Expected:
# enp1s0 UP ...
192.168.50.1.
ip route add default via 192.168.50.1
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 8.8.8.8
This confirms basic reachability beyond the local subnet. If this fails, the next checks are typically gateway reach, DNS (if pinging a name), firewall policy, and upstream routing.
# Expected pattern:
# 1 packets transmitted, 1 received, 0% packet loss
ip addr add <ip>/<prefix> dev <iface>
: Adds an IPv4/IPv6 address to an interface.
ip link set <iface> up
: Brings an interface up (enables link layer operation).
ip route add default via <gateway>
: Adds a default route for outbound traffic.
ip -br addr show dev <iface>
: Compact view of addresses assigned to a specific interface.
-br
: Brief output format.
ip route
: Displays the active routing table.
ping -c 1 <ip>
: Sends a controlled number of ICMP echo requests.
-c 1
: Send exactly one packet (fast validation).