Ubuntu 在安裝完成時會設DHCP 並自動取得 IP,可透過文字介面來手動設定固定IP。
1.修改 Ethernet 網路設定
root@management:~# vim /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 ens160
iface ens160 inet static # 固定 (靜態) IP
address 10.159.xx.xx # IP 位址
netmask 255.255.255.0 # 網路遮罩
gateway 10.159.xx.xx # 預設閘道
dns-nameservers 168.95.1.1 #DNS第一組
dns-nameservers 8.8.8.8 #DNS第二組
2. 修改完可使用以下指令重新啟動網路讀取網路設定
root@management:~# /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service
Add User Ubuntu create user account commands
Let us say you need to add a new user in Ubuntu called vivek, type the following command in your shell:
$ sudo adduser John
Verify
$ cat /etc/passwd
Ubuntu 快速將使用者設成 Sudoer
max@ubuntu:~$ sudo adduser s01224566 sudo
Adding user `s01224566' to group `sudo' ...
Adding user s01224566 to group sudo
Done.
max@ubuntu:~$ sudo cat /etc/group | grep sudo
sudo:x:27:max,sena,gary,s01224566
Ubuntu 18.04 Configuring the network interface
Edit /etc/netplan/00-installer-config.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes/no
addresses: [192.168.1.222/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
$sudo netplan apply
沒有留言:
張貼留言