列表 4. 本地启动文件 /etc/rc.d/rc.local

此文件用于自动启动或设置各种不属于标准 Linux 发行版一部分的设置。 您可以在此处设置防火墙特定的设置,例如 IP 转发和防火墙规则。

#!/bin/sh
# /etc/rc.d/rc.local: Local system initialization
# script.
# Put any local setup commands in here:
# Turn on Kernel IP forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
# Set default policy forwarding packets to DENY
ipchains -P forward DENY
# Append a rule to forward our packets out of our
# local network, masquerading the IP addresses of
# our local LAN with the Internet IP address of the
# Firewall.
ipchains -A forward -j MASQ -s 192.168.0.0/24 -d 0.0.0.0/0
# start up Real Audio Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_raudio.o
# start up FTP Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_ftp.o
# start up IRC Pass thru
insmod /lib/modules/2.2.9/ipv4/ip_masq_irc.o
© . All rights reserved.