How to Create a Permanent Static Route on Rocky Linux 9
To make a static route permanent under Rocky Linux 9, you need to follow these steps:
-
Open the terminal on your Rocky Linux system.
-
Type the following command to open the network configuration file in the nano editor:
sudo nano /etc/sysconfig/network-scripts/route-interfaceReplace 'interface' with the name of the interface that the static route is associated with.
-
Add the static route details to the file in the following format:
ADDRESS via GATEWAY dev INTERFACEReplace ADDRESS with the IP address of the network or host that the static route is for.
Replace GATEWAY with the IP address of the gateway for the network.
Replace INTERFACE with the name of the interface that the static route is associated with.
-
Save the changes to the file by pressing
Ctrl+Oand exit the nano editor by pressingCtrl+X. -
Restart the network service to apply the changes by typing the following command:
sudo systemctl restart network
The static route should now be permanent and will be automatically added to the routing table every time the network service is started or restarted.
原文地址: https://www.cveoy.top/t/topic/ohK7 著作权归作者所有。请勿转载和采集!