打印
[总线接口]

如何让两路网口同时工作

[复制链接]
2019|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
你好!请问两路网口的测试教程都是要先关闭另外一路,如果不关闭的话。比如默认是开启eth0的。
我这边没有输入ifconfig eth0 down
就输入ifconfig eth1 192.168.137.82  
开启网口eth1
连上网线也只有eth0可以ping的到  
该如何设置才能两个网口都正常工作?
此时,PING eth0可以ping的通。
输入ifconfig eth0 down  把ETH0关闭了,ETH1就ping的通了。


网段的问题,两个网口设置成不同的网段就可以了
不同网段和同个网段都行,需要知道哪个网络接口,如下
网线插在eth0和电脑(电脑默认IP为192.168.137.100,eth0为192.168.137.81)
root@myimx6ek140p:~# ifconfig            
eth0      Link encap:Ethernet  HWaddr 1C:87:76:53:36:63  
          inet addr:192.168.137.81  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::1e87:76ff:fe53:3663%1995732688/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7725 (7.5 KiB)  TX bytes:5558 (5.4 KiB)

lo        Link encapocal Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%1995732688/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@myimx6ek140p:~# ping -I eth0 192.168.137.100
PING 192.168.137.100 (192.168.137.100): 56 data bytes
64 bytes from 192.168.137.100: seq=0 ttl=128 time=3.331 ms
64 bytes from 192.168.137.100: seq=1 ttl=128 time=0.874 ms
64 bytes from 192.168.137.100: seq=2 ttl=128 time=1.041 ms
64 bytes from 192.168.137.100: seq=3 ttl=128 time=0.702 ms
^C
--- 192.168.137.100 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.702/1.487/3.331 ms
root@myimx6ek140p:~#
root@myimx6ek140p:~#

网线插在eth1和电脑(电脑默认IP为192.168.137.100,eth0为192.168.137.91)
root@myimx6ek140p:~# ifconfig  eth1 192.168.137.91
fec 20b4000.ethernet eth1: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet:01, irq=-1)
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
root@myimx6ek140p:~# fec 2188000.ethernet eth0: Link is Down
fec 20b4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready

root@myimx6ek140p:~# ifconfig   
eth0      Link encap:Ethernet  HWaddr 1C:87:76:53:36:63  
          inet addr:192.168.137.81  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::1e87:76ff:fe53:3663%1995650768/64 Scopeink
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:90 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8998 (8.7 KiB)  TX bytes:6034 (5.8 KiB)

eth1      Link encap:Ethernet  HWaddr 8E:13:50:B6:8D:0A  
          inet addr:192.168.137.91  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::8c13:50ff:feb6:8d0a%1995650768/64 Scopeink
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4832 (4.7 KiB)  TX bytes:5138 (5.0 KiB)

lo        Link encapocal Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%1995650768/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

root@myimx6ek140p:~# ping -I eth1 192.168.137.100
PING 192.168.137.100 (192.168.137.100): 56 data bytes
64 bytes from 192.168.137.100: seq=0 ttl=128 time=1.624 ms
64 bytes from 192.168.137.100: seq=1 ttl=128 time=1.251 ms
64 bytes from 192.168.137.100: seq=2 ttl=128 time=0.662 ms
64 bytes from 192.168.137.100: seq=3 ttl=128 time=1.003 ms
64 bytes from 192.168.137.100: seq=4 ttl=128 time=0.856 ms
^C
--- 192.168.137.100 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.662/1.079/1.624 ms
root@myimx6ek140p:~#

如果还是不行的话,可以设置一下路由(route add default gw 192.168.137.1 eth1)


使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

206

主题

261

帖子

4

粉丝