美文网首页
Ubuntu Static IP Configuration

Ubuntu Static IP Configuration

作者: 观星汉 | 来源:发表于2019-05-13 21:01 被阅读0次

Ubuntu linux 静态IP配置

  • 查询网卡信息:
$ ip address show

记录网卡信息, lo 不是真实的网卡信息, 类似 eth*, ens* 等。 本机网卡为: ens33

  • 配置静态IP地址

修改网络配置文件: /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 dhcp

# 设置为静态IP分配
iface ens33 inet static

# IP地址
address 192.168.0.80

# 掩码
netmask 255.255.255.0

#网关
gateway 192.168.0.1

# DNS 服务器
dns-nameservers 192.168.0.1
  • 重启网络服务
sudo service networking restart

重启生效, 或 reboot 生效.

相关文章

网友评论

      本文标题:Ubuntu Static IP Configuration

      本文链接:https://www.haomeiwen.com/subject/sbqdaqtx.html