CentOS7中持久化静态路由69.0.0.0/8的配置定位排查问询
Alright, let's tackle this persistent route issue on CentOS 7 step by step. The fact that it survives reboots but doesn't show up in /etc searches tells us it's either managed by a service you haven't checked, or it's an auto-generated kernel route (which is super common here).
1. Other Places to Look for Persistent Route Configs
Beyond the /etc root you already scanned, these are the most likely spots:
- NetworkManager Connection Files: Most CentOS 7 systems use NetworkManager by default, and it stores per-connection configs in
/etc/NetworkManager/system-connections/. Each network connection is a plaintext file (often named after your NIC or connection name) with an[ipv4]section that might define routes viaroutes=orroute1=entries. Rungrep -r "69.0.0.0" /etc/NetworkManager/to check these. - DHCP-Pushed Routes: If your eth0 interface uses DHCP, the DHCP server might be sending this route along with your IP address. Check the lease file at
/var/lib/dhclient/dhclient-eth0.leasesfor any route-related lines, or look at/etc/dhcp/dhclient.confto see if custom route requests are configured. - Post-Up Scripts: Custom scripts that run after the network comes up can add routes. Check:
/etc/rc.local(make sure it's executable withchmod +x /etc/rc.localif you're using it)/etc/sysconfig/network-scripts/ifup-local(a script that runs for all interfaces when they come up)
- Systemd Services: Custom systemd services might run
ip route addcommands on boot. Scan/etc/systemd/system/and/usr/lib/systemd/system/for service files that include route-related commands, or usesystemctl list-unit-files --type=serviceto look for suspect services.
2. How to Pin Down Exact Route Origin
Here's how to trace where this route is coming from:
- Check for Kernel-Generated Routes: Your
ip routeoutput showsproto kernel—that's a key clue! This means the route was automatically created by the Linux kernel when your eth0 interface was assigned its IP (69.1XX.XXX.X7). If your NIC's subnet mask is set to/8(255.0.0.0), the kernel will automatically add a route for the entire 69.0.0.0/8 network as a direct attached subnet. Verify this withip addr show eth0—look for theinetline to confirm the subnet mask is/8. - Inspect NetworkManager's Active Config: Use
nmcli con showto list all active connections, find the one tied to eth0, then runnmcli con show <connection-name> | grep -i routeto see if any static routes are defined there. You can also check the device's current state withnmcli device show eth0 | grep route. - Track Route Changes in Real-Time: Use
ip monitor routeto watch for route additions/removals as you reboot or restart network services—this can help you narrow down exactly when the route is added.
3. IP Management Pitfalls to Watch For
- NetworkManager vs. Legacy
networkService: CentOS 7 defaults to NetworkManager, but if you've ever switched to the legacynetworkservice, configs might be split or conflicting. Check which service is running withsystemctl status NetworkManagerandsystemctl status network. - Static vs. DHCP Conflicts: If you switched from DHCP to static IP but didn't fully clean up DHCP settings, leftover leases or configs might still be pushing routes.
- Kernel Route Behavior: Remember that direct attached routes (marked
proto kernel) are not static routes—they're auto-generated based on your NIC's IP and subnet. You won't find them in any static route config files, and modifying them directly (withip route del) will only work until the next reboot or network restart.
内容的提问来源于stack exchange,提问作者Frank Phillips
相关产品推荐
相关产品推荐

