設(shè)置ubuntu為靜態(tài)ip地址的方法:
1.打開終端命令行模式。
2.輸入以下命令獲取網(wǎng)卡名稱。
ifconfig
3.再輸入以下命令修改網(wǎng)卡配置文件。
sudo vim /etc/network/interfaces
例如:
# The primary network interface
# auto ens33
# iface ens33 inet dhcp //需要注釋掉
auto ens33 //網(wǎng)卡名稱
iface ens33 inet static //設(shè)置為靜態(tài)
address 192.168.0.89 //靜態(tài)ip地址
netmask 255.255.255.0 //子網(wǎng)掩碼
gateway 192.168.0.1 //網(wǎng)關(guān)
4.再輸入以下命令修改DNS配置。
sudo vim /etc/resolvconf/resolv.conf.d/head
5.再輸入以下命令重啟網(wǎng)絡(luò)服務(wù)。
sudo /etc/init.d/networking restart
6.若出現(xiàn)“The remote system refused the connection.”錯(cuò)誤,需要安裝ssh服務(wù)。
sudo apt-get install openssh-server