本文主要介绍了CentOS 7系统下的网卡配置和Ubuntu系统下的iptables防火墙配置。
**网卡 (CentOS 7):**
* 默认情况下,CentOS 7和Redhat7的有线网卡是不启用的。
* **查看网卡:** 使用 `ip addr` 命令。
* **开启网卡:** 使用 `ifup <网卡名>` 命令。
* **永久开启:** 编辑网卡配置文件 (`/etc/sysconfig/network-scripts/ifcfg-<网卡名>`),将 `ONBOOT=no` 改为 `ONBOOT=yes`。
**iptables (Ubuntu):**
* **安装:** 使用 `sudo apt update` 和 `sudo apt install iptables-persistent` 命令。
* **启用:** 使用 `sudo systemctl start iptables` 命令。
* **关闭:** 使用 `sudo systemctl stop iptables` 命令。
* **重启:** 使用 `sudo systemctl restart netfilter-persistent` 命令。
* **规则配置文件:** 位于 `/etc/iptables`。
* **加载规则:** 使用 `sudo iptables-restore < /etc/iptables/rules.v4` 命令。
* **验证:** 使用 `sudo iptables -t nat -L -n -v` 和 `sudo iptables -t nat -L OUTPUT -n -v` 命令查看规则。