xref: /dflybsd-src/share/examples/netgraph/frame_relay (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino#!/bin/sh
286d7f5d3SJohn Marino# script to set up a frame relay link on the sr card.
386d7f5d3SJohn Marino# The dlci used is selected below. The default is 16
486d7f5d3SJohn Marino# $FreeBSD: src/share/examples/netgraph/frame_relay,v 1.1 1999/11/19 06:56:34 julian Exp $
586d7f5d3SJohn Marino# $DragonFly: src/share/examples/netgraph/frame_relay,v 1.2 2003/06/17 04:36:57 dillon Exp $
686d7f5d3SJohn Marino
786d7f5d3SJohn MarinoCARD=sr0
886d7f5d3SJohn MarinoDLCI=16
986d7f5d3SJohn Marino
1086d7f5d3SJohn Marino# create a frame_relay type node and attach it to the sync port.
1186d7f5d3SJohn Marinongctl mkpeer ${CARD}: frame_relay rawdata downstream
1286d7f5d3SJohn Marino
1386d7f5d3SJohn Marino# Attach the dlci output of the (de)multiplexor to a new
1486d7f5d3SJohn Marino# Link management protocol node.
1586d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata lmi dlci0 auto0
1686d7f5d3SJohn Marino
1786d7f5d3SJohn Marino# Also attach dlci 1023, as it needs both to try autoconfiguring.
1886d7f5d3SJohn Marino# The Link management protocol is now alive and probing..
1986d7f5d3SJohn Marinongctl connect ${CARD}:rawdata ${CARD}:rawdata.dlci0 dlci1023 auto1023
2086d7f5d3SJohn Marino
2186d7f5d3SJohn Marino# Attach the DLCI(channel) the Telco has assigned you to
2286d7f5d3SJohn Marino# a node to hadle whatever protocol encapsulation your peer
2386d7f5d3SJohn Marino# is using. In this case rfc1490 encapsulation.
2486d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata rfc1490 dlci${DLCI} downstream
2586d7f5d3SJohn Marino
2686d7f5d3SJohn Marino
2786d7f5d3SJohn Marino# Attach the ip (inet) protocol output of the protocol mux to the ip (inet)
2886d7f5d3SJohn Marino# input of a netgraph "interface" node (ifconfig should show it as "ng0").
2986d7f5d3SJohn Marino#if interface ng0 needs to be created use a mkpeer command.. e.g.
3086d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata.dlci${DLCI} iface inet inet
3186d7f5d3SJohn Marino
3286d7f5d3SJohn Marino# if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g.
3386d7f5d3SJohn Marino# ngctl connect ${CARD}:rawdata.dlci${DLCI} ng0: inet inet
3486d7f5d3SJohn Marino
3586d7f5d3SJohn Marino# Then use ifconfig on interface ng0 as usual
3686d7f5d3SJohn Marino
3786d7f5d3SJohn Marino# A variant on this whole set might use the 'name' command to make it more
3886d7f5d3SJohn Marino# readable. but it doesn't work if you have multiple lines or dlcis
3986d7f5d3SJohn Marino# e.g.
4086d7f5d3SJohn Marino# ngctl mkpeer ${CARD}: frame_relay rawdata downstream
4186d7f5d3SJohn Marino# ngctl name ${CARD}:rawdata mux
4286d7f5d3SJohn Marino# ngctl mkpeer mux: lmi dlci0 auto0
4386d7f5d3SJohn Marino# ngctl name mux:dlci0 lmi
4486d7f5d3SJohn Marino# ngctl connect mux: lmi: dlci1023 auto1023
4586d7f5d3SJohn Marino# ngctl mkpeer mux: rfc1490 dlci${DLCI} downstream
4686d7f5d3SJohn Marino# ngctl mux:dlci${DLCI} protomux
4786d7f5d3SJohn Marino# ngctl mkpeer protomux: iface inet inet
48