FC4下共享上网求助
寝室两台电脑,我的装 FC4,同学XPFC4是双网卡,一个(e t h 2)是自动获取,用的实达的认证,另一个(e t h 0)设置的是 ip地址:192.168.0.1 掩码:255.255.255.0 网关没有设置.
XP下的网卡设置为 ip地址:192.168.0.2 掩码:255.255.255.0 网关192.168.0.1 DNS服务器192.168.0.1
两台机器用联机线相连的.
我想能想XP下那样让同学的电脑通过我上网,但不知道怎么做?
我看到一个贴子里说
在/etc/rc.d/rc.local中加入如下:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
但是试了一下好像没效果,我也不懂这句话有什么用.请问还需什么设置呢? 引用的那个是ADSL的,可我的不是.该如何呢? 又翻到一本书上写的
************
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth2 -j SNAT --to (这里需要一个
外部接口的IP,但我每次都是动态获取的怎么办呢?用xxx.xxx.xxx.xxx吗?
************ --to 是什么? iptables -h里没有看到这个啊?
我看的书是RH9的 怎么没人帮帮俺呢:-(:-(
这次改成了
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth2 -j SNAT --to-source 211.71.206.132
并设置了一下防火墙,现在XP下能用QQ,但开不了网页.请问哪里错了?不懂啊
eth0 Link encap:EthernetHWaddr 00:E0:4C:55:83:A8
inet addr:192.168.0.1Bcast:192.168.0.255Mask:255.255.255.0
inet6 addr: fe80::2e0:4cff:fe55:83a8/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:465 errors:0 dropped:0 overruns:0 frame:0
TX packets:279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:48431 (47.2 KiB)TX bytes:33312 (32.5 KiB)
Interrupt:11 Base address:0xa000
eth2 Link encap:EthernetHWaddr 00:05:1C:15:98:B2
inet addr:211.71.206.132Bcast:211.71.207.255Mask:255.255.252.0
inet6 addr: fe80::205:1cff:fe15:98b2/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:16672 errors:0 dropped:0 overruns:0 frame:0
TX packets:3381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2442981 (2.3 MiB)TX bytes:469851 (458.8 KiB)
Interrupt:10 Base address:0xa800
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:16436Metric:1
RX packets:1351 errors:0 dropped:0 overruns:0 frame:0
TX packets:1351 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1439084 (1.3 MiB)TX bytes:1439084 (1.3 MiB)
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
211.71.204.0 * 255.255.252.0 U 0 0 0 eth2
169.254.0.0 * 255.255.0.0 U 0 0 0 eth2
default 211.71.207.2540.0.0.0 UG 0 0 0 eth2
# iptables -L
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all--192.168.0.0/24 anywhere
ACCEPT all--anywhere anywhere state RELATED,ESTABLISHED
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp--anywhere anywhere tcp dpt:http flags:SYN,RST,ACK/SYN
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
# iptables -t nat -L
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all--192.168.0.0/24 anywhere to:211.71.206.132
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
不会弄防火墙 :-(:-(:-( 不是不帮, 答案在精华区都有, 还有弄ip伪装不如用路由器上网来的快, 方便. :arrow:
页:
[1]