/share/examples/netgraph/frame_relay

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 46 lines · 7 code · 10 blank · 29 comment · 0 complexity · a869c9c930eab6c8b93125668aedf75f MD5 · raw file

  1. #!/bin/sh
  2. # script to set up a frame relay link on the sr card.
  3. # The dlci used is selected below. The default is 16
  4. # $FreeBSD$
  5. CARD=sr0
  6. DLCI=16
  7. # create a frame_relay type node and attach it to the sync port.
  8. ngctl mkpeer ${CARD}: frame_relay rawdata downstream
  9. # Attach the dlci output of the (de)multiplexor to a new
  10. # Link management protocol node.
  11. ngctl mkpeer ${CARD}:rawdata lmi dlci0 auto0
  12. # Also attach dlci 1023, as it needs both to try auto-configuring.
  13. # The Link management protocol is now alive and probing..
  14. ngctl connect ${CARD}:rawdata ${CARD}:rawdata.dlci0 dlci1023 auto1023
  15. # Attach the DLCI(channel) the Telco has assigned you to
  16. # a node to handle whatever protocol encapsulation your peer
  17. # is using. In this case RFC1490 encapsulation.
  18. ngctl mkpeer ${CARD}:rawdata rfc1490 dlci${DLCI} downstream
  19. # Attach the ip (inet) protocol output of the protocol mux to the ip (inet)
  20. # input of a netgraph "interface" node (ifconfig should show it as "ng0").
  21. #if interface ng0 needs to be created use a mkpeer command.. e.g.
  22. ngctl mkpeer ${CARD}:rawdata.dlci${DLCI} iface inet inet
  23. # if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g.
  24. # ngctl connect ${CARD}:rawdata.dlci${DLCI} ng0: inet inet
  25. # Then use ifconfig on interface ng0 as usual
  26. # A variant on this whole set might use the 'name' command to make it more
  27. # readable. But it doesn't work if you have multiple lines or dlcis
  28. # e.g.
  29. # ngctl mkpeer ${CARD}: frame_relay rawdata downstream
  30. # ngctl name ${CARD}:rawdata mux
  31. # ngctl mkpeer mux: lmi dlci0 auto0
  32. # ngctl name mux:dlci0 lmi
  33. # ngctl connect mux: lmi: dlci1023 auto1023
  34. # ngctl mkpeer mux: rfc1490 dlci${DLCI} downstream
  35. # ngctl mux:dlci${DLCI} protomux
  36. # ngctl mkpeer protomux: iface inet inet