Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 14 章 Networking

目錄

14.1. hosts
14.1.1. hostnamectl - Control the system hostname
14.1.2. /etc/hostname
14.1.3. /etc/host.conf
14.1.4. /etc/hosts
14.1.5. hosts.allow / hosts.deny
14.1.6. /etc/resolv.conf
14.2. Hostname
14.3. Network adapter
14.3.1. 介面名稱
14.4. Ethernet Interfaces
14.4.1. ifquery
14.4.2. DHCP
14.4.3. Static IP
14.5. Mask
14.6. Gateway
14.7. Configuring Name Server Lookups
14.8. IP forwarding(IP轉發)
14.9. bonding
14.9.1. Ubuntu
14.10. Finding optimal MTU
14.11. wireless
14.11.1. rfkill - tool for enabling and disabling wireless devices
14.11.2. iwlist - Get more detailed wireless information from a wireless interface
14.11.3. iwconfig - configure a wireless network interface
14.11.4. /proc/net/wireless
14.12. Linux IP And Router
14.12.1. netmask
14.12.1.1. iptab
14.12.1.2. netmask - a netmask generation and conversion program
14.12.2. arp - manipulate the system ARP cache
14.12.2.1. display hosts
14.12.2.2. delete a specified entry
14.12.2.3. /proc/net/arp
14.12.2.4. /etc/ethers
14.12.3. iproute2
14.12.3.1. 添加路由
14.12.3.2. 刪除路由
14.12.3.3. 變更路由
14.12.3.4. 替換已有的路由
14.12.3.5. 增加預設路由
14.12.3.6. cache
14.12.4. 策略路由
14.12.5. 負載均衡
14.12.6. MASQUERADE
14.12.7. ip tunnel
14.12.8. VLAN
14.12.9. Zebra
14.13. CentOS 網絡配置
14.13.1. Gateway
14.13.2. bonding
14.13.3. brctl
14.13.4. nmtui

14.1. hosts

14.1.1. hostnamectl - Control the system hostname

[root@localhost ~]# hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 072e88a0fdd2447296554f3cd5129076
           Boot ID: a978056f50544355abd723b328a89b6f
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-229.el7.x86_64
      Architecture: x86_64
			

14.1.2. /etc/hostname

# cat /etc/hostname
web1.example.com
			
		
# cat -n /etc/hosts
     1  # Do not remove the following line, or various programs
     2  # that require network functionality will fail.
     3  127.0.0.1               development.domain.org development localhost.localdomain localhost
     4  ::1             localhost6.localdomain6 localhost6

		
		

14.1.3. /etc/host.conf

解析順序配置檔案

[root@development bin]# cat /etc/host.conf
order hosts,bind
			

首先在/etc/hosts檔案中尋找,如果不存在,再去DNS伺服器中尋找

14.1.4. /etc/hosts

IP地址後面TAB符,然後寫主機地址

127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.1.10	development.example.com development
			

14.1.5. hosts.allow / hosts.deny

/etc/hosts.allow 和 /etc/hosts.deny

許可IP/禁止IP,相當於黑白名單

14.1.6. /etc/resolv.conf

			
search example.com
nameserver 208.67.222.222
nameserver 208.67.220.220