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:

  1. 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.

  2. 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.

  3. 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>'.

Fix 'Invalid prefsrc address' Error in ip route add command

原文地址: https://www.cveoy.top/t/topic/oaqB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录