• 欢迎访问小贝笔记网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入小贝笔记 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏小贝笔记吧

Ubuntu 设置固定IP

Ubuntu 小贝 6年前 (2017-12-09) 4132次浏览 0个评论

 

1.使用vim打开网络配置文件

$sudo vim /etc/network/interfaces

2.编辑配置文件

# 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 ens160 \\需要设置IP地址的网卡名称
iface ens160 inet static   \\设置网卡IP地址获取方式,dhcp 表示使用内部DHCP服务器自动分配。static表示手动设置
address 192.168.1.10  \\设置网卡的IP地址
netmask 255.255.255.0  \\设置子网掩码
network 192.168.1.0  \\设置本网网络号
broadcast 192.168.1.255  \\设置本网广播地址
gateway 192.168.1.1  \\设置网关地址
dns-nameserver 8.8.4.4 8.8.8.8  \\设置DNS服务器地址
dns-search test.com  \\dns搜索域

3.重启网络服务

$ sudo /etc/init.d/networking restart

 

 

 

 

 


小贝笔记 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Ubuntu 设置固定IP
喜欢 (107)

您必须 登录 才能发表评论!