ubuntu添加静态路由永久生效

vim  /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
route add default gw  169.254.0.254
#将路由添加到配置文件,永久生效
route add default gw  10.1.1.1254

重启电脑reboot 

查看路由表 可以知道已经生效了


版权声明:本文为nmjhehe原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。