ubuntu 奇怪的網路介面 [論壇 - Ubuntu 文件資源]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊

« 1 (2)


回覆: ubuntu 奇怪的網路介面
會員一級
註冊日期:
2012/6/10 23:35
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 923
EXP: 38
離線
回poloshiao大大:我的 virtualbox 版本是 Version 4.1.2_Ubuntu

2012/6/13 6:42
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面

註冊日期:
2009/12/6 10:32
所屬群組:
已註冊使用者
等級: 71
HP : 1053 / 1756
MP : 4456 / 59850
EXP: 24
離線
網卡設橋接介面卡,guest 用 route -n ,路由表是空根本不可能ping通

下述資料 引自
Oracle VM VirtualBox® User Manual 4.1.16 版

1. virtualbox 的 guest 網卡 共可 設定 下列模式
Introduction to networking modes

1-1. Not attached
In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection -- as if no Ethernet cable was plugged into the card. This way it is possible to "pull" the virtual Ethernet cable and disrupt the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration.

1-2. Network Address Translation (NAT) # 注意 2.
If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you, and you can safely skip the rest of this section. Please note that there are certain limitations when using Windows file sharing (see the section called “NAT limitations” for details).

1-3. Bridged networking
This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network stack.

1-4. Internal networking
This can be used to create a different kind of software-based network which is visible to selected virtual machines, but not to applications running on the host or to the outside world.

1-5. Host-only networking
This can be used to create a network containing the host and a set of virtual machines, without the need for the host's physical network interface. Instead, a virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.

1-6. Generic networking
Rarely used modes share the same generic network interface, by allowing the user to select a driver which can be included with VirtualBox or be distributed in an extension pack.

At the moment there are potentially two available sub-modes:

1-6-1. UDP Tunnel
This can be used to interconnect virtual machines running on different hosts directly, easily and transparently, over existing network infrastructure.

1-6-2. VDE (Virtual Distributed Ethernet) networking
This option can be used to connect to a Virtual Distributed Ethernet switch on a Linux or a FreeBSD host. At the moment this needs compiling VirtualBox from sources, as the Oracle packages do not include it.

2. 如果設爲 NAT 有下列 4 個限制
NAT limitations

There are four limitations of NAT mode which users should be aware of:
我的 virtualbox 版本是 Version 4.1.2_Ubuntu

2-1. ICMP protocol limitations: # ping 跟這個有關
Some frequently used network debugging tools (e.g. ping or tracerouting) rely on the ICMP protocol for sending/receiving messages. While ICMP support has been improved with VirtualBox 2.1 (ping should now work), some other tools may not work reliably.

2-2. Receiving of UDP broadcasts is not reliable:
The guest does not reliably receive broadcasts, since, in order to save resources, it only listens for a certain amount of time after the guest has sent UDP data on a particular port. As a consequence, NetBios name resolution based on broadcasts does not always work (but WINS always works). As a workaround, you can use the numeric IP of the desired server in the \\server\share notation.

2-3. Protocols such as GRE are unsupported:
Protocols other than TCP and UDP are not supported. This means some VPN products (e.g. PPTP from Microsoft) cannot be used. There are other VPN products which use simply TCP and UDP.

2-4. Forwarding host ports < 1024 impossible:
On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible to bind to ports below 1024 from applications that are not run by root. As a result, if you try to configure such a port forwarding, the VM will refuse to start.

These limitations normally don't affect standard network use. But the presence of NAT has also subtle effects that may interfere with protocols that are normally working. One example is NFS, where the server is often configured to refuse connections from non-privileged ports (i.e. ports not below 1024).

2012/6/13 7:25
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員一級
註冊日期:
2012/6/10 23:35
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 923
EXP: 38
離線
回andyfang大大:我把virtualbox網卡設成nat,guest 設成pppoe就可以上網,和host一樣都是拿ipv6的ip,能不能改成都拿ipv4

2012/6/13 23:34
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員五級
註冊日期:
2010/9/26 16:05
所屬群組:
已註冊使用者
等級: 27
HP : 0 / 660
MP : 317 / 20966
EXP: 43
離線
有這麼怪的事喔?
pppoe播接的話,會是電信業者發IP給你的電腦(host跟guest視同二台電腦,會配不同IP)
但是現在的電信業者應該還沒開始發ipv6,你的狀況有點難理解
可以在guest下指令
ifconfig -a
結果貼上來看看

2012/6/13 23:58
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面

註冊日期:
2009/12/6 10:32
所屬群組:
已註冊使用者
等級: 71
HP : 1053 / 1756
MP : 4456 / 59850
EXP: 24
離線
和host一樣都是拿ipv6的ip,能不能改成都拿ipv4

