在LINUX下怎样代理上

来源:百度知道 编辑:UC知道 时间:2024/06/30 08:19:57
我想在下通过两块网卡代理上网
一块网卡接外网一块接内网请问要怎么设制呢

你是说把自己设置为代理服务器?
先设置好你内外二块网卡
然后
$echo 1 > /proc/sys/net/ipv4/ip_forward
我记得是如此的,把信息包转发打开形成一个最简单的路由
然后让其他内网的机器把gateway指向你机器的内网ip就可以了。
缺点是每次你重启计算机都要敲上面那行命令,$不用敲,只是说得用root来作。

或者你就得配置动态路由了,那个比较麻烦也需要安装相应的软件
再或者使用代理服务器软件好像叫什么squid记不清了

你说的是设置双网卡代理服务吧
#! /bin/sh

IPTABLES=/usr/sbin/iptables
EXTERNAL="eth1" ---> 外网的接口
INTERNAL="eth0" ---> 内网的接口
IP=192.168.0.0/24 ---> 内网地址

kver=`uname -r | cut -c 1-3`
if [ "$kver" != "2.4" ] && [ "$kver" != "2.5" ]; then
echo "Your Linux Kernel Version may not be suported by this script!"
echo "This scripts will not be runing"
exit
fi
ipchains=`lsmod | grep ipchains`
if [ "$ipchains" != "" ]; then
echo "unload ipchains in your system"
rmmod ipchains 2> /dev/null
fi

$IPTABLES