-->

Saturday, February 16, 2019

VMware Workstation Pro 15] 10. Creating a virtual machine that acts as a router (vRouter)

Hello, guys. You will figure out how to create a virtual machine(VM) that acts as a router (vRouter) in this post. When you finish this practice, you will be able to easily create a virtual router in a virtualized environment.

Creating a virtual machine that acts as a router

Unfortunately, VMware Workstation Pro does not support virtual router functionality. So if you want to make a connection between different networks, you have to create a VM to use as a router. Set up the virtual network as shown below.



If you don't know how to create a virtual network, please refer to the post below.

https://sunguruitchannel01.blogspot.com/2019/02/vmware-workstation-pro-15-9-configuring.html

Create a new VM with the following spec:

Virtual machine name: Router01
Hardware compatibility: Workstation 10.x
Guest operating system: Linux/CentOS 7 64-bit
Processors: 1 Socket/1 Cores
Memory: 420 MB
Network connection 1: VMnet0
Network connection 2: VMnet1
Network connection 3: VMnet4
Network connection 4: VMnet5
I/O controller types: LSI Logic
Virtual disk type : SCSI
Disk: 10 GB
Display: Uncheck Accelerate 3D graphics

When you install CentOS 7.6, set the SOFTWARE SELECTION to Minimal Install as shown below.


If you don't know how to install CentOS 7.6, please refer to the post below.

https://sunguruitchannel01.blogspot.com/2019/02/vmware-workstation-pro-15-8-installing.html

Configuring CentOS 7.6

The network connectivity diagram is shown below.


To make CentOS 7.6 work as a router, run the following commands:

[root@router01 ~]# sed -i '/^SELINUX\>/s/enforcing/permissive/' /etc/selinux/config
[root@router01 ~]# sed -n '/^SELINUX\>/p' /etc/selinux/config
[root@router01 ~]# setenforce permissive
[root@router01 ~]# getenforce
[root@router01 ~]# sysctl net.ipv4.ip_forward
[root@router01 ~]# sysctl -w net.ipv4.ip_forward=1
[root@router01 ~]# sed -i '$ a\net.ipv4.ip_forward = 1' /etc/sysctl.conf
[root@router01 ~]# systemctl disable sshd
[root@router01 ~]# systemctl stop sshd
[root@router01 ~]# systemctl stop firewalld
[root@router01 ~]# systemctl disable firewalld
[root@router01 ~]# nmtui

Run the nmtui command to assign the static IP addresses to the network adapters.




To apply the changed IP addresses, use Activate a connection as shown below. Press the Enter key twice to apply. :D


Now set up static routes on your IP Router. My thing is set as below.



Testing Router Operating

Let's see if the virtual machine works well as a router. Run the following commands to install Apache HTTPD on your CentOS76 VM.

[root@centos76 ~]# yum -y install httpd
[root@centos76 ~]# firewall-cmd --permanent --add-service=http
[root@centos76 ~]# systemctl enable httpd
[root@centos76 ~]# systemctl start httpd
[root@centos76 ~]# ip addr show dev ens32 | grep 'inet\>'

    inet 192.168.5.10/24 brd 192.168.5.255 scope global noprefixroute ens32

Connect the CentOS76 VM to VMnet5.


From your host operating system, open a web browser to access the web server. Then enter the IP address of CentOS76 VM. If it appears as shown in the figure below, it is a success.


You have acquired the skill to create a VM that acts as a router. I encourage you to practice a few more times to become proficient. It will be very useful in the long journey ahead. In the next post, you will find out how to create a router. See you next. Thank you.




3 comments:

  1. Safety awareness is vital in any construction website. It is the key to controlling accidents. Health and safety is the central factor for all of the industries so as to encourage the wellness of both employees and employers.

    ReplyDelete
  2. Great article! So, we're going to put a link to this great article on our Keep writing page.
    VMware Workstation Pro

    ReplyDelete