/etc/conf.d/net DHCP 动态获取
config_eth0=( "dhcp" )
固定IP
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
或者
config_eth0=( "192.168.0.2/24 brd 192.168.0.255" )
routes_eth0=( "default via 192.168.0.1" )
/etc/resolv.conf
nameserver 202.96.209.5 202.96.209.133
/etc/init.d/net.eth0 start | stop | restart
/etc/init.d/iptables stop
iptables -F iptables -t nat -F iptables -t mangle -F
iptables -A INPUT -i eth0 -p tcp –dport 22 -j ACCEPT iptables -A INPUT -i eth0 -p tcp –dport 80 -j ACCEPT
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -i eth0 -m state –state NEW,INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -P FORWARD DROP iptables -P INPUT DROP iptables -P OUTPUT ACCEPT
/etc/init.d/iptables save /etc/init.d/iptables restart
#加入自动启动任务,使iptables自动启动 rc-update add iptables default
如何删除一条规则?比如删除80端口,让外面无法访问。 iptables -D INPUT -i eth0 -p tcp –dport 80 -j ACCEPT
如何再添加? iptables -I INPUT -i eth0 -p tcp –dport 80 -j ACCEPT
最后别忘记用 /etc/init.d/iptables save /etc/init.d/iptables restart 这两个命令保存并重启