![Centos 6:启动 NIC 会导致现有 NIC 出现问题](https://linux22.com/image/582391/Centos%206%EF%BC%9A%E5%90%AF%E5%8A%A8%20NIC%20%E4%BC%9A%E5%AF%BC%E8%87%B4%E7%8E%B0%E6%9C%89%20NIC%20%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
我有一台 CentOS 6 机器,用于运行 Nagios。它是一台 Dell PowerEdge 服务器,不在保修范围内,有 2 个板载 NIC 和 2 个卡。它已经运行 Nagios 几个月了,运行良好。2 个板载 NIC 正在运行,而第 2 对处于非活动状态。
最近,我从 eesensors.com 获得了一个水/温度/光传感器,它可以插入 NIC 并与 Nagios 兼容。我编译了 Nagios 插件,将其连接到第二个 NIC 之一,按照似乎合适的方式配置了“ifcfg-p3p1”(*),然后运行了“ifup-p3p1”。
此时,“ifconfig”显示新端口已启动,数据包正在通过。同时,原始端口似乎停止工作。Apache 没有响应,Nagios 报告每次测试的错误。我仍然可以通过 SSH 与服务器通信。要解决此问题,我必须重新启动网络,这将启动 eth1 但不启动 p3p1。
所以 -
- 我在启动附加端口时做错了什么?
- 为什么我的 HTTPD 等服务会停止响应,即使 SSH 可以工作?我认为如果 NIC 坏了,那么 SSH 也会随之坏掉。
ifcfg-p3p1:
DEVICE=p3p1
HWADDR=00:0E:0C:xx:xx:xx
ONBOOT=no
BOOTPROTO=static
IPADDR=192.168.0.1
NETMASK=255.255.255.0
GATEWAY=192.168.0.2
ifcfg-eth1:
DEVICE="eth1"
HWADDR="00:14:22:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=10.127.24.21
GATEWAY=10.127.24.1
NETMASK=10.127.254.0
NETWORK=10.127.24.0
TYPE=ETHERNET
[root@orange network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:14:22:13:b7:f3 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:14:22:13:b7:f4 brd ff:ff:ff:ff:ff:ff
inet 10.127.24.21/23 brd 10.127.25.255 scope global eth1
inet6 fe80::214:22ff:fe13:b7f4/64 scope link
valid_lft forever preferred_lft forever
4: p3p1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:0e:0c:71:82:ae brd ff:ff:ff:ff:ff:ff
5: p3p2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:0e:0c:71:82:af brd ff:ff:ff:ff:ff:ff
[root@orange network-scripts]# ip route
10.127.24.0/23 dev eth1 proto kernel scope link src 10.127.24.21
169.254.0.0/16 dev eth1 scope link metric 1003
default via 10.127.24.1 dev eth1
[root@orange network-scripts]# ifup p3p1
[root@orange network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:14:22:13:b7:f3 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:14:22:13:b7:f4 brd ff:ff:ff:ff:ff:ff
inet 10.127.24.21/23 brd 10.127.25.255 scope global eth1
inet6 fe80::214:22ff:fe13:b7f4/64 scope link
valid_lft forever preferred_lft forever
4: p3p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0e:0c:71:82:ae brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global p3p1
inet6 fe80::20e:cff:fe71:82ae/64 scope link
valid_lft forever preferred_lft forever
5: p3p2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:0e:0c:71:82:af brd ff:ff:ff:ff:ff:ff
[root@orange network-scripts]# ip route
192.168.0.0/24 dev p3p1 proto kernel scope link src 192.168.0.1
10.127.24.0/23 dev eth1 proto kernel scope link src 10.127.24.21
169.254.0.0/16 dev eth1 scope link metric 1003
169.254.0.0/16 dev p3p1 scope link metric 1004
default via 192.168.0.2 dev p3p1
答案1
删除此行:
GATEWAY=192.168.0.2
那里没有门户!
如果指定一个实际上不是网关的 IP 地址作为网关,那么任何需要使用网关的服务都将中断。