So, everything worked on Windows. I configured NAT and port forwarding and tried to connect to 127.0.0.1. The connection was redirected to the virtual machine. But on Linux host port forwarding does not work. Virtual Machine Configuration File:
Code: Select all
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.14-linux">
<Machine uuid="{cc6cf85b-e2b2-4a73-ba9b-c6cb3e7327d8}" name="W7SE" OSType="Windows7_64" snapshotFolder="Snapshots" lastStateChange="2018-09-16T11:49:02Z">
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{ffea4469-1347-4585-ad6b-54657e8376a0}" location="W7SE.vdi" format="VDI" type="Normal"/>
</HardDisks>
<DVDImages>
<Image uuid="{148649ec-5f66-4b4e-88fa-3e2447903054}" location="G:/Архивы/OS/Win7.SP1.x86-x64.Rus-Eng.18in1.Activated.v5/ru-en_win7_sp1_x86-x64_18in1_activated_v5.iso"/>
</DVDImages>
</MediaRegistry>
<ExtraData>
<ExtraDataItem name="GUI/LastCloseAction" value="SaveState"/>
<ExtraDataItem name="GUI/LastGuestSizeHint" value="800,600"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition" value="374,142,1024,810"/>
</ExtraData>
<Hardware>
<CPU count="3">
<PAE enabled="false"/>
<LongMode enabled="true"/>
<HardwareVirtExLargePages enabled="true"/>
</CPU>
<Memory RAMSize="3072"/>
<HID Pointing="USBTablet"/>
<Display VRAMSize="27"/>
<RemoteDisplay enabled="false"/>
<BIOS>
<IOAPIC enabled="true"/>
</BIOS>
<USB>
<Controllers>
<Controller name="OHCI" type="OHCI"/>
</Controllers>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="080027261A0C" cable="true" type="82540EM">
<DisabledModes>
<InternalNetwork name="intnet"/>
<NATNetwork name="NatNetwork"/>
</DisabledModes>
<BridgedInterface name="ens5f5"/>
</Adapter>
<Adapter slot="1" enabled="true" MACAddress="080027D37A0F" cable="true" type="82540EM">
<DisabledModes>
<BridgedInterface name="ens5f5"/>
<InternalNetwork name="intnet"/>
<NATNetwork name="NatNetwork"/>
</DisabledModes>
<NAT>
<Forwarding name="RD0" proto="0" hostport="3389" guestport="3389"/>
<Forwarding name="RD1" proto="1" hostport="3389" guestport="3389"/>
<Forwarding name="SE" proto="0" hostport="27016" guestport="27016"/>
</NAT>
</Adapter>
<Adapter slot="2" MACAddress="0800274A4297" cable="true" type="82540EM"/>
<Adapter slot="3" MACAddress="08002736C16A" cable="true" type="82540EM"/>
<Adapter slot="4" MACAddress="0800272152AB" cable="true" type="82540EM"/>
<Adapter slot="5" MACAddress="080027E570C1" cable="true" type="82540EM"/>
<Adapter slot="6" MACAddress="080027612942" cable="true" type="82540EM"/>
<Adapter slot="7" MACAddress="08002765C84F" cable="true" type="82540EM"/>
</Network>
<LPT>
<Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
</LPT>
<AudioAdapter controller="HDA" driver="ALSA" enabled="true"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="ru_RU" timestamp="1536078602316540500" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice passthrough="false" type="DVD" port="1" device="0"/>
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" port="0" device="0">
<Image uuid="{ffea4469-1347-4585-ad6b-54657e8376a0}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</Machine>
</VirtualBox>
In network connections, a second network interface appeared. How do I know if port forwarding works?
...
netstat -nap | grep VBox output:
Code: Select all
tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 3341/VBoxHeadless
tcp 0 0 10.10.10.101:49666 2.19.120.26:443 ESTABLISHED 3341/VBoxHeadless
udp 0 0 0.0.0.0:35193 0.0.0.0:* 3341/VBoxHeadless
udp 0 0 0.0.0.0:27016 0.0.0.0:* 3341/VBoxHeadless
udp 0 0 0.0.0.0:46135 0.0.0.0:* 3341/VBoxHeadless
udp 0 0 0.0.0.0:3389 0.0.0.0:* 3341/VBoxHeadless
udp 0 0 0.0.0.0:54818 0.0.0.0:* 3341/VBoxHeadless
udp 0 0 0.0.0.0:34377 0.0.0.0:* 3341/VBoxHeadless
raw 0 0 0.0.0.0:1 0.0.0.0:* 7 3341/VBoxHeadless
Yes! I did it! Just turned off the CentOS firewall. Thank you all for your help!