網絡配置
靜態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
