ubuntu14.04 配置网络

mac2022-06-30  18

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。


 

转载于:https://www.cnblogs.com/gyfluck/p/9553993.html

最新回复(0)