|
发表于 2005-11-29 03:32:54
|
显示全部楼层
启动进程管理
slackware是使用4.4BSD-list风格的Linux发行版,因此启动进程管理与其它发行版不同。
通过slackware内核将许多可用的设备支持作为模块编入(是为了提供更大的方便,为在你增加其它设备及服务时,不需要去重新编译内核,以保证系统安全性或为降低因人为错误导致系统崩溃的可能性)。哪内核是否会因此而感到臃肿!答案是不会,因为虽然以将多数不存在的设备编入内核模块,但决定真正启动的内核模块进程在/etc/rc.d目录下面,其中有一个非常重要的配置文件将决定你的系统加载什么样的设置及服务,即是/etc/rc.d/rc.modules文件。不知是否注意到,有很多Fans在安装和设置好系统后,去自己下载如ATI的显卡并重新去编译内核,希望实现3D加速或认为没有显示驱动导致屏幕很闪,或自己去写一个iptables防火墙脚本,其实不需要这么做。iptables在rc.modules文件中已有一个非常不错的范本,你只需做一个简单的改进即可使用。
# As a quick example (for a much more extensive treatment, see the IP-Masquerade
# mini-HOWTO) to allow Internet access to a local network 192.168.11.0 with a
# netmask of 255.255.255.0, you'd use these commands in /etc/rc.d/rc.local:
#
# # EXTERNAL -> external network interface
# # INTERNAL -> internal network interface
# EXTERNAL=eth0
# INTERNAL=eth1
# echo 1 > /proc/sys/net/ipv4/ip_forward
# echo "Setting up NAT (Network Address Translation)..."
# # by default, nothing is forwarded.
# iptables -P FORWARD DROP
# # Allow all connections OUT and only related ones IN
# iptables -A FORWARD -i $EXTERNAL -o $INTERNAL -m state --state ESTABLISHED,RE
LATED -j ACCEPT
# iptables -A FORWARD -i $INTERNAL -o $EXTERNAL -j ACCEPT
# # enable MASQUERADING
# iptables -t nat -A POSTROUTING -o $EXTERNAL -j MASQUERADE
如果还需要一个更加强大的防火墙脚本,可以把以下部分加入到上面的内容中,并把上面的部分删除。
#Our complete stateful firewall script. This firewall can be customized for
#a laptop, workstation, router or even a server.
#这是一个完美的防火墙脚本,它不是一个基于用户顶端的工作组、路由或相等的防火墙
#change this to the name of the interface that provides your "uplink"
#(connection to the Internet)指定网络端口(即是你的设备的位置)
UPLINK="eth1"
#if you're a router (and thus should forward IP packets between interfaces), 如果你有一个静态的路由或IP地址,你需在下面的ROUTER选项使用yse,否则如使DHCP动态分码则用No这一值。
#you want ROUTER="yes"; otherwise, ROUTER="no"
ROUTER="yes"
#change this next line to the static IP of your uplink interface for static SNAT, or
#"dynamic" if you have a dynamic IP. If you don't need any NAT, set NAT to "" to
#disable it.
#以上改变将会在下一次与IP所关联,但必需是一个不受冲突的地址、路由,如果你不确定>将会使用动态分址,如果你不知道那NAT最好将NAT字义为“dynamic”。
NAT="192.168.1.1"
#change this next line so it lists all your network interfaces, including lo在下一次上线时它将监听你所有的静态网络,包括lo中断。
INTERFACES="all"
#change this line so that it lists the assigned numbers or symbolic names (from
#/etc/services) of all the services that you'd like to provide to the general
#public. If you don't want any services enabled, set it to ""
#同时在下一次上线时则监听包括动态的/etc/services下的所有服务,如果你不想将所有服务启动于防火墙下,以下选项即给出一个空值"".
SERVICES="http ftp smtp ssh rsync"
if [ "$1" = "start" ] #如果变量值为1,那将启动它。
then
echo "Starting firewall..." #显示一个有效状态
iptables -P INPUT DROP
iptables -A INPUT -i ! ${UPLINK} -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#enable public access to certain services 允许公众账户激活服务
for x in ${SERVICES}
do
iptables -A INPUT -p tcp --dport ${x} -m state --state NEW -j ACCEPT
done
iptables -A INPUT -p tcp -i ${UPLINK} -j REJECT --reject-with tcp-reset
iptables -A INPUT -p udp -i ${UPLINK} -j REJECT --reject-with icmp-port-unreachable
#explicitly disable ECN 中断ECN
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
then
echo 0 > /proc/sys/net/ipv4/tcp_ecn
fi
#disable spoofing on all interfaces 欺骗全部静态
for x in ${INTERFACES}
do
echo 1 > /proc/sys/net/ipv4/conf/${x}/rp_filter
done
if [ "$ROUTER" = "yes" ]
then
#we're a router of some kind, enable IP forwarding 参照主路由相关类型,实现IP传输
echo 1 > /proc/sys/net/ipv4/ip_forward
if [ "$NAT" = "dynamic" ]
then
#dynamic IP address, use masquerading
echo "Enabling masquerading (dynamic ip)..."
iptables -t nat -A POSTROUTING -o ${UPLINK} -j MASQUERADE
elif [ "$NAT" != "" ]
then
#static IP, use SNAT
echo "Enabling SNAT (static ip)..."
iptables -t nat -A POSTROUTING -o ${UPLINK} -j SNAT --to ${UPIP}192.168.1.100
fi
fi
elif [ "$1" = "stop" ]
then
echo "Stopping firewall..."
iptables -F INPUT
iptables -P INPUT ACCEPT
#turn off NAT/masquerading, if any
iptables -t nat -F POSTROUTING
fi
APM电源管理:(默认情况下,slackware不会自动关闭电源的解决办法)
依然在rc.modules文件中设置,如下:
#### APM support ###
# APM is a BIOS specification for saving power using several different
# techniques. This is mostly useful for battery powered laptops.
/sbin/modprobe apm将#号去除。 |
|