Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 11 章 Networking 网络管理

目录

11.1. hosts
11.1.1. /etc/hostname
11.1.2. /etc/host.conf
11.1.3. /etc/hosts
11.1.4. hosts.allow / hosts.deny
11.1.5. /etc/resolv.conf
11.2. Network adapter 网络适配器
11.2.1. 接口名称
11.3. CentOS 8 Stream
11.3.1. hostnamectl - Control the system hostname
11.3.2. nmtui - Text User Interface for controlling NetworkManager
11.3.3. nmcli - command-line tool for controlling NetworkManager
11.4. Ubuntu netplan (Ubuntu 18.04 之后才用 netplan 管理网络)
11.4.1. DHCP
11.4.2. 静态IP地址
11.5. Gateway 设置默认网关
11.6. 配置 DNS
11.6.1. 常规 DNS 配置 /etc/resolv.conf
11.6.2. 安全 DNS 配置
11.7. IP forwarding(IP转发)
11.8. bonding
11.8.1. bonding
11.8.2. Ubuntu
11.9. Wireless - WiFi 配置
11.9.1. rfkill - tool for enabling and disabling wireless devices
11.9.2. iwlist - Get more detailed wireless information from a wireless interface
11.9.3. iwconfig - configure a wireless network interface
11.9.4. /proc/net/wireless
11.10. Linux IP And Router
11.10.1. IP 地址类别
11.10.2. ping
11.10.3. Finding optimal MTU
11.10.4. ss - another utility to investigate sockets
11.10.5. netmask 子网掩码
11.10.6. arp - manipulate the system ARP cache
11.10.7. iproute2
11.10.8. VLAN
11.10.9. 网桥
11.10.10. Zebra
11.11. IPv6
11.11.1. 禁用 IPv6
11.12. 早期版本
11.12.1. 早期 Ubuntu
11.12.2. CentOS 6

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

		
		

11.1.1. /etc/hostname

# cat /etc/hostname
web1.example.com
			

查看IP地址

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

11.1.2. /etc/host.conf

解析顺序配置文件

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

首先在/etc/hosts文件中寻找,如果不存在,再去DNS服务器中寻找

11.1.3. /etc/hosts

IP地址后面TAB符,然后写主机地址

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

11.1.4. hosts.allow / hosts.deny

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

许可IP/禁止IP,相当于黑白名单

11.1.5. /etc/resolv.conf

			
search example.com
nameserver 208.67.222.222
nameserver 208.67.220.220