AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1259209
Accepted
CIsForCookies
CIsForCookies
Asked: 2020-07-15 23:00:02 +0800 CST2020-07-15 23:00:02 +0800 CST 2020-07-15 23:00:02 +0800 CST

是否可以为 etc 主机创建规则(规则:10.0.0.* ip。用法:ping ip.10)?

  • 772

如果我有多个主机,我想为其添加别名,例如

10.0.0.10 ip_10
10.0.0.11 ip_11
10.0.0.12 ip_12

有没有办法将这些组合成一行?

我试过了

10.0.0. ip

然后尝试用 ping 它,ping ip.10但它给了ping: unknown host ip.10.

我也试过10.0.0.* ip.*

networking hosts
  • 1 1 个回答
  • 30 Views

1 个回答

  • Voted
  1. Best Answer
    muru
    2020-07-15T23:26:17+08:002020-07-15T23:26:17+08:00

    不。 的格式/etc/hosts非常简单,不允许进行复杂的模式匹配:

    This  manual page describes the format of the /etc/hosts file.  This file is a simple text
    file that associates IP addresses with hostnames, one line per IP address.  For each  host
    a single line should be present with the following information:
    
          IP_address canonical_hostname [aliases...]
    
    Fields  of  the  entry  are separated by any number of blanks and/or tab characters.  Text
    from a "#" character until the end of the line is a comment, and is ignored.   Host  names
    may contain only alphanumeric characters, minus signs ("-"), and periods (".").  They must
    begin with an alphabetic character and  end  with  an  alphanumeric  character.   Optional
    aliases  provide  for  name  changes,  alternate  spellings, shorter hostnames, or generic
    hostnames (for example, localhost).
    

    BIND 显然支持这样的东西,以防你想尝试。

    • 2

相关问题

  • 如何设置 VLAN 转发?

  • 如何将主机 Ubuntu 上的 VPN (tun0) 网络适配器映射到 VirtualBox 来宾 Windows?

  • 如何限制下载/上传带宽?

  • 如何通过 Windows 网络共享文件?

  • 面板小程序以文本形式显示当前网络流量?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve