中文 English

Auto-Add N2N Route Table on CentOS 7 Boot

Published: 2022-02-06
centos route N2N edge systemctl Linux Linux

1. Edit the systemctl Auto-Start File

vim /etc/systemd/system/n2route.service
[Unit]
Description=N2N Edge Add Route
After=edge.target

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 60
ExecStart=/usr/sbin/route -v add -net 192.168.100.0 netmask 255.255.252.0 gw 10.0.0.103
TimeoutStartSec=0
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

2. Reload systemctl

systemctl daemon-reload

3. Manually Run the Command for Testing

systemctl start n2route

4. Set to Start Automatically on Boot

systemctl enable n2route