LinuxSir.cn,穿越时空的Linuxsir!

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

|fedora c3 - win98se| 用交叉线把2块网卡连接到一起后, 无法 Ping

[复制链接]
发表于 2004-12-13 11:09:19 | 显示全部楼层 |阅读模式
大家好!!!

我现在遇到一个问题, 麻烦大家帮忙诊断一下:

=========================================================

我有2台电脑

第一台(1号机): fc3
------------------------------------
eth0: 通过adsl拨号上网, 动态ip,
eth1: 给定了192.168.0.1, 掩码 255.255.255.0, 网关设置为空

默认防火墙打开, 但把 eth1 作为"信任" 的设备


这是ifconfig:
------------------

eth1   Link encap:Ethernet  HWaddr 00:05:5D:67:E3:32
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::205:5dff:fe67:e332/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:692 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:31676 (30.9 KiB)
          Interrupt:11 Base address:0x4e00


这是 route -n
------------------

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.xxx.xxx.xxx     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         xxx.xxx.xxx.xxx     0.0.0.0         UG    0      0        0 ppp0


第二台(1号机):  win98se;
------------------------------------

pc card 网卡: 给定了192.168.0.2, 掩码 255.255.255.0, 网关 192.168.0.1

没有防火墙

ipconfig 的输出:
------------------

Windows 98 IP Configuration



0 Ethernet adapter :



        IP Address. . . . . . . . . : 0.0.0.0

        Subnet Mask . . . . . . . . : 0.0.0.0

        Default Gateway . . . . . . :



1 Ethernet adapter :



        IP Address. . . . . . . . . : 0.0.0.0

        Subnet Mask . . . . . . . . : 0.0.0.0

        Default Gateway . . . . . . :



2 Ethernet adapter :



        IP Address. . . . . . . . . : 192.168.0.2

        Subnet Mask . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . : 192.168.0.1





route print 的输出:
------------------

Active Routes:



  Network Address          Netmask  Gateway Address        Interface  Metric

          0.0.0.0          0.0.0.0      192.168.0.1      192.168.0.2       1

        127.0.0.0        255.0.0.0        127.0.0.1        127.0.0.1       1

      192.168.0.0    255.255.255.0      192.168.0.2      192.168.0.2       1

      192.168.0.2  255.255.255.255        127.0.0.1        127.0.0.1       1

    192.168.0.255  255.255.255.255      192.168.0.2      192.168.0.2       1

        224.0.0.0        224.0.0.0      192.168.0.2      192.168.0.2       1

  255.255.255.255  255.255.255.255      192.168.0.2          0.0.0.0       1


=========================================================

问题: 2 台机器之间 ping 不出任何结果...

fc3 ping win98se (192.168.0.2)

ping 的输出:

From 192.168.0.1 icmp_seq=0 Destination Host Unreachable
...

下面是在 ping 的时候用tcpdump -i eth1 得到的输出:

eth1: Promiscuous mode enabled.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes

11:19:17.827331 arp who-has 192.168.0.2 tell 192.168.0.1
...

1 packets captured
1 packets received by filter
0 packets dropped by kernel

Table: nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0           

下面是在"系统配置"->"服务"里面看到的iptables规则:

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Table: filter
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpts:0:1023
DROP       udp  --  0.0.0.0/0            0.0.0.0/0           udp dpts:0:1023
DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp flags:0x16/0x02
DROP       icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 8

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (0 references)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255
ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

从win98se ping fc3

ping 的输出:

Request timed out
...

我对网络只有一些基本的概念, 昨天晚上和一个老外在freenode上聊的时候他告诉我说是iptables/firewall 中 icmp 的那几段拒绝了ping 的服务; 但我试过设置eth1 为信任的设备/关掉iptables, 似乎没有用

我现在没有什么头绪,, 希望大家给点建议, 谢谢




ps:

网卡上的2个灯, 在eth1 上亮了1个, 而且从fc3 ping的时候会闪

在 eth0(adsl)上1亮1闪(有时)

pc card 上的灯2个, 全亮, 但不闪

那些都是什么意思呢???
 楼主| 发表于 2004-12-13 21:35:46 | 显示全部楼层
