linux – 多个以太网接口

前端之家收集整理的这篇文章主要介绍了linux – 多个以太网接口前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有两个网卡,配置如下:
eth0      Link encap:Ethernet  HWaddr 00:19:d1:31:08:e8  
          inet addr:192.168.5.104  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::219:d1ff:fe31:8e8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4564126 errors:590 dropped:0 overruns:0 frame:329
          TX packets:9707383 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1151788275 (1.0 GiB)  TX bytes:189318786 (180.5 MiB)
          Interrupt:20 Memory:e0300000-e0320000 

eth1      Link encap:Ethernet  HWaddr 00:e0:4c:51:0d:55  
          inet addr:85.255.103.4  Bcast:85.255.103.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4cff:fe51:d55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5466 errors:0 dropped:0 overruns:0 frame:0
          TX packets:499 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:518961 (506.7 KiB)  TX bytes:34236 (33.4 KiB)
          Interrupt:22 Base address:0x1000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:136 errors:0 dropped:0 overruns:0 frame:0
          TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:15556 (15.1 KiB)  TX bytes:15556 (15.1 KiB)

ip路由:

$ip route
192.168.5.0/24 dev eth0  proto kernel  scope link  src 192.168.5.104 
85.255.103.0/24 dev eth1  proto kernel  scope link  src 85.255.103.4 
default via 192.168.5.1 dev eth0 
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为其创建策略.
原文链接:https://www.f2er.com/linux/399818.html

猜你在找的Linux相关文章