linux网络配置-参考文档

/usr/share/doc/initscripts-9.03.40/sysconfig.txt

/etc/sysconfig/network-scripts/ifcfg-<interface-name>:<alias-name>:

The first defines an interface, and the second contains
  only the parts of the definition that are different in a
  "alias" (or alternative) interface.  For example, the
  network numbers might be different, but everything else
  might be the same, so only the network numbers would be
  in the alias file, but all the device information would
  be in the base ifcfg file.

The items that can be defined in an ifcfg file depend on the
  interface type.  The really obvious ones I‘m not going to
  bother to define; you can figure out what "IPADDR" is, I
  think...  :-)

Base items:
    NAME=<friendly name for users to see>
      Most important for PPP.  Only used in front ends.
    DEVICE=<name of physical device (except dynamically-allocated PPP
      devices where it is the "logical name")>
    IPADDRn=
    PREFIXn=
      Network prefix.  It is used for all configurations except aliases
      and ippp devices.  It takes precedence over NETMASK when both
      PREFIX and NETMASK are set.
    NETMASKn=
      Subnet mask; just useful for aliases and ippp devices.  For all other
      configurations, use PREFIX instead.

The "n" is expected to be consecutive positive integers starting from 0.
    It can be omitted if there is only one address being configured.

GATEWAY=
    METRIC=
      Metric for the default route using GATEWAY
    ONBOOT=yes|no (not valid for alias devices; use ONPARENT)
    HOTPLUG=yes|no
    USERCTL=yes|no
    BOOTPROTO=none|bootp|dhcp
    VLAN=yes|no
    MTU=
      Default MTU for this device
    WINDOW=
      Default window for routes from this device
    PEERDNS=yes|no
      modify /etc/resolv.conf if peer uses msdns extension (PPP only) or
      DNS{1,2} are set, or if using dhclient. default to "yes".
    DNS{1,2}=<ip address>
      provide DNS addresses that are dropped into the resolv.conf
      file if PEERDNS is not set to "no".
    SCOPE=
      Set to "scope SCOPE-ID" to set a non-default scope.  Supported only on
      Ethernet with BOOTPROTO=none.
    SRCADDR=
      use the specified source address for outgoing packets
    HWADDR=
      ethernet hardware address for this device
    MACADDR=
      Set the hardware address for this device to this.
      Use of this in conjunction with HWADDR= may cause
      unintended behavior.
    NOZEROCONF=
      Set this to not set a route for dynamic link-local addresses
      over this device.
    PERSISTENT_DHCLIENT=yes|no|1|0
      Without this option, or if it is ‘no‘/‘0‘, and BOOTPROTO=dhcp,
      dhclient is run for the interface in "one-shot" mode; if the
      dhcp server does not respond for a configurable timeout, then
      dhclient exits and the interface is not brought up -
      the ‘-1‘ option is given to dhclient.
      If PERSISTENT_DHCLIENT=yes, then dhclient will keep on trying
      to contact the dhcp server when it does not respond - no ‘-1‘
      option is given to dhclient. Note: this disables the automatic
      checking for the presence of a link before starting dhclient.
    DHCPRELEASE=yes|no|1|0
      With this option set to ‘yes‘ (1), when a dhcp configured
      interface is brought down with ‘ifdown‘, the lease will be
      released. Otherwise, leases are not released.
    DHCP_HOSTNAME=<name>
      Sends the specified hostname to the DHCP server.
    DHCLIENT_IGNORE_GATEWAY=yes|no|1|0
      If set to ‘yes‘, it will cause dhclient-script to ignore any $GATEWAY
      setting that may be in the ifcfg file for this interface.
      Otherwise, the dhclient session which obtains an ip-address
      on the same subnet as $GATEWAY will set the default route
      to be via $GATEWAY, and no other dhclient session will set
      the default route.
    DHCLIENTARGS=
      Any additional arguments to dhclient.
    NM_CONTROLLED=yes|no
      If set to ‘no‘, NetworkManager will ignore this connection/device.
      Defaults to ‘yes‘.
    ARPCHECKn=yes|no
      If set to ‘no‘, ifup will not try to determine, if requested ip address
      is used by other machine in network.
      Defaults to ‘yes‘.
    IPV4_FAILURE_FATAL=yes|no
      If set to yes, ifup-eth will end immediately after ipv4 dhclient fails.
      Defaults to ‘no‘.

