Configure SDN network experiment platform using virtual machine (virtual box+Ubuntu+jdk configuration+mininet+floodlight/openDaylight)

Steps to install Virtual Box

         As for VMware, of course it is also possible, both are virtual machine software. However, VMware's installation files are very large and the installation is relatively troublesome, while the virtual box installation process is in Chinese. The installation is quick and convenient, and it is more suitable for novices to learn and use.

         Installation process:

  1. Download the virtual box installation program, and download the corresponding version from the official website, such as the windows version.
  2. The installation process is basically fool-like operation. Just follow the prompts and install by default. Of course, you can also modify the installation location.

I won't repeat the installation process of the virtual box here.

2. Ubuntu installation steps in a virtual machine

         1. Click New, set the name of the virtual machine mininet, location, and version, etc. Since I installed a 64-bit Ubuntu system, I chose Linux and 64bit. After the configuration is complete, click Next.

 

         2. Allocate running memory. Generally speaking, 2G is enough. Click Next after configuration.

 

         3. Create a virtual hard disk, select VDI disk image, and then select dynamic allocation, 20G is fine, click create after configuration.

 

  

 

 

         4. In this step, you need to use the Ubuntu image you just downloaded, click Save, select the main channel of the second IDE controller, and then select the Ubuntu image file you just downloaded, and click OK after the configuration is complete.

 

 

         5. Click Start to start the installation process, select simplified Chinese, if other languages ​​are easy for you, then there is no problem at all, then choose to install Ubuntu, select the American keyboard for the keyboard mode, and continue after the configuration is complete.

 

 

         6. According to personal habits, you can choose normal installation or minimal installation, but the smallest window is in the command line mode. If the level is good, the command line mode is full of mystery. I am a novice so I chose the normal installation , Then click Continue.

         7. In this step, you need to configure the partition of the system. Choose other options. Of course, you can choose the first one. According to your personal configuration needs, create a swap partition and a / partition, as shown in the figure and select the size and click Next. .

 

 

Note: When installing the Linux system, due to the difference in the resolution of the virtual machine and the local machine, the interface may be displayed incompletely and the operation buttons such as the next step cannot be seen. At this time, you can use ctrl+left mouse button to drag or win+mouse left button Drag to show the rest.

When the keyboard is locked in the virtual box, you can click ctrl on the right to unlock it.

8. Time zone selection. Of course, we choose Beijing time, which is the East 8th district. Maybe choose another time, such as US time. After the configuration is complete, click Continue.

 

         9. In this step, we configure the user name and password, and the password is 123456. It does not need to be too complicated and brings a series of troubles. After the configuration is completed, click Install.

         10. At this point, congratulations, you are close to success. Let’s take a break at this time, because it may take up to 10 minutes. After the installation is successful, it will remind you to restart. At this time, restart is fine. Wait a while, the linux system is installed successfully, and the installation of a virtual machine of Ubuntu is completed.

 

3. Build an SDN network experiment platform in the Ubuntu environment

         1. First, according to step 2, install two Ubuntu operating systems on the virtual machine, one named mininet for installing the mininet network emulator, and the other named FloodLight/openDaylight for installing the FloodLight/openDaylight controller.

         2. Configure the virtual machine network, realize the network communication between the host and the virtual machine, and do a ping test. First, after starting the virtual machine, we enter the command line mode (ctrl+shift+t) and enter ifconfig, we can see the virtual machine network before configuring the network. Then close the virtual machine system, configure it in the virtual box, click Settings—>Network—>Connection mode is NAT—>Select network card 2—>Connection mode is host-only network—>OK.

         3. After restarting the Ubuntu system, enter ipconfig in the Windows command line mode to view the local ip and virtual machine ip, you can see the local ip address 10.50.157.192, the virtual machine ip is 192.168.56.1, be careful, I am connected to a wireless network, so the local address depends on the wireless LAN adapter. If you use a network cable, it depends on the Ethernet adapter.

         4. Next, let's see if we can communicate with the virtual machine under the command line, let's ping it. Looking at the picture, there is a reply, which proves that the network is normal.

         5. Then, in the command line mode of Ubuntu, enter ifconfig to view the IP network configuration of the virtual machine. You can find that the virtual machine has two network cards at this time, indicating that the virtual machine's network card 2 is successfully configured. Note that if you enter the ifconfig command, the system does not recognize this command, so we need to install it. Use sudo apt install net-tools on the command line.

 

         6. Next, in the command line mode of the virtual machine system, check whether the virtual machine system can communicate with the Windows host, and ping it under the command line. It can be found that the win host has a reply. At this step, the virtual network configuration between the host and the virtual machine is successful.

 

Fourth, install the mininet source code locally on the mininet virtual machine

         1. First, you need to install git, copy mininet on GitHub, and use the command sudo spt-get install git in the command line mode of Ubuntu.

         2. Get the source code on GitHub, command git clone git://guthub.com/mininet/mininet.

         3. After obtaining the source code successfully, install mininet on the virtual machine, command mininet/util/install.sh -nfv.

