Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

第 13 章 Networking 網絡管理

目錄

13.1. hosts
13.1.1. /etc/hostname
13.1.2. hostnamectl - Control the system hostname
13.1.3. /etc/host.conf
13.1.4. /etc/hosts
13.1.5. hosts.allow / hosts.deny
13.1.6. /etc/resolv.conf
13.2. Network adapter 網絡適配器
13.2.1. 介面名稱
13.3. Ethernet Interfaces 乙太網介面
13.3.1. ifquery
13.3.2. DHCP
13.3.3. CentOS
13.3.4. Ubuntu
13.4. Gateway 設置預設網關
13.4.1. CentOS
13.5. 配置 DNS
13.5.1. 常規 DNS 配置 /etc/resolv.conf
13.5.2. 安全 DNS 配置
13.5.2.1. 啟用 DNS over TLS
13.5.2.2. 啟用 DNSSEC
13.5.2.3. 同時啟用 DNS over TLS 和 DNSSEC
13.5.2.4. 配置 NetworkManager
13.6. IP forwarding(IP轉發)
13.7. bonding
13.7.1. bonding
13.7.2. Ubuntu
13.8. brctl
13.9. Wireless - WiFi 配置
13.9.1. rfkill - tool for enabling and disabling wireless devices
13.9.2. iwlist - Get more detailed wireless information from a wireless interface
13.9.3. iwconfig - configure a wireless network interface
13.9.4. /proc/net/wireless
13.10. CentOS 8
13.10.1. nmtui - Text User Interface for controlling NetworkManager
13.10.2. nmcli - command-line tool for controlling NetworkManager
13.10.2.1. 查看連接狀態
13.10.2.2. 查看介面狀態
13.10.2.3. 添加介面
13.10.2.4.
13.10.2.5. 停止介面
13.10.2.6.
13.10.2.7. 顯示設備信息
13.11. 網絡檢查命令
13.11.1. ping
13.11.2. Finding optimal MTU
13.11.3. ss - another utility to investigate sockets
13.12. Ubuntu netplan (Ubuntu 18.04 之後才用 netplan 管理網絡)
13.13. Linux IP And Router
13.13.1. netmask
13.13.1.1. iptab
13.13.1.2. netmask - a netmask generation and conversion program
13.13.2. arp - manipulate the system ARP cache
13.13.2.1. display hosts
13.13.2.2. delete a specified entry
13.13.2.3. /proc/net/arp
13.13.2.4. /etc/ethers
13.13.3. iproute2
13.13.3.1.
13.13.3.2. 添加路由
13.13.3.3. 刪除路由
13.13.3.4. 變更路由
13.13.3.5. 替換已有的路由
13.13.3.6. 增加預設路由
13.13.3.7. cache
13.13.4. 策略路由
13.13.5. 負載均衡
13.13.6. MASQUERADE
13.13.7. ip tunnel
13.13.8. VLAN
13.13.9. Zebra

13.1. hosts

		
# 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 netkiller.localdomain netkiller
     4  ::1             localhost6.localdomain6 localhost6

		
		

13.1.1. /etc/hostname

# cat /etc/hostname
web1.example.com
			

查看IP地址

			
[root@localhost ~]# hostname --ip-address
::1 127.0.0.1			
			
			

13.1.2. hostnamectl - Control the system hostname

[root@netkiller ~]# hostnamectl
   Static hostname: netkiller.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
			

設置 hostname

			
[root@netkiller ~]# hostnamectl set-hostname master
			
			

13.1.3. /etc/host.conf

解析順序配置檔案

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

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

13.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
			

13.1.5. hosts.allow / hosts.deny

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

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

13.1.6. /etc/resolv.conf

			
search example.com
nameserver 208.67.222.222
nameserver 208.67.220.220