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