首页 > 系统服务 > 详细

Ubuntu 网络配置

时间:2017-05-26 21:37:39      阅读:466      评论:0      收藏:0      [点我收藏+]

1、默认情况下Ubuntu 的网络配置文件为: sudo vim /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 static
                                    #静态IP,如果需要设置成DHCP模式,那下面这3行已经不需要了,直接改成: iface ens33 inet dhcp
address 10.6.2.171
network 255.255.255.0
gateway 10.6.2.254

也可以手动增加静态路由:sudo route add default gw 10.6.2.254

2、配置DNS

默认情况下是修改:sudo vim /etc/resolv.conf

nameserver 10.6.1.1
nameserver 10.1.1.1

3、重启网络服务

sudo /etc/init.d/networking reload

sudo /etc/init.d/networking restart

停卡网卡:

sudo ifconfig ens33 down

sudo ifconfig ens33 up

4、如果是虚拟机克隆,可能会导致网卡检测不到或者启动不起来

sudo rm /etc/udev/rules.d/70-persistent-net.rules
把这个文件删掉,再重启Ubuntu 服务器就可以了。

5、更改服务器名

sudo hostnamectl set-hostname USRV-1

重启,即可


Ubuntu 网络配置

原文:http://tengq.blog.51cto.com/2004324/1929916

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!