vmware builds openwrt to realize windows host computer to connect to openwrt Internet

 

Recently I have nothing to do and want to study openwrt, so I tried to build one for fun. Of course, this is not in the form of source code compilation, which is too time-consuming.

    First download the existing system image from the official website, the path is as follows:

    https://archive.openwrt.org/chaos_calmer/15.05.1/x86/generic/ 

    Then find the combined-ext4.img.gz  image, download it, unzip it, and get an .img file:

    

    I won’t talk about vmware installation, please refer to my other blog.

    Since the .img file cannot be used directly by vmware and needs to be converted to vmdk format, then the qemu-img tool needs to be used.

    Use directly under ubuntu:    

sudo  apt-get  install  qemu-utils  -y

    After installation, use the following command to generate a file in .vmdk format: 

sudo qemu-img convert -f raw openwrt-15.05.1-x86-generic-combined-ext4.img -O vmdk openwrt-15.05.1-x86-generic-combined-ext4.vmdk

      
  After the preparation is complete, start to build the openwrt environment.

   Open vmware and select Create a New Virtual Machine. 

   1. Select "Custom (advanced)" in Virtual Machine Configuration:

   

  2. Click Next, just keep the default Virtual Machine Hardware Compatibility:

  

  3. Continue to the next step, select "I will install the operating system later." in install operating system from:

  

   4. Continue to the next step, select "Linux" in Guest Operating System, and select "Other Linux 3.x kernel" in Version:

   

    5. Continue to the next step. Set the virtual machine name in Virtual Machine Name. This is just arbitrarily named. Set it to openwrt-15.05. If the path is set to the path you actually want to save, it is /home/ ballack/vmware/openwrt-15.05/:

    0

    6. Proceed to the next step, and the Processors and Memory remain unchanged.

    

    

   7. Continue to the next step, Network Connection select "Use bridged networking", most of the Internet here say that it is set to "Use network address translation (NAT)", but I can't ping the host after testing, and I will study later when I have time , Mark it first! !

    

   8. Continue to the next step and keep the default I/O Controller Types:

   

   9. Continue to the next step. Select IDE for Virtual Disk Type. IDE must be selected here, otherwise the partition will not be found during startup! ! !

    

    10, continue to the next step, Disk select "Create a new Virtual Disk": 

    

    11. Continue to the next step, the Disk Size remains unchanged: 

        

 

    12, continue to the next step, just keep Disk File unchanged:

    

    13, continue to the next step, select Customize Hardware: 

    
   

    14. Delete New CD/DVD (IDE), Sound Card, Printer, and USB Controller, then close and exit.

    

  15. Click Finish and you will see the following interface, indicating that the creation is successful:

   

   After finishing the above steps, don’t rush to start,

Need to replace the existing vm disk file with the converted openwrt-15.05.1-x86-generic-combined-ext4.vmdk 

method 1:

First copy the openwrt-15.05.1-x86-generic-combined-ext4.vmdk file converted with the qemu-img tool to the working directory of the newly created openwrt virtual machine:

cp  openwrt-15.05.1-x86-generic-combined-ext4.vmdk   /home/ballack/vmware/openwrt-15.05

  Enter the working directory of the openwrt virtual machine and view the file through the ls command:

cd  /home/ballack/vmware/openwrt-15.05

 

vim  openwrt-15.05.vmx  

  Change setting:

  Change ide1:1.fileName = "openwrt-15.05.vmdk" to:

  ide1:1.fileName = "openwrt-15.05.1-x86-generic-combined-ext4.vmdk"  

  Save and exit! !

Method 2:

First rename the openwrt-15.05.1-x86-generic-combined-ext4.vmdk file converted with the qemu-img tool to openwrt-15.05.vmdk, copy the openwrt virtual machine working directory and overwrite the original file

 

After completing Method 1 or Method 2

 Start openwrt:

    

  This starts successfully! ! !

  However, you will find that the host cannot access openwrt through the web page. Here you only need to modify the /etc/config/network file:

  

   You can see that the ipaddr of lan0 is 192.168.1.1. Since the ip of my host is 192.168.1.142, and the gateway of the router is also 192.168.1.1, it is impossible to access openwrt. Here, modify the lan0 ipaddr to 192.168.1.4. Make sure that The hosts are on the same network segment. 

   The revised version is as follows:

    

   Then save, exit, and execute /etc/init.d/network restart to restart the service. 

   Then the host pings 192.168.1.4, it can be pinged: 

   

   Then open the browser and enter 192.168.1.4, you can see the normal access:

   

 

 Click Login directly, the interface will prompt you to set a password:

 

 After setting the password, click Save & Apply directly.

 After logging in with the root account and the password you just set, you can see the real openwrt interface:

    

Modify host internet settings

Insert picture description here
Insert picture description here
Insert picture description here
 

 

 

Guess you like

Origin blog.csdn.net/whatday/article/details/113783704