Loading

Ubuntu 网络配置

网络配置

静态IP

root@ubuntu:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet static
    address 10.0.0.50
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.2
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 10.0.0.

DHCP动态IP

以DHCP方式配置网卡

编辑文件
vi /etc/network/interfaces

并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

用下面的命令使网络设置生效

/etc/init.d/networking restart

设置主机名称(hostname)

使用下面的命令来设置当前主机的主机名称:

vim /bin/hostname

newname系统启动时,它会从/etc/hostname来读取主机的名称.

配置DNS

vim /etc/resolv.conf
posted @   宋某人  阅读(1138)  评论(0编辑  收藏  举报
编辑推荐:
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· C# 深度学习:对抗生成网络(GAN)训练头像生成模型
· .NET 适配 HarmonyOS 进展
阅读排行:
· 本地部署 DeepSeek:小白也能轻松搞定!
· 如何给本地部署的DeepSeek投喂数据,让他更懂你
· 从 Windows Forms 到微服务的经验教训
· 李飞飞的50美金比肩DeepSeek把CEO忽悠瘸了,倒霉的却是程序员
· 超详细,DeepSeek 接入PyCharm实现AI编程!(支持本地部署DeepSeek及官方Dee
点击右上角即可分享
微信分享提示
主题色彩