135e509f1SJulian Elischer#!/bin/sh 235e509f1SJulian Elischer# script to set up a frame relay link on the sr card. 335e509f1SJulian Elischer# The dlci used is selected below. The default is 16 435e509f1SJulian Elischer 535e509f1SJulian ElischerCARD=sr0 635e509f1SJulian ElischerDLCI=16 735e509f1SJulian Elischer 835e509f1SJulian Elischer# create a frame_relay type node and attach it to the sync port. 935e509f1SJulian Elischerngctl mkpeer ${CARD}: frame_relay rawdata downstream 1035e509f1SJulian Elischer 1135e509f1SJulian Elischer# Attach the dlci output of the (de)multiplexor to a new 1235e509f1SJulian Elischer# Link management protocol node. 1335e509f1SJulian Elischerngctl mkpeer ${CARD}:rawdata lmi dlci0 auto0 1435e509f1SJulian Elischer 15*5665fe6bSUlrich Spörlein# Also attach dlci 1023, as it needs both to try auto-configuring. 1635e509f1SJulian Elischer# The Link management protocol is now alive and probing.. 1735e509f1SJulian Elischerngctl connect ${CARD}:rawdata ${CARD}:rawdata.dlci0 dlci1023 auto1023 1835e509f1SJulian Elischer 1935e509f1SJulian Elischer# Attach the DLCI(channel) the Telco has assigned you to 20*5665fe6bSUlrich Spörlein# a node to handle whatever protocol encapsulation your peer 21*5665fe6bSUlrich Spörlein# is using. In this case RFC1490 encapsulation. 2235e509f1SJulian Elischerngctl mkpeer ${CARD}:rawdata rfc1490 dlci${DLCI} downstream 2335e509f1SJulian Elischer 2435e509f1SJulian Elischer 2535e509f1SJulian Elischer# Attach the ip (inet) protocol output of the protocol mux to the ip (inet) 2635e509f1SJulian Elischer# input of a netgraph "interface" node (ifconfig should show it as "ng0"). 2735e509f1SJulian Elischer#if interface ng0 needs to be created use a mkpeer command.. e.g. 2835e509f1SJulian Elischerngctl mkpeer ${CARD}:rawdata.dlci${DLCI} iface inet inet 2935e509f1SJulian Elischer 3035e509f1SJulian Elischer# if ng0 already exists, use a CONNECT command instead of a mkpeer. e.g. 3135e509f1SJulian Elischer# ngctl connect ${CARD}:rawdata.dlci${DLCI} ng0: inet inet 3235e509f1SJulian Elischer 3335e509f1SJulian Elischer# Then use ifconfig on interface ng0 as usual 3435e509f1SJulian Elischer 3535e509f1SJulian Elischer# A variant on this whole set might use the 'name' command to make it more 36*5665fe6bSUlrich Spörlein# readable. But it doesn't work if you have multiple lines or dlcis 3735e509f1SJulian Elischer# e.g. 3835e509f1SJulian Elischer# ngctl mkpeer ${CARD}: frame_relay rawdata downstream 3935e509f1SJulian Elischer# ngctl name ${CARD}:rawdata mux 4035e509f1SJulian Elischer# ngctl mkpeer mux: lmi dlci0 auto0 4135e509f1SJulian Elischer# ngctl name mux:dlci0 lmi 4235e509f1SJulian Elischer# ngctl connect mux: lmi: dlci1023 auto1023 4335e509f1SJulian Elischer# ngctl mkpeer mux: rfc1490 dlci${DLCI} downstream 4435e509f1SJulian Elischer# ngctl mux:dlci${DLCI} protomux 4535e509f1SJulian Elischer# ngctl mkpeer protomux: iface inet inet 46