tzselect #设置时间
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #创建时区软链
timedatectl status #查看时间
#Ubuntu 18.04使用netplan配置网络
sudo vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
eth0:
addresses:
- 192.168.0.20/24
gateway4: 192.168.0.10
nameservers:
addresses:
- 192.168.0.8
version: 2
sudo netplan apply
#重启
ip addr list #查看
#使用ifupdown配置网络
sudo apt install ifupdown #安装ifupdown
ifconfig #查看IP
netstat -rn 或 route -n #查看网关
cat /etc/resolv.conf #查看DNS
#修改配置文件
sudo vim /etc/network/interfaces
iface ens160 inet static
address 192.168.0.20
gateway 192.168.0.10
netmask 255.255.255.0
dns-nameservers 192.168.0.8
sudo services network restrart #重启网络服务使配置生效
#修改DNS
sudo vim /etc/resolv.conf
sudo /etc/init.d/resolvconf restart #重启服务使DNS生效