LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 846|回复: 3

有关于网吧局域网代理上网的问题!

[复制链接]
发表于 2003-10-27 23:42:03 | 显示全部楼层 |阅读模式
网吧主机采用红旗LINUX4。0,安装完成之后,8139(用于与内部网络联接)和530TX(用于光纤直接上网)的网卡全部都自动识别~。
此时,内部网卡IP为:192.168.0.1
外部网卡IP为:219.138.0.228
        掩码:255.255.255.240
        DNS为:202.103.0.117
        网关为:219.138.0.225

此时该如何设置共享上网?

我只需要详细步骤。。
不需要理论。。
因为时间不够~
发表于 2003-10-28 11:01:38 | 显示全部楼层
# 用于双网卡机器在 Linux kernel 2.4 下做iptables/NAT网关。
# 把下面的代码拷贝到 /etc/rc.d/rc.local 中即可,几乎不需要改动。
# 唯一可能需要改动的是外部网卡及内部网卡的设备名。
# 这里假设连接Internet的外部网卡是 eth0 ,
# 接intranet的内部网卡是 eth1 。
# 注:因为BBS发文每行长度限制,部分命令行末有\符号表示续行

# To use iptables-based NAT, we must enable IP forwarding for IPv4:
echo 1 > /proc/sys/net/ipv4/ip_forward
# Or modify /etc/sysctl.conf such that:
# net.ipv4.ip_forward = 1

# IPTABLES firewall
# extdev: the network device/interface for the external network
# intdev: the network device/interface for the internal network
extdev=eth0
intdev=eth1

# extip: the IP of the external network
# intranet: the network ID of the internal network
# Manually assign the value of extip or intranet:
#extip=20.30.40.50
#intranet=192.168.9.0/24
# Or extract the value from output of ifconfig:
extip=`/sbin/ifconfig $extdev | grep inet | cut -d : -f 2 | cut -d ' ' -f 1`
intranet=`/sbin/ifconfig $intdev | grep inet | cut -d : -f 2  | cut -d ' ' -f  1 | cut -d . -f 1-3`.0/24

/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -P INPUT    ACCEPT
/sbin/iptables -P OUTPUT   ACCEPT
/sbin/iptables -P FORWARD  DROP
/sbin/iptables -A INPUT   -s $intranet -i $extdev -j DROP
/sbin/iptables -A FORWARD -s $intranet -i ! $extdev -o $extdev -j ACCEPT
/sbin/iptables -A FORWARD -i $extdev -o ! $extdev -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -s $intranet -o $extdev -j SNAT --to-source $extip
 楼主| 发表于 2003-10-29 09:39:43 | 显示全部楼层
唉~~~~我完全看不明白。~~~
自由狼-台风 该用户已被删除
发表于 2003-10-29 16:39:25 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表