|
我装了LINUX 8.0 在TEXT 模式下想做代理服务器上网。
双网卡。
我的ADSL MODEM 的地址为192.168.1.1
我的局域网是从172.16.22.1到172.16.22.xx.网关为172.16.22.254
我的eth0地址为192.168.1.2 接ADSL
eth1 地址为172.16.22.4网关为172.16.22.254
如下:
[root@test /]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:09:6B:1C:99:74
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:33 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3653 (3.5 Kb) TX bytes:502 (502.0 b)
Interrupt:11 Base address:0x7000
eth1 Link encap:Ethernet HWaddr 00:05:5D:6A:13:AD
inet addr:172.16.22.4 Bcast:172.16.22.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:224 errors:0 dropped:0 overruns:0 frame:0
TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:14706 (14.3 Kb) TX bytes:6185 (6.0 Kb)
Interrupt:9 Base address:0x7800
ppp0 Link encapoint-to-Point Protocol
inet addr:218.13.81.173 P-t-P:61.145.65.238 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1518 (1.4 Kb) TX bytes:30 (30.0 b)
[root@test etc]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
61.145.65.238 * 255.255.255.255 UH 0 0 0 ppp0
172.16.22.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default * 0.0.0.0 U 0 0 0 ppp0
default 172.16.22.254 0.0.0.0 UG 0 0 0 eth1
如过不加 route add –net defaul ppp0 就PING 不通外网。
我想通过这台机子代理windows机上网。
加入以下脚本:
rc.walll
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F INPUT
iptables -F FORWARD
iptables -F POSTROUTING -t nat
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -A FORWARD -s 172.16.22.4 -j ACCEPT
iptables -A OUTPUT -j ACCEPT
iptables -A FORWARD -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
#add the route to "172.16.0.0" and "172.18.0.0"
route add -net 172.16.0.0 netmask 255.255.0.0 gw 172.16.22.254
iptables -A INPUT -p icmp -j ACCEPT
如过运行上面的脚本就不能从其他机telnet 到这台机。也实现不了代理。请大家指教。那里的错误。
如果rc.wall 设置对了在windows浏览器-属性-局域网-直接写代理服务器172.16.22.4就可以上网了吗。还是要如何设置?
还有我的路由对不对。怎么设置才好。
请大家帮帮忙。多谢了。。。。。 |
|