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 

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

ubuntu添加静态路由永久生效_第1张图片

你可能感兴趣的:(linux,计算机网络)