Let Private or Pulic host talk to the server in the Private networks



In this topology, we will setup a HTTP server at h1. Then we hope that h2 (in the public network) and h3 (in the private network) can talk to h1 (in another private network).



   We will setup a pptp server at r0. Then h2 or h3 can use VPN connection to get a IP in the network. Then h2 or h3 can talk to h1.


[software installation]

sudo apt-get install pptpd



#!/usr/bin/env python


from mininet.cli import CLI

from mininet.net import Mininet

from mininet.link import Link,TCLink,Intf


if '__main__' == __name__:

  net = Mininet(link=TCLink)

  h1 = net.addHost('h1',ip="")

  h2 = net.addHost('h2',ip="")

  h3 = net.addHost('h3',ip="")

  h4 = net.addHost('h4',ip="")

  s0 = net.addHost('s0')

  r0 = net.addHost('r0')

  r1 = net.addHost('r1')

  net.addLink(h1, r0)

  net.addLink(r0, s0)

  net.addLink(s0, h2)

  net.addLink(s0, r1)

  net.addLink(r1, h3)

  net.addLink(s0, h4)


  r0.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")

  r1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward") 

  s0.cmd("brctl addbr br0")

  s0.cmd("brctl addif br0 s0-eth0")

  s0.cmd("brctl addif br0 s0-eth1")

  s0.cmd("brctl addif br0 s0-eth2")

  s0.cmd("brctl addif br0 s0-eth3")

  s0.cmd("ifconfig br0 up")

  r0.cmd("ip addr add brd + dev r0-eth0")

  r0.cmd("ip addr add brd + dev r0-eth1")

  h1.cmd("ip addr add brd + dev h1-eth0")

  h1.cmd("ip route add default via")

  r0.cmd("iptables -t nat -A POSTROUTING -s -o r0-eth1 -j MASQUERADE")

  #h1.cmd("python -m SimpleHTTPServer 80")

  h2.cmd("ip addr add brd + dev h2-eth0")

  h4.cmd("ip addr add brd + dev h4-eth0")

  r1.cmd("ip addr add brd + dev r1-eth0")

  r1.cmd("ip addr add brd + dev r1-eth1")

  r1.cmd("iptables -t nat -A POSTROUTING -s -o r1-eth0 -j MASQUERADE")

  r1.cmd("modprobe ip_nat_pptp")

  h3.cmd("ip addr add brd + dev h3-eth0")

  h3.cmd("ip route add default via")






Run the mininet-script. And open a terminal for r0. We will setup the pptpd server.


When a pptp client is connected to the server, the server will assign an IP starting at to the client.


Setup an account (tom) and password (tom1234).


Starting the pptp server


Open another terminal for h2 and start the pptp client


We got an error. We need to fix it. Then restart the pptp server again.


Restart the pptp client again. It works.


Set the routing table for h2.


Start the http server at h1. And h2 connects to h1. (It works)


Due to the mininet limitation, we have to close this VPN connection before we try to make h3 connects to h1.


Make h3 connect to the pptp server.


Make h3 connects to h1.







Dr. Chih-Heng Ke (smallko@gmail.com)

Department of Computer Science and Information Engineering,

National Quemoy University, Kinmen, Taiwan.