Tuesday, October 27, 2020

Configure Mikrotik Vmware

Sometimes it is required to install Mikrotik Router OS in the VMware Workstation. Generally, students are doing this to learn about the Mikrotik Router OS. But in the virtual environment most of the time we are getting problems connecting to the internet from the Mikrotik router. The problem arises during configuring the NAT function or routing function. It does not work as our expectation. 

In this tutorial, we are going to discuss how to configure internet access for the Mikrotik WAN interface in the VMware Workstation. We are also going to discuss what will be the hardware settings for the Mikrotik router in the VMware Workstation application. What network settings we will use in the VMware Workstation for the Mikrotik Router so that the Mikrotik router can perform the NAT functions.

First of all, to share the internet with the Mikrotik Router we have to enable the ICS (Internet Connection Sharing) service in our host Windows Operating System. How to enable ICS (Internet Connection Sharing) service on the Windows Operating System is described below step by step.

Nowadays, sharing your desktop or laptop internet connection among others is a common practice. There are many third-party applications available, which can be used to share your internet connection with others. Microsoft Windows operating system has one built-in feature that can be used to share your internet connection among the full LAN network. This feature is called ICS (Internet Connection Sharing). 

To enable ICS on a system you must have two network adapters. One will be used to connect to the internet and the other one will be used to share your internet with LAN which will be directly connected with your local network device.

After enabling the ICS on a computer, this system will be performed as a DHCP server. The LAN adapter which is connected to the LAN switch will be the DHCP server interface. This interface will allocate the IP address to other LAN computers. Generally, the IP address range is 192.168.127.0/24.

If you want you can change this network. The other LAN computers should be set to "Automatic IP Address Configuration Mode".


Now we will be discussed how to enable ICS on a system.

First of all, we have to open the "Network & Internet Settings" (In Windows 10) or "Network & Sharing Center" (In Windows 7). We have multiple ways to open these settings. We can open it from the network icon or using the "Control Panel".

To open from the network icon just right click on it and click on the " Open Network & Sharing Center".


Now click on "Change adapter options".

For Windows 10


For Windows 7


Now you will be appeared by your available network interface card. We can access directly on this interface by using the command line. Please execute the below command in the "Run" program.


Right-click on your network adapter which is connected to the internet and go to "Properties". 


From there, go to the "Sharing" tab and click on "Allow other network users to connect through this computer's internet connection". And then select your network adapter from the dropdown list, which is connected to the LAN switch. This adapter will perform the routing function on behalf of LAN users. It takes all the internet requests from the users and will forward it to the network adapter which is connected to the internet.


In this example, we are using "Ethernet 2" as an adapter for connecting to the LAN, and our internet-connected network adapter is our Wifi network adapter. Means, we will share this wifi internet connection to our LAN users via the "Ethernet 2" network adapter. 

Finally, click on "OK" at the end of all configurations. Now you will be appeared by the below informational message. From there, we click on "Yes".


This message notified you that, your LAN adapter means "Ethernet 2" will be set by IP address 192.168.127.1 and this IP address will act as a gateway for your LAN users. And your LAN users IP address settings should be set by "Obtain an IP address automatically".


If the internet connection sharing process has completed successfully, then a "Shared" tag will be appeared on your internet-connected network adapter (in our case wifi adapter).


Now we will check our "Ethernet 2" network adapter whether it has changed the IP address to 192.168.137.1. 


Yes, we found that address has changed. One more thing is, here we have to set the DNS address.


And just for clarification, the IP address of our Wifi adapter which is connected to the internet is 10.16.16.11/24.


All work is done. From now on, all of our LAN users can connect to the internet using this network adapter. This 192.168.137.1 IP will be the gateway address for all LAN users. If you want you can change this network range as your preference.

Now we will discuss about the VMware Workstation configuration.

There are some hardware configurations required in the VMware Workstation to perform with the Mikrotik Internet connection. We need to enable two network adapter for our Mikrotik Router OS. One network adapter is required for WAN connection and the other one is required for LAN connection. In the VMware workstation, these network adapters should belong to the different virtual networks. 
The network adapter which intended connecting to the internet should be in the "Bridge" mode. The other one should be connected to the different ones like "VMnet2".


Here, The "Network Adapter" receives all traffic from the "Network Adapter 2" and will transfer it to the physical network. The "Network Adapter" IP address would be the same network range as the ICS server LAN interface IP address" which is 192.168.137.0/24. And for the "Network Adapter 2" you can use as your own preferences.
After the Mikrotik Router OS installation complete, now we will add the IP address in the Mikrtoitk Network interface card. For the "Network Adapter" card we will use 192.168.137.253/24 and for the "Network Adapter 2" card we will use 10.5.5.15/24.


Here, ether1 is representing the VMware "Network Adapter" card and ether2 is representing the "Network Adapter 2" interface card.

For sake of the Mikrotik router, ether1 is the public interface and the ether2 is the private interface. Now we have to configure NAT for our private interface.


Now we have to configure the DNS server address.


Now we are going to configure the default route.


Please notice that we are using our ICS server LAN interface IP address for our default gateway. Mikrotik receives all traffic from its clients using the ether2 interface and then it will perform NAT function. After the NAT all internet traffic will route to the ICS server LAN interface using the ether1 network adapter.

At this time your virtual Mikrotik router should connect to the internet using VMware host machine internet connectivity.
    

No comments:

Post a Comment