If BOOTPROTO is not "none", then the only other item that
  must be set is the DEVICE item; all the rest will be determined
  by the boot protocol.  No "dummy" entries need to be created.

Base items being deprecated:
    NETWORK=<will be calculated automatically with ipcalc>
    BROADCAST=<will be calculated automatically with ipcalc>

Alias specific items:
    ONPARENT=yes|no
      Whether to bring up the device when the parent device is brought
      up.
      Default: yes

IPv6-only items for real interfaces:
    IPV6INIT=yes|no
      Enable or disable IPv6 configuration for this interface
      Default: no
    IPV6FORWARDING=yes|no
      Enable or disable global forwarding of incoming IPv6 packets
      Note: Obsolete in interface specification!
      Default: no
    IPV6ADDR=<IPv6 address>[/<prefix length>]
      Specify a primary static IPv6 address here
      Optional, if normal host and a router advertisement daemon is on local link
      Required, if node is a router and interface should route packets
      Note: if prefix length is omitted, 64 is assumed
      Example:
        IPV6ADDR="3ffe:ffff:0:5::1"
        IPV6ADDR="3ffe:ffff:0:1::1/128"
    IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional)
      A list of secondary IPv6 addresses (e.g. useful for virtual hosting)
      Example:
        IPV6ADDR_SECONDARIES="3ffe:ffff:0:1::10 3ffe:ffff:0:2::11/128"
    IPV6_MTU=<MTU of link> (optional)
      Optional, dedicated MTU of this link
      Note: Must be greater or equal to 1280.
      Example:
        IPV6_MTU="1280"
    IPV6_PRIVACY=rfc3041
      Enables RFC 3041 IPv6 privacy support if set.
      Default: RFC 3041 support disabled

Special configuration options for multi-homed hosts etc.
        IPV6_ROUTER=yes|no: Controls IPv6 autoconfiguration
        IPV6_AUTOCONF=yes|no: Controls IPv6 autoconfiguration
         Defaults:
          Global IPV6FORWARDING=yes: IPV6_AUTOCONF=no, IPV6_ROUTER=yes
          Global IPV6FORWARDING=no: IPV6_AUTOCONF=yes

Optional settings for a 6to4 tunnel
    IPV6TO4INIT=yes|no
      Enable or disable 6to4 tunneling setup
      Default: no
    IPV6TO4_RELAY=<IPv4 address> (optional)
      IPv4 address of the remote 6to4 relay
      Note: if this is omitted, ::192.88.99.1 (the anycast relay address) is chosen
    IPV6TO4_IPV4ADDR=<IPv6 address>[/<prefix length>] (optional)
      Overwrite local IPv4 address which is accessible from the Internet
       (optional, in case of static IPv4-NAT behind a router or other special scenarios)
    IPV6TO4_MTU=<MTU for IPv6> (optional)
      Controls IPv6 MTU for the 6to4 tunnel
      Note: Must be greater or equal to 1280
      Example:
        IPV6TO4_MTU="1280"
      Default: MTU of master device - 20
    IPV6TO4_ROUTING="<device>-<suffix>/<prefix length> ..." (optional)
      A list of routing tokens to setup proper IPv6 interfaces on the LAN
      Example:
         IPV6TO4_ROUTING="eth0-:0004::1/64 eth1-:0005::1/64"
         Will create one address per eth0 and eth1, taking given SLA

Optional settings for a 6to4 tunnel or a ppp link
    IPV6_CONTROL_RADVD=yes|no (optional)
      Enable signaling radvd that the 6to4 prefix has been changed or a
       preconfigured dynamic device is up or down
      Default: no

IPv6-only items for static tunnel interface:
    Interface name: sitX (X => 1)
    IPV6INIT=yes|no
      Enable or disable IPv6 configuration for this interface
      Default: no
    IPV6TUNNELIPV4=<IPv4 address>
      Specify IPv4 address of a foreign IPv6-in-IPv4 tunnel endpoint
      Example:
        IPV6TUNNELIPV4="1.2.3.4"
    IPV6TUNNELIPV4LOCAL=<IPv4 address>
      Specify local IPv4 address of tunnel, useful on interfaces with multiple IPv4 addresses
    IPV6ADDR=<IPv6 address>[/<prefix length>] (optional)
     local IPv6 address of a numbered tunnel
    IPV6ADDR_SECONDARIES="<IPv6 address>[/<prefix length>] ..." (optional)
      A list of secondary IPv6 addresses (example see above)
    IPV6_MTU=<MTU of tunnel> (optional)
      Optional, dedicated MTU of this tunnel
      Note: Must be greater or equal to 1280
      Example:
        IPV6_MTU="1280"

