File:  [NetBSD Developer Wiki] / wikisrc / users / kefren.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Sun Jul 4 20:11:59 2010 UTC (11 years, 2 months ago) by wiki
Branches: MAIN
CVS tags: HEAD
web commit by kefren

    1: #Some quick info about MPLS:
    2: 
    3: You need to compile your kernel with options MPLS and psuedo-device ifmpls
    4: For pure LSR - that only switch labels without encap/decap from other protocols (e.g. INET) you need only to work on routing table. For example:
    5: 
    6: <pre># route add -mpls 41 -tag 25 -inet 193.28.151.97
    7: add host 41: gateway 193.28.151.97
    8: # route add -mpls 42 -tag 30 -inet 193.28.151.97
    9: add host 42: gateway 193.28.151.97
   10: # route add -mpls 51 -tag 25 -inet 193.28.151.97
   11: add host 51: gateway 193.28.151.97</pre>
   12: 
   13: Translation of first line: if it receives an MPLS frame with label 41 forward it to INET next-hop 193.28.151.97, tagged with label 25
   14: 
   15: You also need to tweak sysctl to accept and forward MPLS:
   16: 
   17: <pre># sysctl -w net.mpls.accept=1
   18: net.mpls.accept: 0 -> 1
   19: # sysctl -w net.mpls.forwarding=1
   20: net.mpls.forwarding: 0 -> 1</pre>
   21: 
   22: 
   23: Verify routes with route get or better with netstat -nrT:
   24: 
   25: <pre>
   26: ...
   27: MPLS:
   28: Destination        Gateway            Flags    Refs      Use    Mtu     Tag Interface
   29: 41                 193.28.151.97      UGHS        0    37241      -      25 sk0
   30: 42                 193.28.151.97      UGHS        0        0      -      30 sk0
   31: 51                 193.28.151.97      UGHS        0        0      -      25 sk0
   32: </pre>
   33: 
   34: #Interacting with other protocols
   35: 
   36: If you want to also decapsulate/encapsulate from MPLS to some other protocol (like INET or INET6), you have to create an mpls interface and put in up: ifconfig mpls0 create up. YOU NEED TO ADD AN ADDRESS OF THAT PROTOCOL ON THIS INTERFACE - whenever that address is private or not.
   37: 
   38: E.g. for INET - setting a fictitious address:
   39: 
   40: <pre>
   41: # ifconfig mpls0 create up
   42: # ifconfig mpls0 1.1.1.1/32
   43: </pre>
   44: 
   45: After that create routes like this - use -ifa flag in order to avoid self-generated packets having source address 1.1.1.1, but route them thru mpls0 interface.
   46: 
   47: <pre>
   48: # route add 204.152.190.0/24 -ifa 193.28.151.105 -ifp mpls0 -tag 25 -inet 193.28.151.97
   49: add net 204.152.190.0: gateway 193.28.151.97
   50: </pre>
   51: 
   52: Verify the route:
   53: 
   54: <pre>
   55: # route -n get 204.152.190.0/24
   56:    route to: 204.152.190.0
   57: destination: 204.152.190.0
   58:        mask: 255.255.255.0
   59:     gateway: 193.28.151.97
   60:         Tag: 25
   61:  local addr: 193.28.151.105
   62:   interface: mpls0
   63:       flags: <UP,GATEWAY,DONE,STATIC>
   64:  recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
   65:        0         0         0       813       344         0         0         0 
   66: sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA,TAG>
   67: </pre>
   68: 
   69: or with netstat -rT:
   70: <pre>
   71: ...
   72: 204.152.190/24     193.28.151.97      UGS         0    95362      -      25 mpls0
   73: ...
   74: </pre>
   75: 
   76: 
   77: I'm working on [[ LDP ]] daemon, it should be available in a couple of weeks.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb