ubuntu配置静态IP主要修改interfaces文件
我们直接打开文件
vi /etc/network/interfaces
然后添加以下配置
auto eth0 iface eth0 inet static address 10.214.161.240 netmask 255.255.255.0 #子网掩码 gateway 10.214.161.1 #默认网关
eth0需要ifconfig -a查看当前网卡名字,如果不能确认网卡名字,可以使用命令让网卡灯闪烁来确认,具体命令为
ethtool -p eth0 5
这样可以使eth0网卡灯闪烁5秒,可以进行相关问题排查,ethtool相关命令可以查看我的笔记:https://sulao.cn/post/218
然后网卡配置完了,我们可以配置dns(如果有需要)
vi /etc/resolve.conf
添加或者修改如下配置
nameserver 127.0.0.1 nameserver 8.8.8.8
最后就是重启网卡了
/etc/init.d/networking restart
最好再使用ifconfig -a确认IP是否配置到网卡上了
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://sulao.cn/post/10
相关阅读
- ubuntu22.04删除系统中的新内核并回退的方法
- ubuntu22.04部署chrony时间同步服务
- ubuntu22.04部署ntp时间同步服务器
- ubuntu22.04切换cgroup v2到cgroup v1
- ubuntu22.04安装nvidia-fabricmanager
- ubuntu22.04使用containerd部署k8s集群
- ubuntu22.04下k8s集群kube-proxy从iptables切换到ipvs模式
- ubuntu22.04部署openvpn和openvpn客户端配置
- linux云服务器内存缩水问题的解决方法
- ubuntu22.04编译安装postgresql17.5
评论列表