天天加油 - 助您成才
在Linux中安装两块网卡网络不通的解决方法
您正在看的Linux|Unix是:在Linux中安装两块网卡网络不通的解决方法。
案例一

一天,小王突然急匆匆的来找我,他说:“我在机子上刚装的redhat怎么老也ping不通服务器,我网卡的驱动都安装了,ping 自己的两块网卡的IP都能通,可就时访问不了服务器。我输入http://172.31.0.101就提示‘当试图与172.31.0.101联系时,连接被拒绝’”

我来到小王的机器前查看了一下网络配置。

[root@rhas root]# ifconfig -a

eth0 Link encap:Ethernet HWaddr 00:D0: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

collisions:0 txqueuelen:1000

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

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)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

又不是防火墙的问题,想了一下,我越发肯定刚才的想法是正确的。

[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]#

[root@rhas root]#

[root@rhas root]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:D0: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:68 errors:0 dropped:0 overruns:0 frame:0

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

collisions:0 txqueuelen:1000

RX bytes:5560 (5.4 Kb) TX bytes:504 (504.0 b)

Interrupt:10 Base address:0xe800 Memory:d9100000-d9100038

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:2041 errors:0 dropped:0 overruns:0 frame:0

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

collisions:0 txqueuelen: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

[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 eth0

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

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 eth0

[root@rhas root]#

此时访问网络没有问题,故障排除。

案例二

由此我又想相类似的案例,一win98用户错将”TCP/IP-->拨号适配器”设置了IP,结果造成他ping不通其他机器。

e.g.将拨号适配器设置ip=172.31.0.1

C:\>ipconfig/all

Windows 98 IP Configuration

Host Name . . . . . . . . . : R4U2L8

DNS Servers . . . . . . . . :

Node Type . . . . . . . . . : Broadcast

NetBIOS Scope ID. . . . . . :

IP Routing Enabled. . . . . : No

WINS Proxy Enabled. . . . . : No

NetBIOS Resolution Uses DNS : No

0 Ethernet adapter :

Description . . . . . . . . : PPP Adapter.

Physical Address. . . . . . : 44-45-53-54-00-00

DHCP Enabled. . . . . . . . : No

IP Address. . . . . . . . . : 172.31.0.1

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

Default Gateway . . . . . . :

Primary WINS Server . . . . :

Secondary WINS Server . . . :

Lease Obtained. . . . . . . :

Lease EXPires . . . . . . . :

1 Ethernet adapter :

Description . . . . . . . . : Intel(R) PRO PCI Adapter

Physical Address. . . . . . : 00-D0-B7-C6-8F-1D

DHCP Enabled. . . . . . . . : No

IP Address. . . . . . . . . : 172.31.0.200

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

Default Gateway . . . . . . :

Primary WINS Server . . . . :

Secondary WINS Server . . . :

Lease O

  • 上一篇教程:
  • 下一篇教程:
  • 排行

    1. stty使用方法
    2. tr的使用方法
    3. 全力打造Linux服务器配置大全
    4. find和xargs使用详解
    5. 配置 FTP 服务器以支持 IPv6
    6. Linux入门
    7. Modeler V6.0 for Linux 试用版
    8. Architect V6.0 for Linux 试用版
    9. Eclipse for Linux on POWER 的安
    10. OProfile for Linux on POWER 识
    11. RPM卸载软件完全手册
    12. Mysql 5.0.22 Cluster for RedHa
    13. FreeBSD Web Server架设实例过程
    14. Qmail邮件系统的安全分析和改进研
    15. 点评主流中间件技术平台
    16. Linux“装机”一条龙
    1. 我也来学做嵌入式Linux系统V0.1(
    2. RHAS3上快速实现磁盘配额解决方案
    3. 全力打造Linux服务器配置大全
    4. 抢先试用----防火墙KWF6.0新功能
    5. tr的使用方法
    6. stty使用方法
    7. find和xargs使用详解
    8. 使用 Git 管理源代码
    9. 配置 FTP 服务器以支持 IPv6
    10. Architect V6.0 for Linux 试用版
    11. Python Web 框架,第 1 部分: 使
    12. Eclipse for Linux on POWER 的安
    13. Linux 的魅力: 让古老的机器重获
    14. OProfile for Linux on POWER 识
    15. 第 2 部分: 信号量和事件
    16. 用NT Loader加载GRUB来启动Linux
    1. 在CentOS 4.4上安装配置OpenVZ
    2. 利用BusyBox定制Linux Live CD
    3. 红帽RHCE证书RH302考试
    4. 程序设计师的迷思---工具与数据库
    5. 数据库管理员的难题,选择MySQL还
    6. 技巧:用Sort和Tsort对文件排序
    7. PHP配置入门的福音PHP.ini中文版
    8. sed与unix命令等价代码鉴赏
    9. 如何编译配置Apache中的Configur
    10. qmail+webmailonLinux9安装全过程
    11. Solaris下的常用命令和使用方法
    12. Unix应用技巧:solarisraid制作大
    13. 利用vnc远程图形界面控制Linux
    14. Linux字体设置fonts.dir文件分析
    15. GCC使用指南及gcc最佳编译参数
    16. cron服务配置祥解

    最近更新

  • 推荐阅读
  • Linux|Unix《在Linux中安装两块网卡网络不通的解决方法》在Linux中安装两块网卡网络不通的解决方法
    关于我们 | 版权申明 | 广告服务 | 友情链接 | 网站地图 | 使用帮助 | ©2006-2008 TTADD.COM