ding
发表于 2004-12-14 13:32:22 | 显示全部楼层
帮你顶一下
发表于 2004-12-14 15:02:56 | 显示全部楼层

回复: |fedora c3 - win98se| 用交叉线把2块网卡连接到一起后, 无法 Ping

最初由 thefinalxia 发表
大家好!!!

ipconfig 的输出:
------------------
Windows 98 IP Configuration

0 Ethernet adapter :

        IP Address. . . . . . . . . : 0.0.0.0

        Subnet Mask . . . . . . . . : 0.0.0.0

        Default Gateway . . . . . . :
1 Ethernet adapter :
        IP Address. . . . . . . . . : 0.0.0.0

        Subnet Mask . . . . . . . . : 0.0.0.0

        Default Gateway . . . . . . :
2 Ethernet adapter :
        IP Address. . . . . . . . . : 192.168.0.2

        Subnet Mask . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . : 192.168.0.1

route print 的输出:


先把FC3上的防火墙关掉,再对ping试一下.能不能ping得通.说不定你的直联双绞线本身就有问题的呢?物理连接上通了,再去看是否是协议,防火墙之类有问题.你的直联线怎么做的,测试过的嘛?
还有一个疑点就是你说你的win98,键入ipconfig.怎么会有两个"Ethernet adapter"信息呢.是不是你原来的win98上有过两块网卡,或是换过网卡,但你没有删除原来的信息.把win98里面的网卡全部删除,重新安装然后再不要打开防火墙,设定ip,ping通不能.
 楼主| 发表于 2004-12-14 18:01:51 | 显示全部楼层
谢谢, 我只有到周末才有时间检查了. 到时候再把结果贴上来吧.
发表于 2004-12-14 19:51:40 | 显示全部楼层
你最好还是把交叉线先查一下吧
有测线仪是最好的了    有遇到过几次   兄弟们都是把线搞的不对啊
一般都是因为没有压到位造成的
 楼主| 发表于 2005-1-26 13:51:27 | 显示全部楼层
再次麻烦大家:

在换了一根线后两台机器之间用PING都有回应了.

然后我在关闭firewall的前提, 按照Linuxforums的介绍(www.linuxforum.com/linux_tutorials/5/1.php)建立了下面的脚本放在/etc/rc.local中运行:

#!/bin/sh

IPTABLES=/sbin/iptables

#All The lines below are NAT routing

# flush any old rules
$IPTABLES -F -t nat

# turn on NAT (IP masquerading for outgoing packets)
$IPTABLES -A POSTROUTING -t nat -o ppp0 -j MASQUERADE

# enable IP forwarding (of incoming packets)
echo 1 > /proc/sys/net/ipv4/ip_forward

但Win98机器还是无法ping (域名或者IP) 到除了198.162.0.1以外的任何地址 (Unkown host  或者 REQUEST TIMEOUT); 使用IE也会报告DNS错误;

---

iptables -t nat -n -L  的输出如下:

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  192.168.0.3          0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

---

还有一个问题就是:  windows 98 下, 配置网络属性时, DNS一栏中的"主机" 名称该填什么呢? 我只有DNS的IP呀?

谢谢!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-1-26 19:16:50 | 显示全部楼层
刚才看了一下精华区。结果是我做了伪装后没有做转发。所以DUMP出来的数据只看到quest send但没有repley。

剩下的问题就是把masq和firewall配置出来了。我会继续报告的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-1-26 20:33:10 | 显示全部楼层
嗯, 现在似乎搞定了...
iptables -L 的输出是这样的:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       tcp  --  anywhere             anywhere            tcp dpts:0:1023
DROP       udp  --  anywhere             anywhere            udp dpts:0:1023
DROP       tcp  --  anywhere             anywhere            tcp flags:SYN,RST,ACK/SYN
DROP       icmp --  anywhere             anywhere            icmp echo-request

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  192.168.0.3          anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (0 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     ipv6-crypt--  anywhere             anywhere
ACCEPT     ipv6-auth--  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:5353
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

然后用照精华区的说法用nmap看了看:

nmap x.x.x.x

(The 1659 ports scanned but not shown below are in state: closed)
PORT    STATE SERVICE
113/tcp open  auth

---

似乎没有太大问题吧?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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