Virtual Machine Network Understanding

Source: Internet
Author: User

The network segment of the general intranet is 168.192.a.b type.

If the network segment, A and A are all 0, then the second IP is the network identity of this network segment;

If the network segment, A and A is all 1, it means that the IP is the last IP of this segment, that is, the broadcast address IP;

The above 2 IPs are not available for all IP in any one network segment. The total quantity to be-2.

 Gateway: An external network interface in this LAN segment, that is, the first IP to be used as the Gateway (External network interface), usually the network is located in the LAN with the "external Internet" connected to the "Router intranet set IP". routers generally by dual identities, internal (intranet gateway), external (public IP)

Other special types of IP addresses:

(1)0.0.0.0 represents such a collection: all unclear hosts and destination networks.

(2)255.255.255.255 limit broadcast address, this address cannot be forwarded by the router.

(3) 127.0.0.1 native address.

1. Route command

The route command is a network command that displays and modifies entries in the local IP routing table.

Common commands:

    • Route Delete: delete route;
    • Route print: The destination of the print route;
    • Route add: Add route;
    • Route change: Changes an existing route.

The three commands for route delete, route add, and route print are generally used to resolve all the functionality of the routing.

Test this machine:

  

(1) The first column is the network destination address .

Lists all the network segments that the router is connected to.

(2) The second line of the Netmask column provides the subnet mask for the network segment itself , not the subnet mask of the network card that is connected to the network segment.

This basically allows the router to determine the address class of the destination network.

(3) The third column is the gateway.

Once the router determines which destination network It wants to forward this packet to, the router will look at the list of gateways.

The network Guan tells the router which IP address the packet should be forwarded to to reach the destination network.

(4) fourth Column interface column.

Tell the router which NIC is connected to the appropriate destination network ( the destination LAN for the response ). Technically, the interface column tells the router only the IP address assigned to the NIC . The NIC connects the router to the destination network. However, the router is smart enough to know which physical NIC the address is bound to.

(5) The fifth column is the measurement.

Measurement itself is a science. The smaller the value, the higher the confidence

which

First article:

This means that the data sent to any segment (0.0.0.0) is sent to a default gateway via the native interface 222.20.109.61 (native IP): 222.20.109.254 (native Gateway), which has an administrative distance of 1, Management distance refers to the credibility of the information in the path selection process, the smaller the management distance, the higher the credibility . If the active point is lower, it means that the route is forwarded first.

  

Represents a packet from its own host (222.20.109.61 native IP) sent to its own host, if the use of the IP address of its own host, and the use of loopback address the same effect, through the same path is routed, that is, if I have their own site, I want to browse their site, The input localhost in the IE geology column is the same as 222.20.109.61, although localhost is parsed to be 127.0.0.1.

  

As can be seen from the above: At present, the host has 3 network segment LAN:

(1) 192.168.134.* lan A (NAT LAN) VMNET8 ( LAN interface , i.e. Gateway )

(2) 192.168.150.* LAN B (hostonly LAN)

(3) 192.168.191.* wireless Internet access (WiFi)

(4) 127.*.*.* the machine

(5) 222.20.109.* Local area network sitting on the machine

To view the IP of the virtual network card in the host host

Here the destination address is a local broadcast address , the system to such a packet processing method is the native (222.20.109.61 native IP, that is, on the link ) as the gateway, send ( corresponding network segment ) local broadcast frame, this frame will be filtered by the router.

This frame will not be filtered and will only be forwarded to the branch network (broadcast) for the external network filtering.

Key explanations:

The machine in the virtual machine has two Linux systems, all using the network of NAT, the virtual network card VMnet8, is to access the LAN interface (192.168.134.1). Therefore, the routing table in the host host forwards the broadcast address (192.168.134.255) of this virtual network (192.168.134.*) to the interfaces in this network.

The other same.

  

So, what about the network information of the Linux hosts in the virtual network:

Ifconfig: Query the LAN host IP, as well as the LAN subnet mask and LAN broadcast.

  

Route: The gateway to the virtual local area network (192.168.134.2), which is the virtual VMNET8 IP address (virtual network card).

  

 Basic network methods for setting up Linux

(1) Configuring DNS
Vi/etc/resolv.conf

Dnsnameserver 192.168.0.1

  

The virtual NIC VMnet8 also acts as a

DHCP Dynamic IP Assignment server

Domain name resolution DNS server (NAT mode auto set)

(2) Configure the Gateway:

Vi/etc/sysconfig/network
Join:
gateway=192.168.134.1

(3) Configure IP Address:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device="eth0"HWADDR="00:0c:29:6c:bb:e6"nm_controlled="Yes"Onboot="No"NETMASK=255.255.255.0ipaddr=192.168.0.8GATEWAY=192.168.0.1Bootproto=StaticOnboot=Yespeerdns=yes

(4) Restart the network service:
/etc/init.d/network restart
or use the command:
Service Network restart
Or:
Ifdown eth0 and Ifup eth0

Summarize:

1. IP Assignment for the network segment 192.168.134.* of the NAT architecture LAN

  

IP Assignment for the network segment 192.168.134.* of a NAT architecture lan

192.168.134.0: Network identification for this LAN (occupied, not allocated)

192.168.134.1: VMnet8 's network card address

  General (experience) the first available IP from all IP in this network segment as local area network (gateway, or external network interface)

(1) This LAN gateway, network interface (router IP, or subnet hub IP), can be seen from the "host host" routing table;

  

(2) Dynamic IP allocation server, DHCP server, can be seen from the VMware settings;

  

192.168.134.2: DNS server address for this LAN

