October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Use iproute2 to Manage Network Configuration on a Linux VPS

A practical iproute2 guide for Linux VPS networking: inspect links and addresses, change routes safely, build source-based policy routing, diagnose failures by layer, and make tested settings survive reboot.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the ip command—the main iproute2 interface—to inspect and change links, addresses, routes, routing rules, neighbors, namespaces, and tunnels on a Linux VPS. A reliable workflow is to identify the provider’s interface, check its link and address state, verify the current route, make one scoped change, test the kernel’s path, and then encode the working configuration in your distribution’s network manager so it survives a reboot.

The examples below use documentation-only addresses such as 192.0.2.0/24 and 203.0.113.0/24. Substitute the addresses, gateway, prefix length, and interface name assigned by your VPS provider.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What iproute2 controls

The Debian ip(8) manual describes the utility as showing and manipulating routing, network devices, interfaces, and tunnels. In practice, ip is the central interface for the kernel’s network objects:

  • ip link manages device state and link-level properties.
  • ip address (also written ip addr) displays and assigns IPv4 or IPv6 addresses and prefixes.
  • ip route reads and changes routing tables.
  • ip rule reads and changes the policy-routing database (RPDB).
  • ip neigh displays the neighbor cache used to resolve next hops on local links.
  • Other iproute2 objects cover namespaces, tunnels, and additional virtual devices.

Link state and addressing are separate. An interface can be administratively up with no usable address, or have an address configured while the link is down. Check and correct those layers in that order before diagnosing a route or an application.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Prepare a safe change window

Keep a recovery path

Changing the interface that carries SSH can disconnect the only session to a VPS. Open a second SSH session or use the provider’s out-of-band console before modifying the management address, gateway, or policy rules. Keep the original session open until the new path has been tested.

Confirm privilege and the real device name

Most changes require root privileges. VPS images may call their primary interface ens3, eth0, enp1s0, or something provider-specific; never assume the name from a tutorial. Start with a compact inventory:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ip -br link
ip -br address

The brief link view shows device names and whether each is up. The brief address view shows assigned prefixes, including IPv6 addresses that may not be obvious in a longer listing.

Record the starting state

Before changing anything, save the current output of:

ip link show
ip address show
ip route show table main
ip rule show

This gives you the interface flags, addresses, main routing table, and rule priorities needed to undo an experiment.

Inspect and change link state

Read link details and counters

Use ip link show for all devices or target one device with dev. The output includes administrative state, MTU, MAC address, and flags such as UP and LOWER_UP. For packet and error counters, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ip -s link show dev ens3

UP means the device is administratively enabled; LOWER_UP indicates that the kernel sees the lower-layer link as available. A virtual VPS NIC can report different combinations depending on the hypervisor and provider.

Bring an existing interface up or down

To enable a device without changing its addresses or routes:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
sudo ip link set ens3 up

Replace ens3 with the name discovered on your server. Use sudo ip link set ens3 down only when you have console access or a planned outage, because every address and route using that device becomes unusable while it is down.

Do not confuse a missing carrier with a missing address

If counters remain at zero or the device lacks LOWER_UP, assigning another address will not repair the underlying link. Check the provider’s virtual NIC attachment, VLAN or bridge settings, and any hypervisor-level restrictions before moving on to routing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect and assign IP addresses

List addresses by interface

ip address show dev ens3

Each entry has an address and prefix length, such as 192.0.2.10/24 or an IPv6 prefix. The prefix determines which destinations the kernel treats as directly connected; it is not merely a netmask label.

Add a temporary address

sudo ip address add 192.0.2.10/24 dev ens3

The address is installed immediately in the running kernel. It is suitable for testing a service, migrating an endpoint, or validating a provider assignment. If the address already exists, the command returns an error rather than silently replacing it.

Remove an address

sudo ip address del 192.0.2.10/24 dev ens3

Use the same prefix and device that appear in ip address show. Removing the address that carries your SSH connection will terminate that path, so verify the replacement first.

IPv6-specific checks

IPv6 addresses use the same ip address commands. Inspect IPv6 routes explicitly with ip -6 route show and test an IPv6 destination with ip -6 route get 2001:db8::1. A VPS may receive a globally routed IPv6 prefix while still needing a provider-specified gateway or a link-local next hop; follow the provider’s documented prefix and gateway rather than guessing from an IPv4 layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read and modify routes

