当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 6 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 10:20 

注册: 2015-07-24 8:29
帖子: 111
系统: ubuntu
送出感谢: 0 次
接收感谢: 0 次
ifconfig
eth0 Link encap:Ethernet HWaddr e0:3f:49:57:4b:d1
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::e23f:49ff:fe57:4bd1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6068 errors:0 dropped:0 overruns:0 frame:0
TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3780468 (3.6 MiB) TX bytes:11800 (11.5 KiB)

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:65536 Metric:1
RX packets:14 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 B) TX bytes:700 (700.0 B)

wlan0 Link encap:Ethernet HWaddr 00:21:5d:26:c1:10
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::221:5dff:fe26:c110/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1291 errors:0 dropped:0 overruns:0 frame:0
TX packets:5146 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:81917 (79.9 KiB) TX bytes:992000 (968.7 KiB)

但我连接baidu.com的时候,请问是本机的哪个ip地址发出的连接请求呢?如何查看


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 11:16 

注册: 2009-08-04 16:33
帖子: 16886
送出感谢: 21
接收感谢: 1826
把下面指令 複製 貼進終端機 執行
1. sudo route -nv
2. sudo tracepath forum.ubuntu.org.cn
3. sudo traceroute -i eth0 forum.ubuntu.org.cn
4. sudo traceroute -i wlan0 forum.ubuntu.org.cn
把結果直接 選取/複製/貼上來


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 19:02 

注册: 2015-07-24 8:29
帖子: 111
系统: ubuntu
送出感谢: 0 次
接收感谢: 0 次
root@hwy:/home/debian8# route -nv
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
root@hwy:/home/debian8# tracepath forum.ubuntu.org.cn
1?: [LOCALHOST] pmtu 1500
1: 192.168.1.1 3.164ms
1: 192.168.1.1 12.867ms
2: 192.168.1.1 3.069ms pmtu 1492
2: 113.58.144.1 42.953ms
3: 221.11.165.9 44.810ms
4: 221.11.165.245 61.522ms asymm 7
5: 219.158.24.217 54.489ms asymm 6
6: 219.158.23.22 122.072ms
7: 219.158.97.30 169.597ms
8: 219.158.30.254 404.408ms
9: 199.102.95.5 317.132ms
10: 207.254.184.98 295.204ms
11: dist01.dc03.lax.ip4.scalabledns.com 270.719ms
12: dc03r04ds30.scalabledns.com 260.713ms
13: 192.157.242.155 274.252ms reached
Resume: pmtu 1492 hops 13 back 12
root@hwy:/home/debian8# traceroute -i eth0 forum.ubuntu.org.cn
traceroute to forum.ubuntu.org.cn (192.157.242.155), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
root@hwy:/home/debian8# traceroute -i wlan0 forum.ubuntu.org.cn
traceroute to forum.ubuntu.org.cn (192.157.249.221), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 2.954 ms 2.938 ms 2.928 ms
2 113.58.144.1 (113.58.144.1) 30.905 ms 30.906 ms 30.899 ms
3 221.11.165.9 (221.11.165.9) 36.599 ms 40.973 ms 221.11.165.13 (221.11.165.13) 40.947 ms
4 221.11.154.181 (221.11.154.181) 40.953 ms 40.944 ms 221.11.155.249 (221.11.155.249) 92.339 ms
5 219.158.24.217 (219.158.24.217) 52.947 ms 219.158.23.237 (219.158.23.237) 60.847 ms 219.158.100.241 (219.158.100.241) 56.907 ms
6 219.158.14.189 (219.158.14.189) 104.059 ms 219.158.12.45 (219.158.12.45) 94.397 ms 94.381 ms
7 219.158.97.190 (219.158.97.190) 186.446 ms 219.158.97.202 (219.158.97.202) 170.232 ms 219.158.97.190 (219.158.97.190) 178.118 ms
8 219.158.98.78 (219.158.98.78) 178.100 ms 169.033 ms 169.003 ms
9 219.158.98.54 (219.158.98.54) 303.880 ms 312.199 ms 303.862 ms
10 219.158.33.18 (219.158.33.18) 316.333 ms 316.302 ms 316.302 ms
11 ae9.cr1.sjc2.us.zip.zayo.com (64.125.31.201) 271.868 ms 266.320 ms 269.262 ms
12 ae5.mpr1.den1.us.zip.zayo.com (64.125.25.54) 370.310 ms * 365.620 ms
13 ae11.mpr2.den1.us.zip.zayo.com (64.125.31.154) 571.369 ms 568.334 ms 562.806 ms
14 ae13.cr2.ord2.us.zip.zayo.com (64.125.21.253) 582.968 ms 581.298 ms 590.346 ms
15 * * ae14.er2.ord7.us.zip.zayo.com (64.125.31.70) 644.818 ms
16 * * enzu.com-gw.chi.ip4.cpe.zayo.com (208.184.236.186) 640.340 ms
17 border02-core.dc02.chi.ip4.scalabledns.com (192.80.184.18) 340.489 ms 341.927 ms 336.816 ms
18 199.231.209.9 (199.231.209.9) 333.417 ms 332.984 ms 330.489 ms
19 192.157.249.221 (192.157.249.221) 327.491 ms 338.317 ms 327.738 ms

默认状态下,我的wlan0被使用


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 19:12 

注册: 2009-08-04 16:33
帖子: 16886
送出感谢: 21
接收感谢: 1826
引用:
route -nv
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

1. 路由 wlan0 雙向生效
路由 eth0 單向生效
引用:
traceroute -i wlan0 forum.ubuntu.org.cn
traceroute to forum.ubuntu.org.cn (192.157.249.221), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 2.954 ms 2.938 ms 2.928 ms
2 113.58.144.1 (113.58.144.1) 30.905 ms 30.906 ms 30.899 ms

2. 路徑走 wlan0
引用:
traceroute -i eth0 forum.ubuntu.org.cn
traceroute to forum.ubuntu.org.cn (192.157.242.155), 30 hops max, 60 byte packets
1 * * *
2 * * *

3. 路徑不是走 wlan0

4. 補充
一般雙網卡 不建議同時屬於同一個 子網卡
屬於同一個 子網 有時會拖慢速度
最好屬於兩個不同的子網 兩個有效的路由
如果只能屬於同一個 子網
最好關閉其中不用的那一個網卡


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 20:03 

注册: 2015-07-24 8:29
帖子: 111
系统: ubuntu
送出感谢: 0 次
接收感谢: 0 次
请问,何为单向生效?


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 双网卡环境下,哪一个ip处于使用状态?
帖子发表于 : 2015-11-22 21:10 

注册: 2009-08-04 16:33
帖子: 16886
送出感谢: 21
接收感谢: 1826
引用:
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

单向生效 是我自己用來描述
0.0.0.0 ---> 192.168.1.0
但是 沒有
192.168.1.0 ---> 0.0.0.0
補充
這裡的 0.0.0.0 表示 all IPv4 addresses on the local machine
192.168.1.0={192.168.1.x|0<x<256} 子網集合


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 6 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译