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