Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[mininet-discuss] 2 IPs to a host

Bob Lantz rlantz at cs.stanford.edu
Mon Mar 16 15:48:12 PDT 2015


I think he might have meant “is there an API for setting the IP addresses of multiple interfaces attached to a host.”

There are multiple API approaches - they all boil down to calling Intf.setIP(). For example:

1. High-level (Topo) API:  self.addLink( 'h1', s1, params1={'ip':'10.3/8'} )
2. Mid-level (Mininet) API:  net.addLink( h1, s1, params1={'ip':'10.4/8'} )
3. Low-level (Link) API:  link = Link( h1, s1, params1={'ip': '10.5/8' } )
4. Low-level (Host) API:  h1.setIP( '10.6/8', intf=h1.intfs[1] )
5. Low-level (Intf) API:  h1.intfs[1].setIP( '10.7/8' )
6. Low-level (Intf.ifconfig()) API:  h1.intfs[1].ifconfig( '10.8/8 up' )

I'm sure you can figure out other ways of doing it based on looking at the API documentation.

Here's another demonstration:

# mn -v output
mininet> py net.addLink( h1, s1, params1={'ip': '10.3/8'} )
<mininet.link.Link object at 0x7fa698c61f90>
mininet> py net.addLink( h2, s1, params1={'ip': '10.4/8'} )
<mininet.link.Link object at 0x7fa698c0d0d0>
mininet> h1 ping -c1 10.4
PING 10.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=2.24 ms

A word to the wise: OVS switches are not IP routers, and using Linux to attach IP addresses to data ports is meaningless!!
Moreover, if s1 is an OpenFlow switch or an Ethernet bridge, trying something like this will *not* magically turn it into an IP router:

	net.addLink( h1, s1, params1={'ip':'10.3/8'}, params2={'ip':'10.4/8'} )

However, if h2 is a Node, a Host, or a LinuxRouter, then this would be more likely to create a useful/usable data link:

	net.addLink( h1, h2, params1={'ip':'10.3/8'}, params2={'ip':'10.4/8'} )


> 
> On Mon, Mar 16, 2015 at 6:21 PM, Janki Chhatbar <jankihchhatbar at gmail.com> wrote:
> HI all
> 
> Is there a way to assign 2 IPs to a host? 
> 
> Janki Chhatbar
> M.Tech (Embedded Systems)
> Nirma University
> (+91) 9409239106
> 
> _______________________________________________
> mininet-discuss mailing list
> mininet-discuss at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/mininet-discuss
> 
> 
> _______________________________________________
> mininet-discuss mailing list
> mininet-discuss at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/mininet-discuss



More information about the mininet-discuss mailing list