IPv6-only option to enable DHCPv6 client:
      DHCPV6C=yes|no
      This will enable the DHCPv6 features of dhclient to be run for the interface.
      See man dhclient(8) and dhclient.conf(5).
      DHCPV6C_OPTIONS=...
      This will pass given arguments to the DHCPv6 client.  For example,
      "-S" option will request network information (e.g., DNS addresses)
      only, not IPv6 addresses.

Ethernet-only items:
    ARP=yes|no (adds ‘arp‘ flag to ifconfig, for use with the
      ethertap device)
    LINKDELAY=<time in seconds>
      Time that the system should pause after the specific interface is
      enabled.  This may be useful if one interface is connected to a
      switch which has spanning tree enabled and must wait for STP to
      converge before the interface should be considered usable.
    BRIDGE=<br* device>
      If set, the ethernet device is not assigned an address.  It is added to
      the specified bridge device instead.

Deprecated, but supported:
    ETHTOOL_OPTS=...
      Any device-specific options supported by ethtool. For example,
      if you wanted to force 100Mb full duplex:
        ETHTOOL_OPTS="speed 100 duplex full autoneg off"
      Note that changing speed or duplex settings almost always
      requires disabling autonegotiation with ‘autoneg off‘.

Long term, this should be done by sysadmin-written udev rules.

No longer supported:
     PROMISC=yes|no (enable or disable promiscuous mode)
     ALLMULTI=yes|no (enable or disable all-multicast mode)

To properly set these, use the packet socket interface.

Ethernet 802.1q VLAN items:
     DEVICE=eth0.42
       Initscripts use the device name for VLAN devices.
               Example: eth0.42 for vlan 42 on device eth0.
       Valid VLAN ID range is 0-4095. Most ethernet switches reserve
       VLAN ID 1 to be used as management VLAN; starting from VLAN
       ID 2 is recommended.
     REORDER_HDR=yes|no
       When enabled the VLAN device will move the ethernet header
       around to make it look exactly like a real ethernet device.
       This may help programs such as ISC dhcpd which read the raw
       ethernet packet and make assumptions about the location of
       bytes. If you don‘t need it turn it off because there
       is a small performance penalty. Default is on.

PPP/SLIP items:
    PERSIST=yes|no
    MODEMPORT=<device, say /dev/modem>
    LINESPEED=<speed, say 115200>
    DEFABORT=yes|no (tells netcfg whether or not to put default
      abort strings in when creating/editing the chat script and/or
      dip script for this interface)
      (meaningless with WVDIALSECT)