4. After the installation is successful, verify whether openvswitch-controller is running. If it is running, stop it to ensure that Mininet can specify its own controller when it starts.

5. To test whether the mininet is installed successfully, enter the command sudo mn --test pingall in the Ubuntu command line.

 

Five, install jdk and configure Java environment variables on the virtual machine

(Refer to https://jingyan.baidu.com/article/25648fc1797a649191fd00ca.html )

         1. Because the use of floodlight or openDaylight needs to configure jdk and Java environment variables in advance, so the first step we need to configure Java environment variables in the Linux system. First, we need to download jdk, enter sudo apt-get install openjdk-8-jdk in the command line.

  

         2. Configure the environment variables JAVA_HOME and PATH, use the command sudo gedit /etc/environment to configure the environment in the text, and save it after the configuration is completed. Use the command source /etc/environment to make the environment effective, and then you can view the environment, enter the command cat /etc/environment.

 

 

3. When the virtual machine system is closed, the configured environment variables may be invalid when opened again, so configure the environment variables of all users, use the command to open the text sudo gedit /etc/profile , and add the code shown in the screenshot at the end of the text. Save it after adding it, execute the global setting command source /etc/profile on the command line to take effect immediately .

  

         4. After the above operations are completed, restart the Ubuntu system and enter the command java -version on the command line to check whether the environment variables are configured successfully.

 

6. Install the floodlight controller on the virtual machine

1. Install ant first, enter the command sudo apt-get install ant on the command line. (Apache Ant is a tool that automates software compilation, testing, deployment and other steps. It is mostly used for software development in the daoJava environment.)

 

2. Install git first, get floodlight from it, and enter the command sudo apt-get install build-essentialpython-dev in the command line. After execution, install git and enter the command sudo apt-get install git on the command line.

 

 


       3. Install curl, execute the command sudo apt-get install curl on the command line.

 

4. Clone floodlight from github, enter the command git clone git://github.com/floodlight/floodlight.git, after the download and installation is complete, enter floodlight, enter the command cd floodlight, and finally verify ant. A series of errors may be found, and then download and install the thrift package according to the prompts.

 

 

  

5. Run floodlight. After the installation is successful (provided that the jdk is installed and the Java environment variables are successfully configured), execute the command java -jar target/floodlight.jar, and you can see a series of output at this time, indicating that the operation was successful.

Seven, install the openDaylight controller on the virtual machine

1. Download openDaylight at https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.6.4-Carbon/distribution-karaf-0.6.4-Carbon.tar .gz.

       2. After the download is complete, move the compressed package to the /usr/local/openDaylight directory. Of course, permission is required to move. First, we enter the command sudo nautilus. At this time, we see that the system enters a file management with permissions, and you can enter it now Create folders and move files.       

         3. It is necessary to decompress the downloaded openDaylight installation package. We can first confirm whether there is an installation package in the folder, enter the command cd /usr/local/openDaylight, then we will enter this folder and enter it on the command line Command ls, you can view all files in this directory. Since our compressed package suffix is ​​tar, enter the command sudo tar -xvf distribution-karaf-*.tar.gz to decompress.

         4. After the decompression is complete, we enter the decompressed directory and enter the command cd distribution-karaf-0.6.4-Carbon. Then enter the command sudo gedit etc/org.apache.karaf.management.cfg to modify the ip in the file to 127.0.0.1, which is convenient for testing and using this machine.

         5. Next, openDaylight needs to be executed, but the execution requires root privileges, otherwise it will prompt that the privileges are not enough, then we need to enter root, but if the root password is not set before, it is impossible to enter, enter the command sudo passwd root, set the password, pay attention to Linux The password entered by the system will not be displayed on the screen. After the password is modified, we can enter the root user, enter the command su root (note: su is used to switch users, or su user name, switch existing users), and then enter the password to enter the root user, pay attention to root There is a clear sign difference between users and ordinary users $ and #.

         6. To execute openDaylight, first cd to the directory where openDaylight is installed, and then enter the command ./bin/karaf to execute openDaylight. The following figure indicates successful execution.

         7. Install various plug-ins used by openDaylight.

8. Start mininet , set the remote controller, and view the topology map in openDaylight

1. Startup Start openDaylight in the openDaylight virtual machine. For specific operations, first enter the root user, and then cd to the openDaylight directory, as shown in section 7 Startup steps.

2. Open the mininet virtual machine and start the mininet. Since root permissions are required to set topo, we first enter root, and then build a custom topology, enter the command mn--topo single, 3--controller=remote, ip=192.168.56.105 , Port=6633--switch ovsk, protocols=OpenFlow13. Then enter the command pingall to check the connection.

         3. Enter the openDaylight virtual machine and check the network topology through the OpenDayLight controller; the IP of the running opendaylight virtual machine is 192.168.56.105, and the port of opendaylight is 8181. Visit through the browser: http://192.168.56.105:8181/ index.html , the user name and password are both admin.

 

Guess you like

Origin blog.csdn.net/weixin_40042248/article/details/108692498