If the lxde environment has been installed (30.1 Installing Mininet), then the chromium browser should be available. If this is run in the background somewhere, output should be redirected to /dev/null or else the server will eventually hang. Then run the following command (the 8000 is the server port number): python -m SimpleHTTPServer 8000 After switchline.py is running, start an xterm on host h4, and then change directory to /usr/share/doc (where there are some html files). Python includes a simple implementation that serves up the files in the directory in which it is started. Now let’s run a web server on, say, host 10.0.0.4 of the switchline.py example above. As this is the same file for all Mininet nodes, due to the common filesystem, a subsequent request to connect from h2 to h4 will succeed immediately h4 has already been authenticated for all nodes. The first time a connection is made from h1 to h4 (as root), ssh will ask for confirmation, and then store h4’s key in /root/.ssh/known_hosts. This will allow passwordless ssh connections between the different Mininet hosts.īecause we started sshd on each host, the command ssh 10.0.0.4 on h1 should successfully connect to h4. ssh directory and copy id_rsa.pub to the (new) file authorized_keys (if the latter file already exists, append id_rsa.pub to it). There is no need, in this setting, to protect the keys with a password. We must first run ssh-keygen, which creates the directory /root/.ssh and then the public and private key files, id_ rsa.pub and id_rsa respectively. Using sshd requires a small bit of configuration, if ssh for the root user has not been set up already. for i in range(1, N+1):įinally we start the Mininet CLI, and, when that exits, we stop the emulation. This command automatically puts itself in the background otherwise we would need to add an ‘&’ to the string to run the command in the background. The next bit starts /usr/sbin/sshd on each node. Net = Mininet(topo = ltopo, switch = OVSKernelSwitch, The autoSetMacs option sets the host MAC addresses to 00:00:00:00:00:01 through 00:00:00:00:00:04 (for N=4), which can be a great convenience when manually examining Ethernet addresses. It does matter that we’re using the DefaultController, as otherwise the switches will not behave automatically as Ethernet learning switches. We’ve specified the type of switch here, though at this point that does not really matter. ltopo = LineTopo(N=N)įinally we’re ready to create the Mininet net object, and start it. We also set the log-level to ‘info’ if we were having problems we would set it to ‘debug’. Next we create a LineTopo object, defined above. Parser.add_argument('-N', '-N', type=int) We use argparse to support the -N command-line argument. First we build the host-switch links, and then the switch-switch links.įor i in range(N): # Add links from hi to si Now we build the links, with Topo.addLink. ![]() Next we do the same to switches, using Topo. We immediately append the new host object to the list h. Method Topo.addHost() takes a string, such as “h2”, and builds a host object of that name. H = # list of hosts h will be h1, etcĪn Introduction to Computer Networks, Release 2.0.4 (We here override _ init()_, but overriding build() is actually more common.) The program starts by building the network topology object, LineTopo, extending the built-in Mininet class Topo, and then call Topo.addHost() to create the host nodes. We next describe selected parts of switchline.py. The default number of host/switch pairs is 4, but this can be changed with the -N command-line parameter, for example python switchline.py -N This configures the network and starts the Mininet CLI. The full Python2 program is switchline.py to run it use python switchline.py The Mininet-CLI command links can be used to determine which switch interface is connected to which neighboring switch interface. The next example creates the topology below.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |