网络配置
静态IP
[email protected]:~# 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
原文地址:https://www.cnblogs.com/syaving/p/8729269.html
时间: 2024-10-10 04:51:48