(1) DHCP server address of internal LAN view:vi/etc/resolv.conf

Because of the use of the DHCP server, so all hosts in this LAN do not need to set (IP, subnet mask, default gateway)

Automatic provisioning is the use of a DHCP server to automatically assign IP addresses, subnet masks, and default gateways to computers in your network. The advantage of this is that once the default gateway for the network changes , all computers in the network get the IP address of the new default gateway as long as the settings for the default gateway in the DHCP server are changed. This method is suitable for networks with large network size and possible changes of TCP/IP parameters.

  

(2) Internal NAT server address, as seen from VMware's settings.

(3) Internal LAN gateway, which is inferred from the routing table of LAN internal host

  

The general default is the IP that is not recognized by the intranet, that is, the general use of 0.0.0.0 (all unrecognized network IP), that is, these IP are access to the outside network.

192.168.134.255: Broadcast address of this LAN(occupied, not allocated)

2. NAT Architecture lan 192.168.134.2 intranet IP role, and NAT architecture network schematic diagram of the rationality analysis

NAT schema schematic :

(1) The "host host" communicates with the internal LAN through the virtual network card VMnet8 (192.168.134.1) .

  From the host host's routing table, the analysis is justified.

(2) The host in the internal LAN and the "host host" communication, in fact, or with the help of VMnet8(192.168.134.1) communication, but this is also the intranet communication, so in the routing table through the default gateway * can be included. In fact, this intranet gateway is (192.168.134.1). through the intranet host routing table proves that This is the internal network analysis is reasonable.

(3) The host in the internal LAN and the "Outside network" communication, is the use of the NAT principle to achieve, that is, the intranet of any one host independent, also includes through the VMNET8, and host host communication.

This NAT server's IP is (192.168.134.2), can be equivalent to "External network gateway, network Interface". Only NAT network address translation processing, "Convert" is the host host's IP, and then access "Extranet"

Therefore, in the intranet host's routing table, you can see all other external IP access through default (192.168.134.1)NAT network address server address, post-conversion access, can be proved through the Intranet host routing table, and Proof of VMware's setup.

3. the application of the route command (dual network card, the strange computer static road table to achieve simultaneous access to the internal and external network)

Advantages:

Principle: Through the different IP according to the corresponding network interface (gateway) shunt forwarding, that is, the intranet and the external network is different network segment, need to access different network segment IP, must be forwarded to the corresponding network interface.

The network IP configuration of the computer does not change, two network cards are configured according to the normal configuration (both IP address, subnet mask, Gateway,).

By setting up different networks through different gateways, we can achieve normal internal and external network access.

(1) Delete the default route

Route Delete 0.0.0.0

Note: Remove all 0.0.0.0 routes, this is the default access to the external network routing

(2) Adding static routes

( Assuming that the intranet segment is 192.168.10.x, the gateway is 192.168.10.1;

External network segment is 192.168.20.x, Gateway is 192.168.20.1)

Configure the intranet static route First:

Route add 192.168.10.0 Mask 255.255.255.0 192.168.10.1 -P

Note: It means that all data accessing the 192.168.10.0 network segment is passed through the intranet gateway 192.168.10.1, and-p means permanently added, and still valid after reboot

In configuring the extranet static route :

Route add 0.0.0.0 Mask 0.0.0.0 192.168.20.1 -P

Note: It means that you can sisu the network, access all the data to go through the extranet gateway 192.168.20.1,-p for permanent addition, after the restart is still valid.

(3) After the set up, but also to see if the routing table has been modified.

You can display the local routing table by entering the route print in the command window.

For the method of permanent route modification:

Note: This method is suitable for multiple network cards, such as three net card, four card, etc.

Action: You need to disable the network card, and then enable, then we set the static route will be lost . This method can be used if we want to clear the static route.

As can be seen, the host host, through the routing table, the 5 different network segments of the IP corresponding shunt to the response of the "Network segment Interface"

4. Understanding of Gateways

Gateways (Gateway) are also known as inter-network connectors, protocol converters. The gateway realizes network interconnection above the network layer, is the most complex network interconnection device, only for two high-level protocol different network interconnection. Gateways can be used for both WAN interconnection and LAN interconnection. A gateway is a computer system or device that acts as a transformation task. A gateway is a translator that uses a different communication protocol, data format, or language, or even between two systems that have a completely different architecture. Unlike bridges, which simply convey information, the Gateway will repackage the information received to suit the needs of the intended system.

About the gateway say the points:

(1) The Gateway has two identities: internal LAN has an inside IP, external IP (external can be regarded as a public IP network);

(2) gateways, which are not equivalent to called network interfaces, are different concepts:

Gateway: Refers to the Intranet in all needs to access the external IP, all need to pass through this gateway, connected with the outside world. And the outside must go through this port, into the internal network. These two are often not the same address. all the IP in a network segment, there is only one gateway, but there are a lot of "network Interfaces".

Network interface: Generally select the first IP segment of the network as an intranet network segment of all the IP gateway (usually the end is 1, level 192.168.134.1), which is the network interface of the intranet. That is, in this routing table, all IP sent to this network segment is entered into this network segment through this "NET interface". The concept of a general network interface only appears in the "Routing table", and the "network interface" of different network segments in different routing tables must be different.

(3) The default gateway must be the IP address in the computer's own network segment, not the IP address in other network segments

The default gateway, which is all IP that accesses the extranet, is removed by forwarding it to this "gateway".

View current host's: Default gateway, and IP's Universal method:

C:\>route print will have a route: 0.0.0.0 0.0.0.0Default gateway IP interface (machine IP) hop count

Endl

Virtual Machine Network Understanding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.