Fix 'Invalid prefsrc address' Error in ip route add command
The error message 'Invalid prefsrc address' indicates that the source address provided in the 'ip route add' command is incorrect. The specified source address (172.18.0.52) must be a valid IP address assigned to the network interface (eth0) mentioned in the command.
To resolve this issue, follow these steps:
-
Verify Interface IP Address: Utilize the command 'ip addr show eth0' to check the IP address assigned to the eth0 interface. Ensure that the source address used in the 'ip route add' command matches a valid IP address assigned to eth0.
-
Assign a New IP Address (If Necessary): If the IP address assigned to eth0 is incorrect, you can assign a new IP address using the command 'ip addr add <ip_address>/24 dev eth0'. Replace
<ip_address>with the desired IP address. -
Retry the 'ip route add' Command: After confirming or assigning a valid source address to eth0, re-execute the 'ip route add' command with the correct source address. For example: 'ip route add default via 192.168.123.39 dev eth0 src <valid_ip_address>'.
原文地址: https://www.cveoy.top/t/topic/oaqB 著作权归作者所有。请勿转载和采集!