SecureCRT using a remote connection tools linux system
// original reference and quote: "vm virtual machine Detailed three network modes: https: //www.cnblogs.com/linjiaxin/p/6476480.html"
1. Preparation Tool
- Virtual Software: Vmware Workstation 11.0
- Linux systems: RedHat Enterprise Linux 7.0
- Remote Tools: secureCRT 7.3.6
2. VM virtual network software works
2-1 VM three network modes
Bridging, NAT, hostonly
Corresponding on the host have VMware Network Adapter VMnet1 and VMware Network Adapter VMnet8 two virtual NICs
There are three virtual network (VM software in virtual switch ): VMnet0 , VMnet1 , VMnet8
// Since VMnet0 use bridge mode, corresponding to a host in the network configuration of the network card visible presence VMnet0
2-2 bridged mode (Bridged)
Bridge mode is to host NIC (real card) and VM software virtual switch 0 (VMnet0) communicate using virtual bridge. Under the action of the bridge, the physical host is similar to a virtual switch, bridging all virtual machines provided on an interface connected to the switch, the physical host is also inserted in the switch which, in the card so that card and the bridge are all exchange mode, you can access without interfering with each other. In bridge mode, the virtual machine and the host ip address needs to be in the same network segment , if you need a network, gateway and DNS needs to be consistent with the host card
- Bridge mode network implementation
- In VM "Edit virtual machine settings" experimental virtual machine network is set to "bridge mode"
- Before entering the system, make sure the ip address of the host real card, gateway, DNS and other information.
-
Enter the virtual machine linux system to edit card (eno16777728) Information
[root@cricket-server Desktop]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
TYPE=Ethernet
BOOTPROTO=static
NAME=eno16777728
UUID=d86ad442-6fd5-4470-9e07-5ad58525255e
ONBOOT=yes
HWADDR=00:0C:29:DC:14:31
IPADDR = 192.168.43.202 // set the virtual machine and the host with the IP network segment
NETMASK = 255.255.255.0 // Set the subnet mask
GATEWAY = 192.168.43.1 // Set gateway
DNS1 = 192.168.43.1 // dns settings
- Restart card
[root@cricket-server Desktop]# systemctl restart network
- View Card running information
[root@cricket-server Desktop]# ifconfig
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.202 netmask 255.255.255.0 broadcast 192.168.43.255 // NIC consistent information
inet6 fe80::20c:29ff:fedc:1431 prefixlen 64 scopeid 0x20<link>
inet6 240e:2a:17f1:698c:20c:29ff:fedc:1431 prefixlen 64 scopeid 0x0<global>
ether 00:0c:29:dc:14:31 txqueuelen 1000 (Ethernet)
RX packets 140 bytes 16469 (16.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 166 bytes 19324 (18.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
.................. .................. omitted during the rest of the card
-
Testing Network Connectivity
Use the ping command to ping outside the network ip, test whether networking
[root@cricket-server Desktop]# ping www.baidu.com
PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.
64 bytes from 220.181.112.244: icmp_seq=1 ttl=52 time=45.0 ms
64 bytes from 220.181.112.244: icmp_seq=2 ttl=52 time=55.0 ms
64 bytes from 220.181.112.244: icmp_seq=3 ttl=52 time=46.9 ms
64 bytes from 220.181.112.244: icmp_seq=4 ttl=52 time=42.9 ms
64 bytes from 220.181.112.244: icmp_seq=5 ttl=52 time=46.3 ms
64 bytes from 220.181.112.244: icmp_seq=6 ttl=52 time=44.0 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5008ms
rtt min/avg/max/mdev = 42.976/46.737/55.082/3.971 ms
-
Virtual machine software to connect a CRT
- Open the CRT software
- connection succeeded
2-3 NAT mode (address translation)
NAT is Network address translate (network address translation) for short
NAT mode switch is a virtual host (the VMnet8) (authentic card) and VM software for communication using the virtual NAT device, each piece of data packets are sent through the virtual machine virtual NAT devices ( surface not visible ) , then the NAT after forwarded to host NIC ( real card ) .
The virtual switch (the VMnet8) and an address segment in the virtual machine, the virtual machine and the host address in a different segment, the VM software virtual NAT device corresponding to the virtual machine gateway, and forwarded to the host via the route ( the real card ) in , the virtual machine is ping to the host the IP , but the host ping not the virtual machine the IP (NAT part of many to one, the virtual NAT device does not have an external access internal function ) , and therefore the use of CRT can not be connected to the terminal VM isochronous .
VMware Network Adapter VMnet8 action is: the communication between the host and the virtual machine the CRT and the like through the host terminal to access the virtual machine, but the VM software VMnet8 provided NAT gateway is unable to communicate through the host ( virtual NAT device does not have external access to internal functions )
- NAT mode networks
- In VM "Edit virtual machine settings" experimental virtual machine network is set to "NAT"
In VM "Virtual Network Editor" is set NAT parameters and custom parameters
- Enter the virtual machine linux system to edit card (eno16777728) Information
[root@cricket-server Desktop]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
TYPE=Ethernet
BOOTPROTO=static
NAME=eno16777728
UUID=d86ad442-6fd5-4470-9e07-5ad58525255e
ONBOOT=yes
HWADDR=00:0C:29:DC:14:31
IPADDR = 172.30.200.100 // set the virtual machine IP and NAT mode parameter is set to the same network segment
NETMASK=255.255.255.0
GATEWAY=172.30.200.1
DNS1 = 172.30.200.1
- Restart card
[root@cricket-server Desktop]# systemctl restart network
- View Card running information
[root@cricket-server Desktop]# ifconfig
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.30.200.100 netmask 255.255.255.0 broadcast 172.30.200.255
ether 00:0c:29:dc:14:31 txqueuelen 1000 (Ethernet)
RX packets 46 bytes 5304 (5.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 185 bytes 14976 (14.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
-
测试网络连通性
使用ping命令ping外网ip,测试能否联网
[root@cricket-server Desktop]# ping www.baidu.com //可以ping通百度
PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data.
64 bytes from 220.181.112.244: icmp_seq=1 ttl=128 time=63.1 ms
64 bytes from 220.181.112.244: icmp_seq=2 ttl=128 time=57.0 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 57.013/60.091/63.170/3.088 ms
[root@cricket-server Desktop]# ping 192.168.43.202 //可以ping通宿主机IP
PING 192.168.43.202 (192.168.43.202) 56(84) bytes of data.
64 bytes from 192.168.43.202: icmp_seq=1 ttl=128 time=5.96 ms
64 bytes from 192.168.43.202: icmp_seq=2 ttl=128 time=43.3 ms
^C
--- 192.168.43.202 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 5.968/24.636/43.304/18.668 ms
[root@cricket-server Desktop]# ping 172.30.200.1 //可以ping通NAT网关
PING 172.30.200.1 (172.30.200.1) 56(84) bytes of data.
64 bytes from 172.30.200.1: icmp_seq=1 ttl=128 time=0.158 ms
64 bytes from 172.30.200.1: icmp_seq=2 ttl=128 time=0.261 ms
^C
--- 172.30.200.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.158/0.209/0.261/0.053 ms
[root@cricket-server Desktop]# ping 172.30.240.254 //可以ping通VMnet8网卡(为了区别,VMnet8 IP 与NAT参数设置有别)
PING 172.30.240.254 (172.30.240.254) 56(84) bytes of data.
64 bytes from 172.30.240.254: icmp_seq=1 ttl=128 time=0.669 ms
64 bytes from 172.30.240.254: icmp_seq=2 ttl=128 time=0.475 ms
64 bytes from 172.30.240.254: icmp_seq=3 ttl=128 time=0.537 ms
^C
--- 172.30.240.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.475/0.560/0.669/0.083 ms
- 利用宿主机CMD或者powershell 反ping虚拟机和时不通
-
使用CRT软件连接虚拟机
- 修改宿主机VMnet8配置,确保宿主机VMnet8网卡网段与VM软件中VMnet8网络网段一致
- 利用宿主机CMD或者powershell ping虚拟机和NAT网关
- 打开CRT连接虚拟机
- 连接成功
2-4 仅主机模式(Host-Only)
Host-Only模式其实就是NAT模式去除了虚拟NAT设备,然后使用VMware Network Adapter VMnet1虚拟网卡连接VMnet1虚拟交换机来与虚拟机通信的,Host-Only模式将虚拟机与外网隔开,使得虚拟机成为一个独立的系统,只与主机相互通讯
- 在VM中"编辑虚拟机设置"将实验虚拟机网络设置为"Host-Only"
- 设置VM的"虚拟网络编辑器"(包括DHCP设置)
- 进入虚拟机linux系统中编辑网卡(eno16777728)信息
[root@cricket-server Desktop]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
- 重启网卡
[root@cricket-server Desktop]# systemctl restart network
- 查看网卡运行信息
[root@cricket-server Desktop]# ifconfig
使用ping命令ping外网宿主机网络(VMnet8),测试能否联网
[root@cricket-server Desktop]# ping 172.30.100.254 //可以ping通宿主机IP
PING 172.30.100.254 (172.30.100.254) 56(84) bytes of data.
64 bytes from 172.30.100.254: icmp_seq=1 ttl=128 time=0.388 ms
64 bytes from 172.30.100.254: icmp_seq=2 ttl=128 time=0.307 ms
^C
--- 172.30.100.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.307/0.347/0.388/0.044 ms
[root@cricket-server Desktop]# ping 192.168.43.201 //无法ping通宿主机真实IP
connect: Network is unreachable
[root@cricket-server Desktop]# ping www.baidu.com //无法ping百度
ping: unknown host www.baidu.com
- 使用CRT软件连接虚拟机
- 连接成功