Ubuntu 设置固定IP
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

暂无评论
发表评论
[annotate]术语||注释[/annotate]悬停术语注释[blur]模糊文本[/blur]高斯模糊[black]黑幕文本[/black]黑幕遮挡[img]图片地址[/img]内嵌图片[b]粗体[/b] [i]斜体[/i] [s]删除线[/s] [u]下划线[/u]文字样式[url=链接地址]文字[/url]超链接[quote]引用内容[/quote]引用块[h1]~[h5]标题[/h1]~[/h5]多级标题