如果你說的 IPv6 是類似 guest #1 的
addr: fe80::6e62:6dff:fea1:32e0/64 Scope:Link
這個是 IPv6 機制 中 作業系統啓動 就根據網卡自動產生的
目的是爲了確保 作業系統單機 或 subnet 範圍的連線 無困難
每個支援 IPv6 的網卡 與 作業系統 都會自動產生 fe80:: 開頭的 IPv6
但是這個 fe80:: 開頭的 IPv6 在 Internet 上是不通的
參考
Stateless address autoconfiguration

摘錄自 Oracle VM / VirtualBox User Manual / Version 4.1.16
P89
6.3 Network Address Translation (NAT)

A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router.

The “router”, in this case, is the VirtualBox networking engine, which
maps traffic from and to the virtual machine transparently. In VirtualBox this router is placed between each virtual machine and the host. This separation maximizes security since by default virtual machines cannot talk to each other.

The disadvantage of NAT mode is that, much like a private network behind a router, the virtual machine is invisible and unreachable from the outside internet; you cannot run a server this way unless you set up port forwarding (described below).

The network frames sent out by the guest operating system are received by VirtualBox’s NAT engine, which extracts the TCP/IP data and resends it using the host operating system. To an application on the host, or to another computer on the same network as the host, it looks like the data was sent by the VirtualBox application on the host, using an IP address belonging to the host. VirtualBox listens for replies to the packages sent, and repacks and resends them to the
guest machine on its private network.

The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The IP address thus assigned to the virtual machine is usually on a completely different network than the host. As more than one card of a virtual machine can be set up to use NAT, the first card is connected to the private network 10.0.2.0, the second card to the network 10.0.3.0 and so on. If you need to change the guestassigned IP range for some reason, please refer to chapter 9.11, Fine-tuning the VirtualBox NAT engine, page 156.

2012/6/14 6:27
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員一級
註冊日期:
2012/6/10 23:35
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 923
EXP: 38
離線
回andyfang大大:我的guest網路介面如下

eth1 Link encap:Ethernet HWaddr 08:00:27:31:eb:53
inet6 addr: fe80::a00:27ff:fe31:eb53/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1488 (1.4 KB) TX bytes:5642 (5.6 KB)

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: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)

ppp0 Link encap:Point-to-Point Protocol
inet addr:218.166.197.79 P-t-P:168.95.98.254 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:776 (776.0 B) TX bytes:488 (488.0 B)

2012/6/14 23:39
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員五級
註冊日期:
2010/9/26 16:05
所屬群組:
已註冊使用者
等級: 27
HP : 0 / 660
MP : 317 / 20966
EXP: 43
離線
所以你的guest透過pppoe的方式播接,已經取得一個ipv4的ip了:
218.166.197.79 <- 這個就是

因為你用的是pppoe的方式
所以IP會出現在ppp0那裏,eth1沒有出現是正常的
你看一下第三段的訊息,前二行
ppp0 Link encap:Point-to-Point Protocol
inet addr:218.166.197.79 P-t-P:168.95.98.254 Mask:255.255.255.255

你可以對照一下host跟guest
二邊的訊息應該是對稱的
在host下指令
ifconfig -a
也會有一個ppp0
比對二邊的IP
會發現二邊的IP是在同一個網段
試試ping一下
應該可以讓host跟guest互相ping得到

成功的話,應該就是你想要的結果了吧

2012/6/14 23:50
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員一級
註冊日期:
2012/6/10 23:35
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 923
EXP: 38
離線
回andyfang大大:可以ping通了,Mask:255.255.255.255網段要怎算,一般網段的算法,例如:Mask:255.255.255.0,A點ip:192.168.1.1
,B點ip:192.168.1.2,它們都在192.168.1.0網段,照這個理論,Mask:255.255.255.255和自己同網段的ip應該只有自己本身

2012/6/18 0:09
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員五級
註冊日期:
2010/9/26 16:05
所屬群組:
已註冊使用者
等級: 27
HP : 0 / 660
MP : 317 / 20966
EXP: 43
離線
的確是不同網段沒錯
依你的況狀,host / guest能夠互ping是因為透過gateway的關係

2012/6/18 1:39
應用擴展 工具箱
回覆: ubuntu 奇怪的網路介面
會員一級
註冊日期:
2012/6/10 23:35
所屬群組:
已註冊使用者
等級: 2
HP : 0 / 34
MP : 4 / 923
EXP: 38
離線
謝謝各位大大的幫忙,我終於了解。

2012/6/18 7:30
應用擴展 工具箱

« 1 (2)

 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.