Mozer--沙落满地
mozer
全部博文(297)
Vmware(1)
ORACLE(1)
C++(1)
Python(7)
TCL(5)
Perl socket(1)
Perl(1)
securty(1)
HardDisk(0)
Audio(0)
VGA(1)
CPU(1)
JBoss(1)
LDAP(0)
SVN(1)
FTP(2)
bind(1)
Linux-HA(7)
yum(2)
CVS(5)
LVS(6)
Server(0)
Snort(1)
SecurityTools(0)
nmap(1)
awk(0)
文本处理(1)
xml(1)
经验总结(1)
protection(1)
pretend(3)
Attack(5)
Iptables(36)
SElinux(2)
OpenVPN(0)
Sercurity(0)
Mysql(0)
Apache(1)
php+mysql(5)
Unite-Study(0)
SSH(3)
Optimization(1)
sed(0)
vim(1)
FS(0)
File SYStem(0)
individuation(2)
RPMs(2)
小技巧(3)
ftp(2)
例子(5)
linux 审计(3)
合格Linux 管理员(10)
Shell 实战(0)
Expect(3)
study note(3)
experience(1)
tools(8)
example(1)
基本概念(8)
shell编程(18)
命令详解(37)
Tools(3)
skill(3)
System Integrati(6)
LDAP应用及实例(1)
EthNet App(0)
SecurExam(1)
Study Home(8)
kernel(2)
RAID(1)
Shell 片段(4)
Job(2)
Regular Exdivssi(5)
Operations(3)
Basic(0)
Skill(26)
LVM(2)
Squid(4)
Mail(1)
2011年(1)
2009年(45)
2008年(67)
2007年(184)
wb123456
taobao92
cynthia
zlq14400
chengxuy
ymwm2018
ganlin12
wsshoppi
damejane
分类: LINUX
2007-09-11 13:55:58
支持直接接入方式和PPPOE拨号方式,前部分有配置和注解,应该不难看懂
#! /bin/bash# Project by Platinum, 2005-05-12# Debug on 2005-05-20
# Set default gateway (如果MODE==ADSL,此项可以忽略)GATEWAY="外网网关"
# Set Interface WAN (如果MODE==ADSL,此项可以忽略)WAN_IP="外网IP地址"WAN_ETH="外网网卡"WAN_MASK="外网掩码"
# Set Interface LANLAN_IP="内网IP地址"LAN_NET="内网网络地址"LAN_ETH="内网网卡"LAN_MASK="内网掩码"
# Set managerMANAGER_IP="内网管理员IP"MANAGER_MAC="内网管理员MAC"
# Initialize modulesmodprobe ip_nat_ftpmodprobe ip_conntrack_ftpecho 1 > /proc/sys/net/ipv4/ip_forward
# Initialize Interface LANifconfig $LAN_ETH $LAN_IP netmask $LAN_MASK
# Initialize policyiptables -P INPUT DROPiptables -P FORWARD ACCEPTiptables -Fiptables -t nat -F
# Deny ACK attackiptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROPiptables -A FORWARD -p tcp ! --syn -m state --state NEW -j DROP
# Initialize Rulesiptables -A INPUT -i lo -j ACCEPTiptables -A INPUT -i $LAN_ETH -s $MANAGER_IP -m mac --mac-source $MANAGER_MAC -m state --state NEW,RELATED,ESTABLISHED -j ACCEPTiptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
case "$MODE" in LAN) # Initialize Interface WAN ifconfig $WAN_ETH $WAN_IP netmask $WAN_MASK iptables -t nat -A POSTROUTING -s $LAN_NET -o $WAN_ETH -j SNAT --to $WAN_IP ;; ADSL) iptables -t nat -A POSTROUTING -s $LAN_NET -o ppp0 -j MASQUERADE GATEWAY=`ifconfig ppp0|grep inet|awk '{print $3}'|awk -F: '{print $2}'` ;;esac
ip route replace default via $GATEWAY
上一篇:nc使用技巧
下一篇:Nessus安装指南
登录 注册