Understand the main table

By default, normal routes are inserted into the main table, ID 254. Display it with:

ip route show
ip route show table main

Typical entries include a connected route for the interface’s prefix, a default route for destinations without a more specific match, and any provider or administrator additions. The longest matching prefix wins within a table; if several routes are otherwise equivalent, metrics and protocol details influence selection.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Test the kernel’s decision before changing anything

ip route get 1.1.1.1

ip route get performs a lookup for one destination and prints the selected device, next hop, source address, and other attributes. It is more useful than reading a large table when you need to know exactly how a packet to one address will leave the VPS. For source-dependent testing, include the source:

ip route get 8.8.8.8 from 203.0.113.10

Add, replace, change, and delete

To install a route temporarily:

sudo ip route add 198.51.100.0/24 via 192.0.2.1 dev ens3

The gateway must be reachable through the specified interface according to the provider’s topology. To remove that exact route:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo ip route del 198.51.100.0/24 via 192.0.2.1 dev ens3

change edits an existing route, while replace creates it if absent or updates it if present. replace is therefore useful in repeatable scripts:

sudo ip route replace 198.51.100.0/24 via 192.0.2.1 dev ens3

Use care with a default route. Replacing it can redirect all new connections, including package downloads and SSH replies. Verify the result immediately:

ip route show
aip route get 1.1.1.1

Correct the accidental leading a if you copy that last example; the command is ip route get 1.1.1.1. (It is shown here to emphasize checking copied commands before pressing Enter.)

Save and restore a runtime route set

The route manual documents ip route save and ip route restore for serializing route information. These operations help capture or replay a route set during maintenance, but they do not by themselves create a boot-time persistence policy for every Linux distribution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use policy routing for multiple paths

When the main table is enough

A single uplink with one default gateway normally belongs in the main table. Add policy routing only when ordinary destination-based lookup cannot express the requirement—for example, two uplinks, source-specific egress, a VPN that should carry only selected traffic, or separated tenant paths. Extra rules add another failure surface and should have a documented purpose.

Know the built-in RPDB rules

The upstream ip-rule(8) manual states that the kernel starts with three rules:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Priority Table Role
0 local (255) Local and broadcast routes maintained by the kernel.
32766 main (254) Normal administrator routes.
32767 default (253) Fallback table, normally empty.

Rules are evaluated in ascending priority number. A custom rule with priority 100 is considered before the default main-table rule at 32766. Always inspect the complete order before adding one:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ip rule show

Create a source-specific table

The following pattern sends traffic sourced from 203.0.113.10 through a second interface named ens4. The example uses a named table, isp2, assigned ID 100:

sudo sh -c 'echo "100 isp2" >> /etc/iproute2/rt_tables'
sudo ip route add 203.0.113.0/24 dev ens4 src 203.0.113.10 table isp2
sudo ip route add default via 203.0.113.1 dev ens4 table isp2
sudo ip rule add from 203.0.113.10/32 priority 100 table isp2
ip rule show
ip route get 8.8.8.8 from 203.0.113.10

The connected route in the custom table lets the kernel reach the second gateway; the default route then handles other destinations. The src hint selects the intended source address for routes from that table. Test both a matching source and an ordinary source so you can confirm that only the intended traffic moved.

Selectors beyond source addresses

Policy rules can match source and destination prefixes, incoming or outgoing interfaces, firewall marks, UID ranges, protocols, and ports. Choose the narrowest selector that expresses the requirement. A broad rule such as an unqualified lookup can capture traffic meant for the main table, while an overly specific rule may never match because the packet’s actual source, mark, or interface differs.

Remove a policy experiment cleanly

Delete the rule first, then remove routes from the custom table if they are no longer needed:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo ip rule del from 203.0.113.10/32 priority 100 table isp2
sudo ip route del default via 203.0.113.1 dev ens4 table isp2
sudo ip route del 203.0.113.0/24 dev ens4 src 203.0.113.10 table isp2

If you added the table name only for a temporary test, remove that line from /etc/iproute2/rt_tables during your normal configuration cleanup. Do not delete the built-in table definitions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose failures by layer

Link and address checks

ip -s link show dev ens3
ip address show dev ens3

Use counters to spot transmit or receive errors and confirm that the expected address is present. If the interface is down, fix that before investigating routes. If the interface is up but the address is absent or has the wrong prefix, correct addressing next.

