首次启动时无法 ping 通 IP

首次启动时无法 ping 通 IP

我尝试在 /etc/init.d/S98 脚本中添加一些路由,但无法 ping 通网关 IP,因此路由添加失败。但是,一旦执行了所有 S98 脚本,我就能够 ping IP 并添加路由。以下是 S98 脚本执行期间捕获的日志。您能否帮助我了解我在初始化脚本(/etc/rc3.d/S98)执行期间是否遗漏了某些内容。

PING 27.190.35.1 (27.190.35.1) from 27.190.35.171 bond0.3: 56(84) bytes of data.
From 27.190.35.171 icmp_seq=1 Destination Host Unreachable
From 27.190.35.171 icmp_seq=2 Destination Host Unreachable
From 27.190.35.171 icmp_seq=3 Destination Host Unreachable

# ifconfig 
bond0     Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.240.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:9000  Metric:1
          RX packets:446 errors:0 dropped:0 overruns:0 frame:0
          TX packets:290 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10000
          RX bytes:51268 (50.0 KiB)  TX bytes:42174 (41.1 KiB)

bond0.2   Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:10.63.73.16  Bcast:10.63.73.127  Mask:255.255.255.128
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:45 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10000
          RX bytes:2070 (2.0 KiB)  TX bytes:2058 (2.0 KiB)

bond0.2:1 Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:10.63.73.5  Bcast:10.63.73.127  Mask:255.255.255.128
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

bond0.3   Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:27.190.35.171  Bcast:27.190.35.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10000
          RX bytes:1794 (1.7 KiB)  TX bytes:1680 (1.6 KiB)

bond0.3:1 Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:27.190.35.170  Bcast:27.190.35.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

bond0:1   Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          inet addr:192.168.1.30  Bcast:192.168.15.255  Mask:255.255.240.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:9000  Metric:1

eth0      Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:9000  Metric:1
          RX packets:304 errors:0 dropped:0 overruns:0 frame:0
          TX packets:272 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10000
          RX bytes:35698 (34.8 KiB)  TX bytes:39596 (38.6 KiB)
          Interrupt:32 Memory:f6000000-f67fffff

eth1      Link encap:Ethernet  HWaddr B4:B5:2F:59:FF:E8
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:9000  Metric:1
          RX packets:142 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10000
          RX bytes:15570 (15.2 KiB)  TX bytes:2578 (2.5 KiB)
          Interrupt:36 Memory:f4800000-f4ffffff

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:156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:156 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:14528 (14.1 KiB)  TX bytes:14528 (14.1 KiB)

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.63.73.0      *               255.255.255.128 U     0      0        0 bond0.2
27.190.35.0     *               255.255.255.0   U     0      0        0 bond0.3
192.168.0.0     *               255.255.240.0   U     0      0        0 bond0
default         10.63.73.126    0.0.0.0         UG    0      0        0 bond0.2

traceroute result:
traceroute to 27.190.35.1 (27.190.35.1), 30 hops max, 60 byte packets
 1  Cage-3-dsc-sb-phy-A (27.190.35.171)  3000.659 ms !H  3000.649 ms !H  3000.634 ms !H

arping result: 
ARPING 27.190.35.1 from 27.190.35.171 bond0.3

答案1

初始化脚本按照其中的编号顺序运行:

  • S01第一

  • S10第十号

    ...

  • S90九十

这样做是为了让您可以在服务中堆叠依赖项,就像S85httpd依赖项一样S10network。如果没有依赖关系,例如 withS08ip6tablesS08iptables,则运行顺序并不重要。

因此,如果您对已运行有依赖性S98(如此处所示),则可以将该服务放入S99.

就我个人而言,除非有充分的理由,否则我会在网络脚本通常运行的范围之后(即S20或 之后S30)对脚本重新编号,具体取决于安装的内容。

编辑:您可能希望从自定义解决方案更改为使用实现绑定的通用方法。Linux Bond / 将多个网络接口 (NIC) 组合为一个接口,并阅读极其缓慢或没有失败的链接检测如果您仍然遇到类似的问题。

答案2

检查已为端口打开 portfast 的交换机。没有 portfast 意味着交换机在转发数据包之前将等待 30 秒。

接口 FastEthernet1
生成树 portfast

相关内容