本文參考的資料:ubuntu
https://blog.csdn.net/liu782726344/article/details/52912797。vim
感謝做者的分享!網絡
打開配置文件進行修改:oop
sudo vim /etc/network/interfaces
看到配置文件的內容是:spa
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
修改增長新內容:.net
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 #iface eth0 inet dhcp iface eth0 inet static address 靜態IP地址 netmask 255.255.255.0 gateway 默認網關 dns-nameservers DNS1 DNS2
其中的靜態IP地址、默認網關、DNS一、DNS2,請根據本地電腦的配置,進行相應配置。rest
而後關機,設置網絡的鏈接方式爲【橋接網卡】,啓動ubuntu。code
查看ip地址,發現ip地址爲剛纔配置的ip信息,ping一個網址,有數據響應,表示能夠上網了。server
總結:blog
ubuntu 14.04 的網絡配置文件位置:/etc/network/interface。
ubuntu 14.04 的重啓網絡的命令是:sudo /etc/init.d/networking restart。