Route and rule checks

ip route show table main
ip rule show
ip route get 1.1.1.1

These commands reveal whether the destination is covered, which table is consulted, and which source and device the kernel selected. For policy routing, repeat ip route get with the relevant from address, mark, or interface context where supported.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Neighbor resolution

ip neigh show dev ens3

The neighbor cache records link-layer resolution for local next hops. An INCOMPLETE or persistently failed neighbor entry can indicate an unreachable gateway, an incorrect prefix, a provider-side L2 restriction, or a link problem. A valid neighbor entry does not prove that a remote service is listening; it only confirms local next-hop resolution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Socket and service checks

ss -lntup

ss shows listening TCP and UDP sockets and established connections. If route and neighbor checks succeed but a port is unreachable, verify that the service is bound to the expected address or wildcard, that the VPS firewall permits it, and that any provider security group allows it. A routing command cannot make a process listen on a port.

Symptom-to-layer decision table

Observed symptom First inspection Likely corrective layer
Interface reports down or no lower-layer signal ip -s link show dev ens3 Bring the link up or correct the provider/NIC attachment.
Expected address is missing ip address show dev ens3 Add the correct prefix, then configure it persistently.
Wrong egress device or source ip rule show and ip route get Fix the matching table, rule priority, route, or source selection.
Gateway does not resolve ip neigh show dev ens3 Check prefix, gateway reachability, link state, and provider restrictions.
Path works but application fails ss -lntup Check service binding and host/provider firewall policy.

Make the configuration survive reboot

Commands issued with ip modify the running kernel. The iproute2 manuals document those runtime operations, not one universal persistence format for every VPS distribution. A route or address added interactively can therefore disappear at reboot, interface restart, or network-manager reload.

Use the distribution and provider’s network manager

After a command works interactively, encode the address, gateway, routes, and any policy rules in the network configuration system used by that image and provider. Depending on the distribution, that may be a declarative network manager, systemd-networkd, NetworkManager, or a provider-generated boot configuration. Use the platform’s documented syntax and ensure the service is enabled for the relevant interface.

Validate persistence without losing access

  1. Keep the console or a second SSH session available.
  2. Apply the persistent configuration using the platform’s supported reload or restart method.
  3. Run ip -br address, ip route show, and ip rule show again.
  4. Test the important destinations with ip route get and make a real application connection.
  5. Reboot only during a maintenance window, then repeat the checks to confirm that the state was recreated.

Remove temporary addresses, routes, and experimental rules that should not return after a reboot. Leaving both a hand-entered route and a persistent route can create duplicate or conflicting entries during later maintenance.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational patterns that avoid common mistakes

Change one layer at a time

For a new interface, first confirm the link, then assign the address, then add a connected or static route, and finally test the selected path. Changing link state, addresses, the default route, and policy rules in one command batch makes it difficult to identify which operation caused an outage.

Prefer idempotent route deployment

Configuration automation should use ip route replace where an existing route may or may not be present. Pair it with explicit checks for interface names, addresses, and rule priorities. Idempotence prevents a second deployment from failing merely because the first deployment already installed the route.

Separate temporary tests from production state

Use the documentation ranges only in examples and labs. For a maintenance test on a real VPS, record the exact command, expected output, and rollback command before running it. Delete temporary state when the test ends, and place the approved result in the distribution’s persistent network configuration.

Check both directions

A VPS can select the correct outbound route while replies take a different path because of source selection, policy rules, or an upstream anti-spoofing policy. Test with the actual source address, inspect the rule order, and confirm that the selected interface owns that source. For services, also verify that the daemon is listening on the address and that return traffic is permitted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A compact workflow for routine VPS changes

  1. Identify the device with ip -br link and addresses with ip -br address.
  2. Inspect ip route show and test the current path using ip route get.
  3. Bring the required link up with ip link set ... up if it is administratively down.
  4. Add or remove the address with ip address add or ip address del.
  5. Install or update a route, using ip route replace when repeatability matters.
  6. If multiple uplinks are involved, inspect the default RPDB rules before adding a custom table and rule.
  7. Verify counters, neighbors, routes, rules, and listening sockets in that order.
  8. Encode the validated state in the VPS distribution/provider network manager and test it after a controlled restart or reboot.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.