Giter Club home page Giter Club logo

Comments (2)

edgar-costa avatar edgar-costa commented on July 25, 2024

Yes you can do it, however you have to use the manual IP assignment strategy:

https://github.com/nsg-ethz/p4-utils#assignment_strategy

Then for each host you can set an IP and Gateway IP. You can also assign IPs to switches however they will not be directly assigned to the interfaces but they will be stored in the Topology object in case you need to know them. To assign switches IPs you need to do the following:

"switches": {
      "s1": {
	"cpu_port" : true,
         "h1" : "10.0.1.1/24",
         "s2" : "10.0.2.1/24"
          }

So for example for the interface facing h1 you want 10.0.1.1/24.

The reason why switches can not get IPs assigned is the following: when a packet is sent between the virtual ethernet interfaces the linux network stack will check if it can forward that packet directly using its own routing table making the packet jump from one interface to the other without even crossing switches. For example:

h1------(10.0.1.1/24)sw1-------sw2-----sw3(10.0.3.1/24)------(10.0.3.2)h2.

Imagine that h1 is sending a packet to h2. This type of switches are configured in the main namespace of the linux network container, meaning that all the interfaces that you configure there share the same network stack. When you set the ip of sw1 and sw3 the linux routing table will have some entries that say that packets forwarded to 10.0.1.0/24 and 10.0.3.0/24 have to be sent to some known interface so when the packet with destination h2 arrives at sw1 even before it enters the switch, the linux kernel will send the packet directly to the sw3 interface, thus jumping sw2. However as i noted before, it is not necessary to set the IPs directly to the interface, you can still emulate it pretty well if you use the right controller/P4 code.

from p4-utils.

HUSTer2013 avatar HUSTer2013 commented on July 25, 2024

Got it. Many thanks for your detailed reply!

from p4-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.