lshw -class network
临时设置IP地址:
sudo ip addr add 10.102.66.200/24 dev ens160
ip link set dev ens160 up
ip link set dev ens160 down
ip address show dev ens160
sudo ip route add default via 10.102.66.1
ip route show
ip addr flush ens160
设置静态IP地址:
vi /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
ens160:
addresses: [ 172.16.8.18/24 ]
gateway4: 172.16.8.1
nameservers:
search: [ afd.ink ]
addresses:
- "172.16.8.10"
使配置生效:
sudo netplan apply
配置动态的IP(DHCP):
vi /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
ens160:
sudo netplan apply
Name Service Switch Configuration: /etc/nsswitch.conf
配置DHCP服务:
sudo apt install isc-dhcp-server
vi /etc/dhcp/dhcpd.conf
# minimal sample /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 172.16.8.0 netmask 255.255.255.0 {
range 172.16.8.150 172.16.8.200;
option routers 172.16.8.1;
option domain-name-servers 172.16.8.10, 172.16.8.20;
option domain-name "afd.ink";
}
sudo systemctl restart isc-dhcp-server.service
时间同步(NTP):
timedatectl status
systemctl status systemd-timesyncd
用户管理:
sudo adduser username
sudo deluser username
sudo chown -R root:root /home/username/
sudo mkdir /home/archived_users/
sudo mv /home/username /home/archived_users/
sudo passwd -l username
sudo passwd -u username
sudo addgroup groupname
sudo delgroup groupname
sudo adduser username groupname
User Profile: /etc/skel
ls -ld /home/username
sudo chmod 0750 /home/username
/etc/adduser.conf