Recent small mess I use the Ansible batch deployment device access to the log audit system, after the discovery of script execution, the log server side still did not receive the Linux host upload syslog, after troubleshooting the cause of the failure is that the host route is not put through
To add a route to a host, the instructions are simple:
1. Add/Remove Default gateways:
Added: Route add default GW GATEWAY_IP
Delete: Route del default GW gateway_i
2. Add/Remove normal routes:
-host 192.168.1.1 GW gateway_ip Delete: Route del -gateway_ip-192.168.1.1Gateway_ IP Delete: Route del 192.168.1.1255.255.255.255gateway_ip
Note: Add routes directly using the route command, and once the system restarts, the configured routes will disappear ;
Cause: The routing table of the Linux host only survives in memory;
Workaround: Add the routing information to the following file (either) and the system will load automatically when it restarts:
1,/etc/rc.local 2,/etc/ profile 3,/etc/sysconfig/static-router
Enclose the format written on these three files:
1,/etc/rc.local
Route Add-host x.x.x.x GW x.x.x.x -net x.x.x.x netmask x.x.x.x GW x.x.x.x
2,/etc/profile
Route Add-host x.x.x.x GW x.x.x.x -net x.x.x.x netmask x.x.x.x GW x.x.x.x
3,/etc/sysconfig/static-router (if you do not have this file, you can manually create a)
192.168. 1.0/ GW gateway_ip
Any host 192.168.1.0 GW Gateway_ip
Additional notes:
For example, using 1 and 2, the route will be loaded automatically after rebooting the system, but if the network service is restarted, the routing table is still missing because the system is not re-loaded in/etc/profile and/etc/rc.local, but using 3 does not occur, and viewing the data on the web says: The network script invokes the information inside the/etc/sysconfig/static-router, so using Method 3, you can still load the routing table even if you restart the network service.
Linux hosts add routing route