--- wikisrc/users/kefren.mdwn 2010/05/21 05:59:30 1.1 +++ wikisrc/users/kefren.mdwn 2010/06/28 08:31:35 1.2 @@ -1 +1,77 @@ -Under slow and heavy construction. +#Some quick info about MPLS: + +You need to compile your kernel with options MPLS and psuedo-device ifmpls +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: + +
# route add -mpls 41 -tag 25 -inet 193.28.151.97
+add host 41: gateway 193.28.151.97
+# route add -mpls 42 -tag 30 -inet 193.28.151.97
+add host 42: gateway 193.28.151.97
+# route add -mpls 51 -tag 25 -inet 193.28.151.97
+add host 51: gateway 193.28.151.97
+ +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 + +You also need to tweak sysctl to accept and forward MPLS: + +
# sysctl -w net.mpls.accept=1
+net.mpls.accept: 0 -> 1
+# sysctl -w net.mpls.forwarding=1
+net.mpls.forwarding: 0 -> 1
+ + +Verify routes with route get or better with netstat -nrT: + +
+...
+MPLS:
+Destination        Gateway            Flags    Refs      Use    Mtu     Tag Interface
+41                 193.28.151.97      UGHS        0    37241      -      25 sk0
+42                 193.28.151.97      UGHS        0        0      -      30 sk0
+51                 193.28.151.97      UGHS        0        0      -      25 sk0
+
+ +#Interacting with other protocols + +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. + +E.g. for INET - setting a fictitious address: + +
+# ifconfig mpls0 create up
+# ifconfig mpls0 1.1.1.1/32
+
+ +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. + +
+# route add 204.152.190.0/24 -ifa 193.28.151.105 -ifp mpls0 -tag 25 -inet 193.28.151.97
+add net 204.152.190.0: gateway 193.28.151.97
+
+ +Verify the route: + +
+# route -n get 204.152.190.0/24
+   route to: 204.152.190.0
+destination: 204.152.190.0
+       mask: 255.255.255.0
+    gateway: 193.28.151.97
+        Tag: 25
+ local addr: 193.28.151.105
+  interface: mpls0
+      flags: 
+ recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
+       0         0         0       813       344         0         0         0 
+sockaddrs: 
+
+ +or with netstat -rT: +
+...
+204.152.190/24     193.28.151.97      UGS         0    95362      -      25 mpls0
+...
+
+ + +I'm working on LDP daemon, it should be available in a couple of weeks.