Ubuntu linux 靜態(tài)IP配置
- 查詢網(wǎng)卡信息:
$ ip address show
記錄網(wǎng)卡信息昂验, lo
不是真實的網(wǎng)卡信息, 類似 eth*
, ens*
等争群。 本機網(wǎng)卡為: ens33
- 配置靜態(tài)IP地址
修改網(wǎng)絡配置文件: /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 dhcp
# 設置為靜態(tài)IP分配
iface ens33 inet static
# IP地址
address 192.168.0.80
# 掩碼
netmask 255.255.255.0
#網(wǎng)關
gateway 192.168.0.1
# DNS 服務器
dns-nameservers 192.168.0.1
- 重啟網(wǎng)絡服務
sudo service networking restart
重啟生效痢艺, 或 reboot
生效.