Centos7 VM ustawia tryb mostu
Centos7 Vm Set Bridge Mode
1. Otwórz stronę ustawień maszyny wirtualnej i ustaw tryb mostu maszyny wirtualnej, jak pokazano na rysunku: Wybierz tryb mostu (opcjonalny w przypadku kopiowania fizycznego połączenia sieciowego)
Po drugie, skonfiguruj sieć maszyny wirtualnej VMware w trybie mostu
1. Wyświetl informacje o sieci hosta:
ipconfig /all Ethernet adapter Local connection: Connection specific DNS suffix......: Description..........: Realtek PCIe GBE Family Controller Physical address........: 44-37-E6-D2-D6-A5 DHCP is enabled.......: Yes Automatic configuration is enabled.......: Yes IPv4 address.........: 192.168.0.107 (preferred) Subnet mask.........: 255.255.255.0 Time to get the lease....... March 18, 2019 9:16:04 Time when the lease expires.......: March 20, 2019 5:38:07 Default Gateway........: 192.168.0.1 DHCP server.......: 192.168.0.1 DNS server.......: 192.168.0.1 192.168.0.1 NetBIOS over TCPIP....: Enabled
2. Skonfiguruj CentOS7, wprowadź odpowiednie informacje w hoście do odpowiedniej lokalizacji poniżej, statyczny adres IP, maska podsieci, domyślna brama, DNS
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 Explanation: The file ifcfg-eno16777736 may be different for everyone TYPE=Ethernet BOOTPROTO = static #Modify to static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 UUID=bf5337ab-c044-4af7-9143-12da0d493b89 DEVICE=eno16777736 ONBOOT = yes #Modify to yes PEERDNS=yes PEERROUTES=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPADDR = 192.168.0.200 # Customize the IP address of the virtual machine (the host is 192.168.0.107), which must be on the same network segment as the host NETMASK = 255.255.255.0 #Set the subnet mask, same as the host GETWAY = 192.168.0.1 #default gateway, same as host DNS1 = 192.168.0.1 #DNS, same as host IP address: Set the IP of the same network segment as the host NETMASK: The subnet mask is the same as the host GATEWAY: The default gateway is the same as the host DNS1: same as host
3. Dodaj adres bramy
vi /etc/sysconfig/network The contents are as follows: NETWORKING=yes HOSTNAME = xxxx #The name is random GATEWAY = 192.168.1.1 #The default gateway is the same as the host
4. Dodaj DNS
vi /etc/resolv.conf The contents are as follows: # Generated by NetworkManager nameserver 192.168.0.1 #DNS, same as host
5. Uruchom ponownie sieć
service network restart
3. Test
1. Dostęp intranetowy do własnego statycznego adresu IP
[root@xxxxx Desktop]# ping 192.168.0.200 PING 192.168.0.200 (192.168.0.200) 56(84) bytes of data. 64 bytes from 192.168.0.200: icmp_seq=1 ttl=64 time=0.036 ms 64 bytes from 192.168.0.200: icmp_seq=2 ttl=64 time=0.043 ms 64 bytes from 192.168.0.200: icmp_seq=3 ttl=64 time=0.047 ms 64 bytes from 192.168.0.200: icmp_seq=4 ttl=64 time=0.046 ms
2. Odwiedź sieć publiczną
[root@xxxxx Desktop]# ping www.baidu.com PING www.a.shifen.com (180.97.33.108) 56(84) bytes of data. 64 bytes from 180.97.33.108: icmp_seq=1 ttl=57 time=2.52 ms 64 bytes from 180.97.33.108: icmp_seq=2 ttl=57 time=2.04 ms 64 bytes from 180.97.33.108: icmp_seq=3 ttl=57 time=3.20 ms 64 bytes from 180.97.33.108: icmp_seq=4 ttl=57 time=2.20 ms 64 bytes from 180.97.33.108: icmp_seq=5 ttl=57 time=3.56 ms
3. Maszyna hosta uzyskuje dostęp do maszyny wirtualnej
C:UsersAdministratorDesktop ping 192.168.0.200 Ping 192.168.0.200 with 32 bytes of data: Reply from 192.168.0.200: byte = 32 time <1ms TTL = 64 Reply from 192.168.0.200: byte = 32 time <1ms TTL = 64 Reply from 192.168.0.200: byte = 32 time <1ms TTL = 64 Reply from 192.168.0.200: byte = 32 time <1ms TTL = 64 Ping statistics of 192.168.0.200: Packet: Sent = 4, Received = 4, Lost = 0 (0% lost), Estimated time of round trip (in milliseconds): Shortest = 0ms, Longest = 0ms, Average = 0ms
4. Host dostępu do maszyny wirtualnej
[root@xxxxx Desktop]# ping 192.168.0.107 PING 192.168.0.107 (192.168.0.107) 56(84) bytes of data. 64 bytes from 192.168.0.107: icmp_seq=1 ttl=128 time=0.487 ms 64 bytes from 192.168.0.107: icmp_seq=2 ttl=128 time=0.408 ms 64 bytes from 192.168.0.107: icmp_seq=3 ttl=128 time=0.394 ms 64 bytes from 192.168.0.107: icmp_seq=4 ttl=128 time=0.362 ms 64 bytes from 192.168.0.107: icmp_seq=5 ttl=128 time=0.401 ms 64 bytes from 192.168.0.107: icmp_seq=6 ttl=128 time=0.398 ms 64 bytes from 192.168.0.107: icmp_seq=7 ttl=128 time=0.434 ms ^C --- 192.168.0.107 ping statistics --- 7 packets transmitted, 7 received, 0% packet loss, time 6005ms rtt min/avg/max/mdev = 0.362/0.412/0.487/0.036 ms
Jeśli nie możesz pingować Internetu, może być konieczne wybranie następującej karty sieciowej:
Pasek menu VMware-> edycja-> edytor sieci wirtualnej
Przełącz się, spróbuj zaoszczędzić, Ten krok jest bardzo ważny. Jeśli na ekranie nie ma VMnet0, może to być spowodowane niewystarczającymi uprawnieniami. Kliknij Zmień ustawienia w prawym dolnym rogu.
Opis wirtualnej karty sieciowej VMware:
Typ sieci Nazwa karty sieciowej
Mostkowany VMnet0
NAT VMnet8
VMnet1 tylko dla hosta