linux下共享上网设置 shell script
来源:百度文库 编辑:神马文学网 时间:2024/04/30 10:58:25
linux下共享上网设置
erqie 发表于 2005-10-9 13:34:00
使用固定internt IP
#!/bin/sh
# define
# EXT: 外部
# INT: 内部
# 定义接口
# define interface
EXT_IF="eth1"
INT_IF="eth0"
EXT_IP="202.96.0.2"
# 定义 iptables 执行文件
# define iptables exec
IPTABLES="/usr/sbin/iptables"
# 清空所有规则
# flush all the rules in the filter and nat tables.
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# 删除所有链
# erase all chains that‘s not default in filter and nat table.
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
# 加载必要模块
# load modules
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state
/sbin/modprobe ip_conntrack_ftp
# 激活 ip 转发
# enable ip forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# nat 表
# nat table
$IPTABLES -t nat -A POSTROUTING -o $EXT_IF -j SNAT --to-source $EXT_IP
使用adsl拨号
#!/bin/sh
# define interface
EXT_IF="ppp0"
INT_IF="eth0"
# define iptables exec
IPTABLES="/usr/sbin/iptables"
# flush all the rules in the filter and nat tables.
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# erase all chains that‘s not default in filter and nat table.
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
# load modules
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state
/sbin/modprobe ip_conntrack_ftp
# enable ip forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# nat table
$IPTABLES -t nat -A POSTROUTING -o $EXT_IF -j MASQUERADE
erqie 发表于 2005-10-9 13:34:00
使用固定internt IP
#!/bin/sh
# define
# EXT: 外部
# INT: 内部
# 定义接口
# define interface
EXT_IF="eth1"
INT_IF="eth0"
EXT_IP="202.96.0.2"
# 定义 iptables 执行文件
# define iptables exec
IPTABLES="/usr/sbin/iptables"
# 清空所有规则
# flush all the rules in the filter and nat tables.
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# 删除所有链
# erase all chains that‘s not default in filter and nat table.
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
# 加载必要模块
# load modules
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state
/sbin/modprobe ip_conntrack_ftp
# 激活 ip 转发
# enable ip forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# nat 表
# nat table
$IPTABLES -t nat -A POSTROUTING -o $EXT_IF -j SNAT --to-source $EXT_IP
使用adsl拨号
#!/bin/sh
# define interface
EXT_IF="ppp0"
INT_IF="eth0"
# define iptables exec
IPTABLES="/usr/sbin/iptables"
# flush all the rules in the filter and nat tables.
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
# erase all chains that‘s not default in filter and nat table.
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
# load modules
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_limit
/sbin/modprobe ipt_state
/sbin/modprobe ip_conntrack_ftp
# enable ip forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# nat table
$IPTABLES -t nat -A POSTROUTING -o $EXT_IF -j MASQUERADE
linux下共享上网设置 shell script
Shell Script
团结-协作-共享-开源--Linux Shell
双网卡共享上网详细设置图解教程(下)
双网卡共享上网详细设置图解教程(下)
虚拟机共享上网设置!
Shell Script初體驗
Linux局域网共享宽带上网
Linux系统下Shell命令行快捷键实用技巧
linux下路由设置
Linux Shell
如何设置路由器上网 路由器共享上网教程 设置路由器
图解宽带路由器共享上网设置过程
图解宽带路由器共享上网设置
图解宽带路由器共享上网设置过程
图解宽带路由器共享上网设置过程
图解宽带路由器共享上网设置过程
路由器多机共享上网设置图解
图解宽带路由器共享上网设置过程
用路由器共享上网的设置方法
图解宽带路由器共享上网设置过程
多台电脑共享上网设置方法
Linux Shell常用shell命令
使用 shell script 來執行批次指令