Files
mininet/examples/nat.py
T
Bob Lantz 8ac077a721 Remove "from __future__ import print"
This was well-intentioned, but it causes more trouble
than it's worth.

Fixes #652
2016-08-08 15:28:52 -07:00

24 lines
558 B
Python
Executable File

#!/usr/bin/python
"""
Example to create a Mininet topology and connect it to the internet via NAT
"""
from mininet.cli import CLI
from mininet.log import lg
from mininet.topolib import TreeNet
if __name__ == '__main__':
lg.setLogLevel( 'info')
net = TreeNet( depth=1, fanout=4 )
# Add NAT connectivity
net.addNAT().configDefault()
net.start()
print( "*** Hosts are running and should have internet connectivity" )
print( "*** Type 'exit' or control-D to shut down network" )
CLI( net )
# Shut down NAT
net.stop()