网络参数与配置文件

来源:互联网 发布:黄景瑜许魏洲关系知乎 编辑:程序博客网 时间:2024/04/19 12:56
IP  Netmask DHCP Gateway      /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet #网卡类型  
DEVICE=eth0 #网卡接口名称 
ONBOOT=yes #系统启动时是否自动加载 
BOOTPROTO=static #启用地址协议 --static:静态协议 --bootp协议 --dhcp协议 
IPADDR=192.168.1.11 #网卡IP地址 
NETMASK=255.255.255.0 #网卡网络地址 
GATEWAY=192.168.1.1 #网卡网关地址 
DNS1=10.203.104.41 #网卡DNS地址 
HWADDR=00:0C:29:13:5D:74 #网卡设备MAC地址 
BROADCAST=192.168.1.255 #网卡广播地址


主机名      /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NTPSERVERARGS=iburst


DNS IP    /etc/resolv.conf  Name Server DNS的IP地址
domainname 域名
search 域名
# Generated by NetworkManager
domain test.com
search test.com
nameserver 202.117.128.2
nameserver 222.24.19.2
nameserver 114.114.114.114
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 8.8.8.8
nameserver 218.30.19.50
~                        
私有IP对应的主机名  /etc/hosts 私有IP主机名 别名  提供主机名到IP地址的对应关系,建议将自己经常使用的主机

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


指定主机名查找方法,通常指先查找文件/etc/hosts,找不到时再向DNS服务器请求   /etc/host.conf
/etc/host.conf文件
 该文件指定如何解析主机名。Linux通过解析器库来获得主机名对应的IP地址。下面是一个“/etc/host.conf”的示例:
 order  bind,hosts
 multi  on
nospoof  on
 “order  bind,hosts”指定主机名查询顺序,这里规定先使用DNS来解析域名,然后再查询“/etc/hosts”文件(也可以相反)。
 “multi  on”指定是否“/etc/hosts”文件中指定的主机可以有多个地址,拥有多个IP地址的主机一般称为多穴主机。
 “nospoof  on”指不允许对该服务器进行IP地址欺骗。IP欺骗是一种攻击系统安全的手段,通过把IP地址伪装成别的计算机,来取得其它计算机的信任。
                                                                                 


ifcfg-enp0s25
# Generated by dracut initrdDEVICE="enp0s25"ONBOOT=yesNETBOOT=yesUUID="d67b072c-e3bf-4e6f-95df-ae9084275d2b"IPV6INIT=yesBOOTPROTO=staticIPADDR=192.168.3.156GATEWAY=192.168.3.252NETMASK=255.255.255.0DNS1=192.168.3.252HWADDR="00:1e:37:82:4c:6d"TYPE=EthernetNAME="enp0s25"




0 0
原创粉丝点击