由安装两块网卡的linux系统中引起网络不通想到的

一天,小王突然急匆匆的来找我,他说:“我在机子上刚装的redhat怎么老也ping不通服务器,我网卡的驱动都安装了,ping 自己的两块网卡的IP都能通,可就时访问不了服务器。我输入[url]http://172.31.0.101[/url]就提示‘当试图与172.31.0.101联系时,连接被拒绝’”
我来到小王的机器前查看了一下网络配置。
[root@rhas root]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' border="0" alt="" src="http://linux.chinaunix.net/bbs/images/smilies/icon_biggrin.gif" SMILIEID="28" />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
          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 00650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src)' border="0" alt="" src="http://linux.chinaunix.net/bbs/images/smilies/icon_biggrin.gif" SMILIEID="28" />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: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]#

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

未完待续。。。。
 

本文出自 “李晨光原创技术博客” 博客,请务必保留此出处http://chenguang.blog.51cto.com/350944/69543

由安装两块网卡的linux系统中引起网络不通想到的的更多相关文章

  1. Linux系统中存储设备的两种表示方法

    转:https://blog.csdn.net/holybin/article/details/38637381 一.对于IDE接口的硬盘的两种表示方法: 1.IDE接口硬盘,对于整块硬盘的两种表示方 ...

  2. Linux系统中安装软件方法总结

    Linux系统中安装软件方法总结 [1]Linux系统中安装软件的几种方式 [2] Linux配置yum源(本地源和网络源) [3] SuSE下zypper源配置 [4] SUSE zypper 本地 ...

  3. 『动善时』JMeter基础 — 57、Linux系统中运行JMeter脚本

    目录 1.Linux系统中安装Java环境 (1)解压Java安装包 (2)配置Java环境变量 (3)验证Java环境是否配置成功 2.Linux系统中安装JMeter (1)下载JMeter (2 ...

  4. 在linux 创建网络会话和绑定两块网卡

    1. 如果我们在公司网络中要手动指定网络的IP地址,当我们回到家里则是使用DHCP(动态主机配置协议)自动分配IP地址.这就有点麻烦了,因为要频繁的修改IP地址,所以接下来我们来创建网络会话----- ...

  5. [Hyper-V]给Hyper-V创建两块网卡备用

    描述 给Hyper-V创建两块网卡备用 步骤: 1 打开Hyper-V,在右侧Action栏,单击Virtual Switch Manager… 2 依次选择New Virtual network s ...

  6. 在Linux系统中安装caffe

    学习深度学习已经很久了,但一直没有自己动手安装过caffe,因为工作需要,需要在linux系统中安装caffe,因此,在这里对安装过程进行记录. caffe配置起来比tensorflow更麻烦一些,我 ...

  7. Jmeter(五十三) - 从入门到精通高级篇 - 懒人教你在Linux系统中安装Jmeter(详解教程)

    1.简介 我们绝大多数使用的都是Windows操作系统,因此在Windows系统上安装JMeter已经成了家常便饭,而且安装也相对简单,但是服务器为了安全.灵活小巧,特别是前几年的勒索病毒,现在绝大多 ...

  8. 在linux系统中安装VSCode(Visual Studio Code)

    在linux系统中安装VSCode(Visual Studio Code) 1.从官网下载压缩包(话说下载下来解压就直接可以运行了咧,都不需要make) 访问Visual Studio Code官网  ...

  9. 腾讯云Linux系统中启动自己安装的tomcat

    腾讯云Linux系统中启动自己安装的tomcat 首先通过工具查看一下安装的tomcat的位置 进入命令行之后输入以下指令: 此时,tomcat已经启动了.

随机推荐

  1. apache源码编译安装

    源码安装apche 下载apache的源码包文件 访问http://mirror.bit.edu.cn/apache/httpd/,复制如下gz文件的链接地址,并使用wget下载到本地 wget -P ...

  2. Spring 整合Shiro:记住我

    1.登录方法 /** * 执行登录操作 * * @param username * @param password * @param rememberMe * @param model * @retu ...

  3. TOJ 3517 The longest athletic track

    3517.   The longest athletic track Time Limit: 1.0 Seconds   Memory Limit: 65536KTotal Runs: 880   A ...

  4. cogs 141. [USACO Jan08] 奶牛的选举

    141. [USACO Jan08] 奶牛的选举 ★   输入文件:elect.in   输出文件:elect.out   简单对比时间限制:1 s   内存限制:16 MB 在推翻了Farmer J ...

  5. MS ACCESS MID函数

    select * from GongCheng where MID(GCWYBH,3,8)='" + time.Date.ToString("yyyyMMdd") + & ...

  6. [Test] Easy automated testing in NodeJS with TestCafe

    Quickly get up and running with sensible automated testing scenarios written in ES6. Installing and ...

  7. 更新 hadoop eclipse 插件

    卸载hadoop 1.1.2插件.并安装新版hadoop 2.2.0插件. 假设直接删除eclipse plugin文件夹下的hadoop 1.1.2插件,会导致hadoop 1.1.2插件残留在ec ...

  8. Android设置头像,手机拍照或从本地相冊选取图片作为头像

     [Android设置头像,手机拍照或从本地相冊选取图片作为头像] 像微信.QQ.微博等社交类的APP,通常都有设置头像的功能,设置头像通常有两种方式: 1,让用户通过选择本地相冊之类的图片库中已 ...

  9. sass09

    scss /* 1.使用自定义function和@each实现栅格布局. @function buildLayout($num: 5){ } 结果: col1{width: 20%} col2{wid ...

  10. BZOJ 2049 LCT

    思路:LCT的基本操作 //By SiriusRen #include <cstdio> #include <cstring> #include <algorithm&g ...