Ubuntu下启动后网卡没有服务没有启动的问题

参照了很多帖子,两个典型的帖子分别是
https://blog.csdn.net/ErErFei/article/details/98205463
Ubuntu 18.04设置开机自动启动
https://blog.csdn.net/weixin_42116341/article/details/81410805
Ubuntu输入ifconfig找不到IP地址,只有lo问题

和第二个帖子里面不同的是,我的每次重启都要敲一遍这个命令

sudo dhclient ens33
sudo ifconfig ens33

所以就参照第一个帖子吧这两条命令在启动时候执行。
添加内容:

#以下为添加项
sudo dhclient eno1
sudo ifconfig eno1
#添加log输出,以确认命令正确执行
sudo echo “the enthernet boot information!” > /usr/local/text1.log
#以上为添加项

具体如下:

#!/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.

#以下为添加项
sudo dhclient eno1
sudo ifconfig eno1
# 添加log输出,以确认命令正确执行
sudo echo "the enthernet boot information!" > /usr/local/text1.log
#以上为添加项

sudo echo "just test" > /usr/local/text.log
exit 0

reboot后ifconfig,网卡显示出来了

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.101.103  netmask 255.255.255.0  broadcast 192.168.101.255
        inet6 fe80::4639:c4ff:fe54:757e  prefixlen 64  scopeid 0x20<link>
        ether 44:39:c4:54:75:7e  txqueuelen 1000  (以太网)
        RX packets 221  bytes 27984 (27.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 245  bytes 48380 (48.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf7e00000-f7e20000  

结束,收工。

  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值