linux – 多个以太网接口

前端之家收集整理的这篇文章主要介绍了linux – 多个以太网接口前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有两个网卡,配置如下:
  1. eth0 Link encap:Ethernet HWaddr 00:19:d1:31:08:e8
  2. inet addr:192.168.5.104 Bcast:192.168.5.255 Mask:255.255.255.0
  3. inet6 addr: fe80::219:d1ff:fe31:8e8/64 Scope:Link
  4. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  5. RX packets:4564126 errors:590 dropped:0 overruns:0 frame:329
  6. TX packets:9707383 errors:0 dropped:0 overruns:0 carrier:0
  7. collisions:0 txqueuelen:1000
  8. RX bytes:1151788275 (1.0 GiB) TX bytes:189318786 (180.5 MiB)
  9. Interrupt:20 Memory:e0300000-e0320000
  10.  
  11. eth1 Link encap:Ethernet HWaddr 00:e0:4c:51:0d:55
  12. inet addr:85.255.103.4 Bcast:85.255.103.255 Mask:255.255.255.0
  13. inet6 addr: fe80::2e0:4cff:fe51:d55/64 Scope:Link
  14. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  15. RX packets:5466 errors:0 dropped:0 overruns:0 frame:0
  16. TX packets:499 errors:0 dropped:0 overruns:0 carrier:0
  17. collisions:0 txqueuelen:1000
  18. RX bytes:518961 (506.7 KiB) TX bytes:34236 (33.4 KiB)
  19. Interrupt:22 Base address:0x1000
  20.  
  21. lo Link encap:Local Loopback
  22. inet addr:127.0.0.1 Mask:255.0.0.0
  23. inet6 addr: ::1/128 Scope:Host
  24. UP LOOPBACK RUNNING MTU:16436 Metric:1
  25. RX packets:136 errors:0 dropped:0 overruns:0 frame:0
  26. TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
  27. collisions:0 txqueuelen:0
  28. RX bytes:15556 (15.1 KiB) TX bytes:15556 (15.1 KiB)

ip路由:

  1. $ip route
  2. 192.168.5.0/24 dev eth0 proto kernel scope link src 192.168.5.104
  3. 85.255.103.0/24 dev eth1 proto kernel scope link src 85.255.103.4
  4. default via 192.168.5.1 dev eth0
  5. default via 85.255.103.1 dev eth1

当我ping eth1的ip地址时,我得不到任何回复.

使用tcpdump,我认为发送到eth1的所有ICMP回应请求都是通过eth0接口回答的.

如何实现两个接口正常工作?如果我ping eth1,它也应该返回eth1的答案.

eth0有一个更快的互联网连接,我只想保持eth1周围,并在应用程序绑定到特定的IP时通过它.

解决方法

删除为eth0(192.168.5.1)定义的网关.如果您需要多个默认路由,则必须使用 iproute2为其创建策略.

猜你在找的Linux相关文章