PPP-specific items
    WVDIALSECT=<list of sections from wvdial.conf to use>
      If this variable is set, then the chat script (if it
      exists) is ignored, and wvdial is used to open the
      PPP connection.
    DEFROUTE=yes|no (set this interface as default route? yes is default)
    DEBUG=yes|no (defaults to yes)
      turns on/off pppd and chat (if used) debugging.
    ESCAPECHARS=yes|no (simplified interface here doesn‘t let people
      specify which characters to escape; almost everyone can use
      asyncmap 00000000 anyway, and they can set PPPOPTIONS to
      asyncmap foobar if they want to set options perfectly)
    HARDFLOWCTL=yes|no (yes implies "modem crtscts" options)
    PPPOPTIONS=<arbitrary option string; is placed last on the
      command line, so it can override other options like asyncmap
      that were specified differently>
    PAPNAME=<"name $PAPNAME" on pppd command line> (note that
      the "remotename" option is always specified as the logical
      ppp device name, like "ppp0" (which might perhaps be the
      physical device ppp1 if some other ppp device was brought
      up earlier...), which makes it easy to manage pap/chap
      files -- name/password pairs are associated with the
      logical ppp device name so that they can be managed
      together.
    REMIP=<remote ip address, normally unspecified>
    MTU=
    MRU=
    DISCONNECTTIMEOUT=<number of seconds, default currently 5>
      (time to wait before re-establishing the connection after
      a successfully-connected session terminates before attempting
      to establish a new connection.)
    RETRYTIMEOUT=<number of seconds, default currently 60>
      (time to wait before re-attempting to establish a connection
      after a previous attempt fails.)
    RETRYCONNECT=yes|no (defaults to yes)
      If this is yes, then we will re-run pppd if it exits with a
      "connect script failed" status.  Otherwise, only one attempt
      is made to bring up the connection.  Note that some connect
      scripts (for example, wvdial) might do their own retries (such
      as BUSY or NO DIALTONE conditions).
    MAXFAIL=<number>
      If this is set, this will cause ppp-watch to exit after
      the specified number of attempts.
    DEMAND=yes|no
      Switches on demand-dialing mode using pppd‘s "demand" option.
    IDLETIMEOUT=600
      The amount of time the link needs to be inactive before pppd will
      bring it down automatically.
    BOOTTIMEOUT=30
      The amount of time to wait at boot before giving up on the
      connection.

IPPP-specific items (ISDN)
    PROVIDER=<ProviderName>
         USER=<Login>
    PASSWORD=<Password>
         ENCAP=[syncppp|]
    DIALMODE=[manual|auto]
    SECURE=off|on
         MSN=<>
         PHONE_IN=<Callback.Number>
                 AREACODE=<>
         REGIONCODE=<>
         PHONE_OUT=<PhoneNumber>
    BUNDLING=off|on
    HUPTIMEOUT=<number>
    DNS1=<PrimaryDNS>
    DNS2=<SecondaryDNS>
    DOMAIN=""
    LAYER=[HDLC|]
    CALLBACK=off|on
    CHARGEHUP=<number>
    CHARGEINT=<number>
    CBHUP=<number>
    CBDELAY=<number>
    DIALMAX=<number>
    AUTH=[+pap] [-chap]
    IHUP=<>
    DELDEFAULTROUTE=[enabled|disabled]
    CBCP=off|on
    VJ=off|on
    VJCCOMP=off|on
    AC=off|on
    PC=off|on
    BSDCOMP=off|on
    CCP=off|on
    SLAVE_DEVICE=ippp[0-9]

ippp0 items being deprecated:
    BOOT=[on|off] will be converted to ONBOOT=[yes|no] by netconf
    LOCAL_IP=     will be converted to IPADDR by netconf
    REMOTE_IP=    will be converted to GATEWAY by netconf

Wireless-specific items:
    See iwconfig(8) for additional information.
    MODE=[Ad-Hoc|Managed|Master|Repeater|Secondary|Monitor|Auto]
    ESSID=
      Defaults to "any".
    NWID=
    FREQ=
      Ignored if MODE=Managed.
    CHANNEL=
      Ignored if MODE=Managed.
    SENS=<sensitivity threshold>
    RATE=
    KEY{1,2,3,4}=<WEP key with the given index>
    DEFAULTKEY=<default key index>
    KEY=<default WEP key>
    SECURITYMODE=[on|off|open|restricted]
    RTS=[auto|fixed|off|<rts threshold>]
    FRAG=[off|<fragmentation threshold>]
    IWCONFIG=<other iwconfig(8) options>
    SPYIPS=<list of IP addresses to monitor for link quality>
    IWPRIV=<iwpriv(8) commands>

Bonding-specific items

SLAVE=yes
      Specifies device as a slave
    MASTER=bondXX
      Specifies master device to bind to
    BONDING_OPTS=
      A space-separated list of options to the bonding driver for this
      interface, such as:

"mode=active-backup arp_interval=60 arp_ip_target=192.168.1.1,192.168.1.2"

Tunnel-specific items:
    TYPE=GRE|IPIP
    MY_INNER_IPADDR=local IP address of the tunnel interface
    PEER_OUTER_IPADDR=IP address of the remote tunnel endpoint
    MY_OUTER_IPADDR=IP address of the local tunnel endpoint
      If unspecified, an IP address is selected automatically for outgoing
      tunnel packets, and incoming tunnel packets are accepted on all local
      IP addresses.
    PEER_INNER_IPADDR=IP address of the remote end of the tunnel interface
      If this is specified, a route to PEER_INNER_IPADDR through the tunnel
      is added automatically.
    TTL=TTL value for tunnel packets
      Default is to use the TTL of the packet transported through the tunnel

Bridge-specific items:
    TYPE=Bridge
    STP=off|on (see ‘brctl stp‘)
    DELAY=forward delay time in seconds (see ‘brctl setfd‘)
    BRIDGING_OPTS=
      A space-separated list of bridging options for either the bridge
      device, or the port device, such as:

BRIDGING_OPTS="hello_time=200 priority=65535"
        for bridge devices, or
      BRIDGING_OPTS="hairpin_mode=1"
        for port devices.

TUN/TAP-specific items:
    OWNER=<owner of the device>

时间: 2024-11-17 06:51:17

linux网络配置-参考文档的相关文章

Linux网络配置及SSH和Shell基础

Linux网络配置及SSH和Shell基础 一.Linux网络配置     ifconfig命令被用于配置和显示Linux内核中网络接口的网络参数.用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在.要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了. 二.hosts文件的作用及修改主机名      Hosts : The static table lookup for host name(主机名查询静态表)       Linux 的/etc/hosts是

微信小程序 不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html

微信小程序  不在以下合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html 友情提示: 大家在开发的时候,可以使用我的网站地址进行测试 配置 request 合法域名  https://liaolongjun.duapp.com request 可以拷贝下面的,不用做任何修改 wx.request({    url: 'https://liaolongjun.duapp.com/ace/h

Linux网络管理——linux网络配置

2. linux网络配置 .note-content {font-family: "Helvetica Neue",Arial,"Hiragino Sans GB","STHeiti","Microsoft YaHei","WenQuanYi Micro Hei",SimSun,Song,sans-serif;} .note-content h2 {line-height: 1.6; color: #0AA

linux网络配置及排错的一般流程

linux网络配置及排错的一般流程 发表于2017年3月10日 首先# ping www.baidu.com发现报错未知此域名 # ping www.baidu.comping: unknown host www.baidu.com 之后# ping 8.8.8.8 -c 3 如果不通,则  查看域名服务器cat /etc/resolv.conf发现里面设置了谷歌的公共DNS服务(如果没有则需设置) #cat /etc/resolv.conf# Generated by NetworkManag

linux 网络配置

(来自互联网,非原创,方便查找) 一.linux网络配置经常使用的命令 1)#ifconfig    //查看配置的网卡 /sbin/ifconfig2) # vi /etc/resolv.conf  //修改DNS  resolv.conf的关键字主要有四个,分别是:  nameserver #定义DNS服务器的IP地址   domain #定义本地域名  search #定义域名的搜索列表  sortlist #对返回的域名进行排序  最主要是nameserver关键字,如果没指定names

Linux网络配置之二ip、ss、网络相关配置文件

本文续网络基础与Linux网络配置之一 ifconfig.route.netstat命令详解 ip命令 作用ip是iproute2软件包里面的一个强大的网络配置工具,它能够替代一些传统的网络管理工具,例如ifconfig.route等,使用权限为超级用户.几乎所有的Linux发行版本都支持该命令. 格式ip [ OPTIONS ] OBJECT { COMMAND | help }   OBJECT := { link | addr | route | netns  } 注:OBJECT可简写,

教您怎么从spring 官网下载参考文档

假如您使用spring,那么本经验可能帮助到您. 假如您使用spring的过程中,需要查询一些文档,那么本经验可能帮助到您. 假如您对下载spring的文档有疑惑,那么本经验可能帮助到您. 教您怎么从spring 官网下载参考文档,首先需要明确您是需要什么文档. 方法/步骤1 首先,在百度搜索spring关键词,选择的是第一个网站. 打开spring页面,是很清爽干净的页面.点击右上角的docs菜单. 打开docs页面,会显示documents,可以看到各种各样的文档规整. 比如您要查找:Spr

linux网络配置命令(一)——ifconfig

linux网络配置命令(一)--ifconfig ifconfig 查看.配置网卡信息.已过时,推荐使用ip命令 格式:  ifconfig [interface]                                                         查看指定网卡信息,可不指定 ifconfig interface [aftype] options | address ...   设置指定网卡信息 选项 interface        网卡名 up          

Linux网络配置基础篇

Linux网络配置基础篇 一.如何实现linux网络通信? 1)指定IP/NETMASK可实现本地通信: 2)指定路由(网关)可实现跨网络通信: 3)指定DNS服务器地址可实现基于主机名的通信, 主DNS服务器地址(当前服务器不在线时,启用备用DNS服务器地址) 备用DNS服务器地址 第三备份DNS服务器地址 二.配置网络方式及网络接口命名 linux 网络属于内核的功能, 配置方式: 静态指定:使用命令直接指定或修改配置文件 动态分配:依赖于本地网络中有DHCP服务 网络接口命名方式: 传统命