天天看點

由安裝兩塊網卡的linux系統中引起網絡不通想到的

由安裝兩塊網卡的linux系統中引起網絡不通想到的

我來到小王的機器前檢視了一下網絡配置。

[root@rhas root]# ifconfig -a

eth0      link encap:ethernet  hwaddr 00

由安裝兩塊網卡的linux系統中引起網絡不通想到的

0:b7:c6:8f:1d

          inet addr:172.31.0.200  bcast:172.31.0.255  mask:255.255.255.0

          up broadcast running multicast  mtu:1500  metric:1

          rx packets:16 errors:0 dropped:0 overruns:0 frame:0

          tx packets:5 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          rx bytes:1306 (1.2 kb)  tx bytes:210 (210.0 b)

          interrupt:10 base address:0xe800 memory:d9100000-d9100038

eth1      link encap:ethernet  hwaddr 00:01:03:40:a4:15

          inet addr:172.31.0.201  bcast:172.31.0.255  mask:255.255.255.0

          up broadcast multicast  mtu:1500  metric:1

          rx packets:0 errors:0 dropped:0 overruns:0 frame:0

          tx packets:32 errors:0 dropped:0 overruns:0 carrier:32

          rx bytes:0 (0.0 b)  tx bytes:1920 (1.8 kb)

          interrupt:11 base address:0xec00

lo        link encap:local loopback

          inet addr:127.0.0.1  mask:255.0.0.0

          up loopback running  mtu:16436  metric:1

          rx packets:1430 errors:0 dropped:0 overruns:0 frame:0

          tx packets:1430 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          rx bytes:143776 (140.4 kb)  tx bytes:143776 (140.4 kb)

[root@rhas root]# route -n

kernel ip routing table

destination     gateway         genmask         flags metric ref    use iface

172.31.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

127.0.0.0       0.0.0.0         255.0.0.0       u     0      0        0 lo

0.0.0.0          172.31.0.254    0.0.0.0         ug    0      0        0 eth1

到這一步我猜想網線可能沒有插到預設網關對應的網卡上即eth1(嗨!小王的機器被鑲在桌子裡不太好挪動。連他自己把網線插在那塊卡上都不知道了。)

接着我在一機子上ping 172.31.0.200和172.31.0.201,在小王的機器監聽

[root@rhas root]# tcpdump

tcpdump: listening on eth0

19:32:29.109283 172.31.0.101 >; 172.31.0.200: icmp: echo request (df)

19:32:30.109337 172.31.0.101 >; 172.31.0.200: icmp: echo request (df)

19:32:31.109418 172.31.0.101 >; 172.31.0.200: icmp: echo request (df)

19:32:42.670162 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:32:43.670218 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:32:44.670291 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

........................

19:32:56.671040 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:32:57.671064 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:32:58.671133 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:32:59.671187 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:33:00.671257 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:33:01.671349 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:33:02.671377 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

19:33:03.671441 172.31.0.101 >; 172.31.0.201: icmp: echo request (df)

36 packets received by filter

0 packets dropped by kernel

沒有回應,看一下firewall的設定。

[root@rhas3 123]# iptables -l -n

chain input (policy accept)

target     prot opt source               destination

chain forward (policy accept)

chain output (policy accept)

又不是防火牆的問題,想了一下,我越發肯定剛才的想法是正确的。

[root@rhas root]# cat /etc/modules.conf

alias eth0 e100

alias eth1 3c59x

alias sound-slot-0 via82cxxx_audio

post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -l >;/dev/null 2>;&1 || :

pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -s >;/dev/null 2>;&1 || :

alias usb-controller usb-uhci

[root@rhas root]#mii-tool

eth0: negotiated 100basetx-fd flow-control, link ok

eth1: no linkk

找到原因了,果然是插反了。既然不友善換端口最簡單的就把eth1即3com網卡宕調就ok了

當然也可以把兩塊網卡配置設定在不同的網段。

[root@rhas root]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

# 3com corporation|3c905c-tx/tx-m [tornado]

device=eth1

bootproto=static

broadcast=172.31.0.255

hwaddr=00:01:03:40:a4:15

ipaddr=172.31.0.201

netmask=255.255.255.0

network=172.31.0.0

onboot=no

type=ethernet~

~

"/etc/sysconfig/network-scripts/ifcfg-eth1" [已轉換] 10l, 207c                                                               9,1          全部

或者在啟動哦時根本不要加載3com網卡的驅動哦。

從啟動我們的網絡

[root@rhas root]# service network restart   

正在關閉接口 eth0:                                        [  确定  ]

關閉環回接口:                                             [  确定  ]

設定網絡參數:                                             [  确定  ]

彈出環回接口:                                             [  确定  ]

彈出界面 eth0:

                                                           [  确定  ]

[root@rhas root]#

[root@rhas root]# ifconfig

由安裝兩塊網卡的linux系統中引起網絡不通想到的

          rx packets:68 errors:0 dropped:0 overruns:0 frame:0

          tx packets:10 errors:0 dropped:0 overruns:0 carrier:0

          rx bytes:5560 (5.4 kb)  tx bytes:504 (504.0 b)

          rx packets:2041 errors:0 dropped:0 overruns:0 frame:0

          tx packets:2041 errors:0 dropped:0 overruns:0 carrier:0

          rx bytes:209184 (204.2 kb)  tx bytes:209184 (204.2 kb)

[root@rhas root]# ping 172.31.0.101

ping 172.31.0.101 (172.31.0.101) 56(84) bytes of data.

64 bytes from 172.31.0.101: icmp_seq=0 ttl=64 time=0.542 ms

64 bytes from 172.31.0.101: icmp_seq=1 ttl=64 time=0.270 ms

--- 172.31.0.101 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1004ms

rtt min/avg/max/mdev = 0.270/0.406/0.542/0.136 ms, pipe 2

172.31.0.0      0.0.0.0         255.255.255.0   u     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     u     0      0        0 eth0

0.0.0.0         172.31.0.254    0.0.0.0         ug    0      0        0 eth0

此時通路網絡沒有問題,故障排除。

未完待續。。。。

繼續閱讀