xref: /dflybsd-src/share/examples/netgraph/frame_relay (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino#!/bin/sh
2*86d7f5d3SJohn Marino# script to set up a frame relay link on the sr card.
3*86d7f5d3SJohn Marino# The dlci used is selected below. The default is 16
4*86d7f5d3SJohn Marino# $FreeBSD: src/share/examples/netgraph/frame_relay,v 1.1 1999/11/19 06:56:34 julian Exp $
5*86d7f5d3SJohn Marino# $DragonFly: src/share/examples/netgraph/frame_relay,v 1.2 2003/06/17 04:36:57 dillon Exp $
6*86d7f5d3SJohn Marino
7*86d7f5d3SJohn MarinoCARD=sr0
8*86d7f5d3SJohn MarinoDLCI=16
9*86d7f5d3SJohn Marino
10*86d7f5d3SJohn Marino# create a frame_relay type node and attach it to the sync port.
11*86d7f5d3SJohn Marinongctl mkpeer ${CARD}: frame_relay rawdata downstream
12*86d7f5d3SJohn Marino
13*86d7f5d3SJohn Marino# Attach the dlci output of the (de)multiplexor to a new
14*86d7f5d3SJohn Marino# Link management protocol node.
15*86d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata lmi dlci0 auto0
16*86d7f5d3SJohn Marino
17*86d7f5d3SJohn Marino# Also attach dlci 1023, as it needs both to try autoconfiguring.
18*86d7f5d3SJohn Marino# The Link management protocol is now alive and probing..
19*86d7f5d3SJohn Marinongctl connect ${CARD}:rawdata ${CARD}:rawdata.dlci0 dlci1023 auto1023
20*86d7f5d3SJohn Marino
21*86d7f5d3SJohn Marino# Attach the DLCI(channel) the Telco has assigned you to
22*86d7f5d3SJohn Marino# a node to hadle whatever protocol encapsulation your peer
23*86d7f5d3SJohn Marino# is using. In this case rfc1490 encapsulation.
24*86d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata rfc1490 dlci${DLCI} downstream
25*86d7f5d3SJohn Marino
26*86d7f5d3SJohn Marino
27*86d7f5d3SJohn Marino# Attach the ip (inet) protocol output of the protocol mux to the ip (inet)
28*86d7f5d3SJohn Marino# input of a netgraph "interface" node (ifconfig should show it as "ng0").
29*86d7f5d3SJohn Marino#if interface ng0 needs to be created use a mkpeer command.. e.g.
30*86d7f5d3SJohn Marinongctl mkpeer ${CARD}:rawdata.dlci${DLCI} iface inet inet
31*86d7f5d3SJohn Marino
32*86d7f5d3SJohn Marino# if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g.
33*86d7f5d3SJohn Marino# ngctl connect ${CARD}:rawdata.dlci${DLCI} ng0: inet inet
34*86d7f5d3SJohn Marino
35*86d7f5d3SJohn Marino# Then use ifconfig on interface ng0 as usual
36*86d7f5d3SJohn Marino
37*86d7f5d3SJohn Marino# A variant on this whole set might use the 'name' command to make it more
38*86d7f5d3SJohn Marino# readable. but it doesn't work if you have multiple lines or dlcis
39*86d7f5d3SJohn Marino# e.g.
40*86d7f5d3SJohn Marino# ngctl mkpeer ${CARD}: frame_relay rawdata downstream
41*86d7f5d3SJohn Marino# ngctl name ${CARD}:rawdata mux
42*86d7f5d3SJohn Marino# ngctl mkpeer mux: lmi dlci0 auto0
43*86d7f5d3SJohn Marino# ngctl name mux:dlci0 lmi
44*86d7f5d3SJohn Marino# ngctl connect mux: lmi: dlci1023 auto1023
45*86d7f5d3SJohn Marino# ngctl mkpeer mux: rfc1490 dlci${DLCI} downstream
46*86d7f5d3SJohn Marino# ngctl mux:dlci${DLCI} protomux
47*86d7f5d3SJohn Marino# ngctl mkpeer protomux: iface inet inet
48