ubuntu-rc.local

修改rc-local.service
vi /lib/systemd/system/rc.local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes


# 开机自启

systemctl enable rc.local


vi /etc/rc.local
#!/bin/bash
ifconfig ens32 0.0.0.0
ifconfig br-ex 192.168.2.30/24                     #修改为本机ip
ip route add default via 192.168.2.2 dev br-ex    #改成主机对应网关
exit 0

新增执行权限
chmod +x /etc/rc.local
posted @ 2021-06-24 09:34  zxhy哦  阅读(75)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css