ubuntu14.04 配置網絡的練習
本文參考的資料:
https://blog.csdn.net/liu782726344/article/details/52912797。
感謝作者的分享!
打開配置文件進行修改:
sudo vim /etc/network/interfaces
看到配置文件的內容是:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
修改增加新內容:
# 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地址、默認網關、DNS1、DNS2,請根據本地電腦的配置,進行相應配置。
然后關機,設置網絡的連接方式為【橋接網卡】,啟動ubuntu。
查看ip地址,發現ip地址為剛才配置的ip信息,ping一個網址,有數據響應,表示可以上網了。
總結:
ubuntu 14.04 的網絡配置文件位置:/etc/network/interface。
ubuntu 14.04 的重啟網絡的命令是:sudo /etc/init.d/networking restart。
