Linux generic HDLC layer + DAHDI » History » Revision 1
Revision 1/2
| Next »
roox, 01/05/2021 10:02 PM
- Table of contents
- Linux generic HDLC layer
- DAHDI
- E1 Hardware
- Example setup
Linux generic HDLC layer¶
The generic HDLC layer for Linux currently supports:- Frame Relay (ANSI, CCITT, Cisco and no LMI)
- raw HDLC - either IP (IPv4) interface or Ethernet device emulation
- Cisco HDLC
- PPP
- X.25 (uses X.25 routines).
Generic HDLC is a protocol driver only - it needs a low-level driver for your particular hardware (e.g. DAHDI with nethdlc).
Ethernet device emulation (using HDLC or Frame-Relay PVC) is compatible with IEEE 802.1Q (VLANs) and 802.1D (Ethernet bridging).
Make sure the hdlc.ko and the hardware driver are loaded. It should create a number of "hdlc" (hdlc0 etc) network devices, one for each
WAN port. You'll need the "sethdlc" utility, get it from:
http://www.kernel.org/pub/linux/utils/net/hdlc/
Make sure you're using a correct version of sethdlc for your kernel.
The current version is 4, see GENERIC_HDLC_VERSION in include/uapi/linux/hdlc/ioctl.h
Use sethdlc to set physical interface, HDLC mode used, and add any required PVCs if using Frame Relay.
Usually you want something like:
sethdlc hdlc0 cisco interval 10 timeout 25 # or sethdlc hdlc0 fr lmi ansi sethdlc hdlc0 create 99 ip link set hdlc0 up ip address add localIP peer remoteIP dev pvc0
In Frame Relay mode, the "master" hdlcX device has to be setup (without assigning any IP address to it) before you can use pvcX devices.
e.g. ip link set hdlc0 up
Upstream documentation
https://www.kernel.org/doc/Documentation/networking/generic-hdlc.txt
Upstream of "sethdlc" and "inarpd"
https://kernel.org/pub/linux/utils/net/hdlc/
Upstream kernel code
include/linux/hdlc.h mainline net net-next
include/uapi/linux/hdlc.h mainline net net-next
include/uapi/linux/hdlc/ioctl.h mainline net net-next
drivers/net/wan/hdlc.c mainline net net-next
drivers/net/wan/hdlc_cisco.c mainline net net-next
drivers/net/wan/hdlc_fr.c mainline net net-next
drivers/net/wan/hdlc_ppp.c mainline net net-next
drivers/net/wan/hdlc_raw.c mainline net net-next
drivers/net/wan/hdlc_raw.c mainline net net-next
drivers/net/wan/hdlc_x25.c mainline net net-next
sethdlc¶
# sethdlc sethdlc version 1.18 Copyright (C) 2000 - 2005 Krzysztof Halasa <khc@pm.waw.pl> Usage: sethdlc INTERFACE [PHYSICAL] [clock CLOCK] [LOOPBACK] [slotmap SLOTMAP] sethdlc INTERFACE [PROTOCOL] sethdlc INTERFACE create | delete [ether] DLCI sethdlc INTERFACE private... PHYSICAL := v24 | v35 | x21 | e1 | t1 CLOCK := int [rate RATE] | ext | txint [rate RATE] | txfromrx LOOPBACK := loopback | lb PROTOCOL := hdlc [ENCODING] [PARITY] | hdlc-eth [ENCODING] [PARITY] | cisco [interval val] [timeout val] | fr [lmi LMI] | ppp | x25 ENCODING := nrz | nrzi | fm-mark | fm-space | manchester PARITY := no-parity | crc16 | crc16-pr0 | crc16-itu | crc16-itu-pr0 | crc32-itu LMI := none | (ansi | ccitt | cisco) [LMI_SPEC] LMI_SPEC := [dce] [t391 val] [t392 val] [n391 val] [n392 val] [n393 val]
inarpd¶
# inarpd inarpd version 0.17 Copyright (C) 2003 Krzysztof Halasa <khc@pm.waw.pl> Usage: inarpd [-r] [+r] [-r] [+r] [-v] interface ... options: -r = do not add host IP route for neighbours (default) +r = add host IP route for neighbours -v = print info messages -v -v = print network packets -v -v -v = print debug messages
# inarpd +r -v -v pvc0 Searching for network interfaces... Device lo has an IP peer with no local IP address Device eth0 has an IP peer with no local IP address Can't automatically add routes for device pvc0 with peer address Interfaces: pvc0 [Q922 18:51] 1.1.1.2->1.1.1.0/24 Sending request on pvc0 Sending 00 0F 08 00 02 04 00 08 00 00 01 01 01 02 18 51 00 00 00 00 pvc0: 00 0F 08 00 02 04 00 09 00 00 01 01 01 01 18 51 01 01 01 02
DAHDI¶
D igium A sterisk H ardware D evice I nterface.
DAHDI (formerly ZAPTEL) is a collection of open source drivers, for Linux, that are used to interface with a variety of telephony related hardware. It consists of two parts:
- DAHDI-Linux - the individual board drivers for the supported hardware.
- DAHDI-Tools - an assortment of userspace utilities that are used to setup and test the drivers.
upstream DAHDI kernel module (dahdi-linux)
http://git.asterisk.org/gitweb/?p=dahdi/linux.git;a=summary
http://git.asterisk.org/gitweb/?p=dahdi/linux.git;a=shortlog;h=refs/heads/master
next branch (development)
http://git.asterisk.org/gitweb/?p=dahdi/linux.git;a=shortlog;h=refs/heads/next
upstream DAHDI userspace tools (dahdi-tools)
http://git.asterisk.org/gitweb/?p=dahdi/tools.git;a=summary
http://git.asterisk.org/gitweb/?p=dahdi/tools.git;a=shortlog;h=refs/heads/master
next branch (development)
http://git.asterisk.org/gitweb/?p=dahdi/tools.git;a=shortlog;h=refs/heads/next
upstream DAHDI bugtracking
https://issues.asterisk.org/jira/browse/DAHLIN/
https://issues.asterisk.org/jira/browse/DAHTOOL/
- dahdi_cfg - Configures DAHDI kernel modules from /etc/dahdi/system.conf
- lsdahdi - List all DAHDI channels with their types and spans
- dahdi_scan - Print Configuration of DAHDI spans
- dahdi_hardware - Shows DAHDI hardware devices
- dahdi_maint - Sets DAHDI spans into maintenance mode, e.g.: loopback
- dahdi_test - Test if the DAHDI timer provides timely response
- dahdi_tool - Shows status of DAHDI interfaces (ncurses interface)
Example configuration:
/etc/dahdi/system.conf
DAHDI nethdlc¶
The DAHDI nethdlc driver bundles the channels together into an hdlc network device, which in turn can be configured with sethdlc.
You could optionally pass the name for the network interface after the channel list.
Syntax: nethdlc=<channel list>[:interface name]
Use original names, don't use the names which have been already registered in the system e.g eth.
The default name for the interface is hdlcX (e.g. hdlc0).
E1 Hardware¶
osmocom icE1usb¶
http://shop.sysmocom.de/products/icE1usb
https://osmocom.org/projects/e1-t1-adapter/wiki/IcE1usb
DAHDI driver for icE1usb (written by Harald, available since Dec 2020)
https://osmocom.org/news/129
https://osmocom.org/issues/4923
https://github.com/osmocom/dahdi-linux/tree/laforge/icE1usb
https://news.ycombinator.com/item?id=25556911
for now (01/01/2021) it does not work with the prebuild picoRISCV firmware
http://ftp.osmocom.org/binaries/icE1usb/firmware/all/
firmware build from osmo-e1-hardware (laforge/usb-hdr) works fine
http://cgit.osmocom.org/osmo-e1-hardware/log/?h=laforge/usb-hdr
# lsusb Bus 002 Device 009: ID 1d50:6145 OpenMoko, Inc. icE1usb
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- # modprobe icE1usb # modprobe dahdi # dahdi_cfg -vv DAHDI Tools Version - 3.1.0 DAHDI Version: 3.1.0-28-g9ee58bb Echo Canceller(s):· Configuration ====================== SPAN 1: CCS/HDB3 Build-out: 0 db (CSU)/0-133 feet (DSX-1) Channel map: Channel 01: Network HDLC (Default) (Echo Canceler: none) (Slaves: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) 31 channels to configure. Changing signalling on channel 1 from Unused to Network HDLC Setting echocan for channel 1 to none Changing signalling on channel 2 from Unused to Slave channel Changing master of channel 2 from 2 to 1 Setting echocan for channel 2 to none ... Changing signalling on channel 31 from Unused to Slave channel Changing master of channel 31 from 31 to 1 Setting echocan for channel 31 to none # dmesg: usb 2-2: new full-speed USB device number 10 using xhci_hcd usb 2-2: config 1 interface 0 altsetting 0 endpoint 0x83 has invalid wMaxPacketSize 0 usb 2-2: New USB device found, idVendor=1d50, idProduct=6145, bcdDevice= 0.03 usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1 usb 2-2: Product: icE1usb usb 2-2: Manufacturer: osmocom usb 2-2: SerialNumber: dc697407e76e1722 ... dahdi: Version: 3.1.0-28-g9ee58bbM dahdi: Telephony Interface Registered on major 196 icE1usb 2-2:1.0: entering ice1usb_probe icE1usb 2-2:1.0: Maximum FTS: 12 icE1usb 2-2:1.1: entering ice1usb_probe icE1usb 2-2:1.1: Unsupported Interface Class/SubClass fe/01 usbcore: registered new interface driver icE1usb icE1usb 2-2:1.0: entering e1u_d_spanconfig icE1usb 2-2:1.0: configured channel 1 (icE1usb/1/0/1) sigtype 1920 icE1usb 2-2:1.0: configured channel 2 (icE1usb/1/0/2) sigtype 1920 ... icE1usb 2-2:1.0: configured channel 30 (icE1usb/1/0/30) sigtype 1920 icE1usb 2-2:1.0: configured channel 31 (icE1usb/1/0/31) sigtype 1920 icE1usb 2-2:1.0: entering e1u_d_startup icE1usb 2-2:1.0: entering ice1usb_set_altif(1)
Digium Wildcard TE110P T1/E1¶
TE110 is a half-length, half-height (low-profile) PCI 2.1 single-span E1/T1/J1 PRI/PRA software-configurable digital telephony card for terminating high-capacity digital lines through a computer. The product was replaced by TE12x-series in 2007 by the vendor and is not longer sold. Even the driver (wcte11xp) was dropped from DAHDI upstream.
However the wcte11xp driver was restored and adapted to DAHDI API changes in the osmocom fork of dahdi/linux.
# lspci 04:00.0 Network controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- # modprobe wcte11xp # modprobe dahdi # dahdi_cfg -vv DAHDI Tools Version - 3.1.0 DAHDI Version: 3.1.0-28-g9ee58bb Echo Canceller(s):· Configuration ====================== SPAN 1: CCS/HDB3 Build-out: 0 db (CSU)/0-133 feet (DSX-1) Channel map: Channel 01: Network HDLC (Default) (Echo Canceler: none) (Slaves: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) 31 channels to configure. Changing signalling on channel 1 from Unused to Network HDLC Setting echocan for channel 1 to none Changing signalling on channel 2 from Unused to Slave channel Changing master of channel 2 from 2 to 1 Setting echocan for channel 2 to none ... Changing signalling on channel 31 from Unused to Slave channel Changing master of channel 31 from 31 to 1 Setting echocan for channel 31 to none # dmesg: dahdi: Version: 3.1.0-28-g9ee58bb dahdi: Telephony Interface Registered on major 196 FALC version: 00000000 TE110P: Setting up global serial parameters for E1 FALC V1.2 TE110P: Successfully initialized serial bus for card Found a Wildcard: Digium Wildcard TE110P T1/E1 TE110P: Span configured for CCS/HDB3/CRC4 Calling startup (flags is 4099)
Cisco 1841 Router¶
Cisco 1841 with IOS version 12.4(24)T6 and C1841-ADVENTERPRISEK9-M features)
R1# show version | include IOS Cisco IOS Software, 1841 Software (C1841-ADVENTERPRISEK9-M), Version 12.4(24)T6, RELEASE SOFTWARE (fc2) R1# show inventory NAME: "chassis", DESCR: "1841 chassis" PID: CISCO1841 , VID: V03 , SN: FCZ1034111U NAME: "WIC 0", DESCR: "Two port E1 voice interface daughtercard" PID: VWIC-2MFT-E1= , VID: 1.0, SN: 35150839
Example setup¶
HDLC RAW back to back: DAHDI nethdlc to DAHDI nethdlc¶
hammer thinkpad +----------------------+ +----------------------+ | Linux .1| hdlc0 hdlc0 |.2 Linux | | DAHDI with nethdlc | <------------------> | DAHDI with nethdlc | | Digium TE110P T1/E1 | HDLC RAW | osmocom icE1usb | +----------------------+ +----------------------+ hammer: 10.0.0.1/32 thinkpad: 10.0.0.2/32
HDLC RAW sideA wcte11xp¶
#hammer
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe wcte11xp modprobe dahdi modprobe hdlc modprobe hdlc_raw dahdi_cfg -vv sethdlc hdlc0 hdlc ip link set hdlc0 up ip address add 10.0.0.1 peer 10.0.0.2 dev hdlc0
- DAHDI nethdlc config
- enable CRC4 checking
- set ccs framing (needed for E1)
- set hdb3 coding (needed for E1)
- use channels 1-31 (all available channels in a E1 line)
- load the required kernel modules
- dahdi_cfg creates and initializes the hdlc0 interface
- set hdlc0 interface to use
- use rawhdlc encapsulation
- set nrz coding
- set crc16-itu (CRC16 with ITU-T polynomial) parity
- bring up interfaces
- setup p-t-p ip address
HDLC RAW sideB osmocom icE1usb¶
#thinkpad
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe icE1usb modprobe dahdi modprobe hdlc modprobe hdlc_raw dahdi_cfg -vv sethdlc hdlc0 hdlc ip link set hdlc0 up ip address add 10.0.0.2 peer 10.0.0.1 dev hdlc0
# dmesg: ------------------------------------ hdlc0: Carrier detected ------------------------------------ # sethdlc hdlc0 hdlc0: protocol hdlc nrz crc16-itu # ip address show 17: hdlc0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 50 link/rawhdlc· inet 10.0.0.2 peer 10.0.0.1/32 scope global hdlc0 valid_lft forever preferred_lft forever # ping -c 3 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=35.7 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=33.8 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=35.9 ms --- 10.0.0.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 33.820/35.115/35.866/0.919 ms
Cleanup
ip link set hdlc0 down rmmod wcte11xp icE1usb dahdi hdlc_raw hdlc
HDLC Cisco back to back: DAHDI nethdlc to DAHDI nethdlc¶
hammer thinkpad +----------------------+ +----------------------+ | Linux .1| hdlc0 hdlc0 |.2 Linux | | DAHDI with nethdlc | <------------------> | DAHDI with nethdlc | | Digium TE110P T1/E1 | HDLC Cisco | osmocom icE1usb | +----------------------+ +----------------------+ hammer: 10.0.0.1/32 thinkpad: 10.0.0.2/32
Cisco HDLC sideA wcte11xp¶
#hammer
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe wcte11xp modprobe dahdi modprobe hdlc modprobe hdlc_cisco dahdi_cfg -vv sethdlc hdlc0 cisco ip link set hdlc0 up ip address add 10.0.0.1 peer 10.0.0.2 dev hdlc0
- DAHDI nethdlc config
- enable CRC4 checking
- set ccs framing (needed for E1)
- set hdb3 coding (needed for E1)
- use channels 1-31 (all available channels in a E1 line)
- load the required kernel modules
- dahdi_cfg creates and initializes the hdlc0 interface
- set hdlc0 interface
- set Cisco HDLC mode
- set interval (default: 10) - time in seconds between keepalive packets
- set timeout (default: 25) - time in seconds after last received keepalive packet before we assume the link is down
- bring up interface
- setup p-t-p ip address
Cisco HDLC sideB osmocom icE1usb¶
#thinkpad
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe icE1usb modprobe dahdi modprobe hdlc modprobe hdlc_cisco dahdi_cfg -vv sethdlc hdlc0 cisco ip link set hdlc0 up ip address add 10.0.0.2 peer 10.0.0.1 dev hdlc0
# dmesg: ---------------------------------------- hdlc0: Carrier detected hdlc0: Link up (peer uptime 1d2h54m42s) ---------------------------------------- # sethdlc hdlc0 hdlc0: protocol cisco interval 10 timeout 25 # ip address show 18: hdlc0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 50 link/hdlc inet 10.0.0.2 peer 10.0.0.1/32 scope global hdlc0 valid_lft forever preferred_lft forever # ping -c 3 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 Bytes von 10.0.0.1: icmp_seq=1 ttl=64 Zeit=40.2 ms 64 Bytes von 10.0.0.1: icmp_seq=2 ttl=64 Zeit=38.8 ms 64 Bytes von 10.0.0.1: icmp_seq=3 ttl=64 Zeit=36.8 ms --- 10.0.0.1 ping statistics --- 3 Pakete übertragen, 3 empfangen, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 36.772/38.597/40.229/1.417 ms # tcpdump -ihdlc0 -e -n tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on hdlc0, link-type C_HDLC (Cisco HDLC), capture size 262144 bytes 14:22:22.338819 bcast, ethertype Reverse ARP (0x8035), length 22: SLARP (length: 18), keepalive: mineseen=0x00000018, yourseen=0x0000000e, reliability=0xffff, link uptime=1d2h56m55s 14:22:28.571549 bcast, ethertype Reverse ARP (0x8035), length 22: SLARP (length: 18), keepalive: mineseen=0x0000000f, yourseen=0x00000018, reliability=0xffff, link uptime=0d21h56m48s 14:22:32.578778 bcast, ethertype Reverse ARP (0x8035), length 22: SLARP (length: 18), keepalive: mineseen=0x00000019, yourseen=0x0000000f, reliability=0xffff, link uptime=1d2h57m6s 14:22:33.527342 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 21, seq 1, length 64 14:22:33.567532 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 21, seq 1, length 64 14:22:34.528739 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 21, seq 2, length 64 14:22:34.567501 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 21, seq 2, length 64 14:22:35.530793 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 21, seq 3, length 64 14:22:35.567512 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 21, seq 3, length 64 ^C 9 packets captured 9 packets received by filter 0 packets dropped by kernel
Cleanup
ip link set hdlc0 down rmmod wcte11xp icE1usb dahdi hdlc_cisco hdlc
HDLC PPP back to back: DAHDI nethdlc to DAHDI nethdlc¶
hammer thinkpad +----------------------+ +----------------------+ | Linux .1| hdlc0 hdlc0 |.2 Linux | | DAHDI with nethdlc | <------------------> | DAHDI with nethdlc | | Digium TE110P T1/E1 | HDLC PPP | osmocom icE1usb | +----------------------+ +----------------------+ hammer: 10.0.0.1/32 thinkpad: 10.0.0.2/32
HDLC PPP sideA wcte11xp¶
#hammer
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe wcte11xp modprobe dahdi modprobe hdlc modprobe hdlc_ppp dahdi_cfg -vv sethdlc hdlc0 hdlc ip link set hdlc0 up ip address add 10.0.0.1 peer 10.0.0.2 dev hdlc0
- DAHDI nethdlc config
- enable CRC4 checking
- set ccs framing (needed for E1)
- set hdb3 coding (needed for E1)
- use channels 1-31 (all available channels in a E1 line)
- load the required kernel modules
- dahdi_cfg creates and initializes the hdlc0 interface
- set hdlc0 interface to use
- use ppp encapsulation
- bring up interfaces
- setup p-t-p ip address
HDLC PPP sideB osmocom icE1usb¶
#thinkpad
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe icE1usb modprobe dahdi modprobe hdlc modprobe hdlc_ppp dahdi_cfg -vv sethdlc hdlc0 hdlc ip link set hdlc0 up ip address add 10.0.0.2 peer 10.0.0.1 dev hdlc0
# dmesg: ------------------------------------ hdlc0: Carrier detected hdlc0: LCP up hdlc0: IPCP up hdlc0: IPV6CP up ------------------------------------ # sethdlc hdlc0 hdlc0: protocol ppp # ip address show 19: hdlc0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 50 link/ppp inet 10.0.0.2 peer 10.0.0.1/32 scope global hdlc0 valid_lft forever preferred_lft forever # ping -c 3 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=35.7 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=33.8 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=35.9 ms --- 10.0.0.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2004ms rtt min/avg/max/mdev = 33.820/35.115/35.866/0.919 ms
Cleanup
ip link set hdlc0 down rmmod wcte11xp icE1usb dahdi hdlc_ppp hdlc
Frame Relay back to back: DAHDI nethdlc to DAHDI nethdlc¶
hammer thinkpad +----------------------+ +----------------------+ | | hdlc0 hdlc0 | | | Linux | pvc0 (HDLC 101) pvc0 | Linux | | DAHDI with nethdlc | pvc1 (HDLC 102) pvc1 | DAHDI with nethdlc | | Digium TE110P T1/E1 | <------------------> | osmocom icE1usb | | | Frame Relay | | +----------------------+ +----------------------+ pvc0 (DLCI 101) pvc1 (DLCI 102) hammer: 172.16.101.1 172.16.102.1 thinkpad: 172.16.101.2 172.16.102.2
Example with 2 DLCI's and LMI (ANSI) enabled.
For FR-back to back connections we need to setup the same DLCI's on both sides.
Frame Relay (DCE side) wcte11xp¶
#hammer
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe wcte11xp modprobe dahdi modprobe hdlc_fr dahdi_cfg -vv sethdlc hdlc0 fr lmi ansi dce sethdlc hdlc0 create 101 sethdlc hdlc0 create 102 ip link set hdlc0 up ip link set pvc0 up ip link set pvc1 up ip address add 172.16.101.1 peer 172.16.101.2 dev pvc0 ip address add 172.16.102.1 peer 172.16.102.2 dev pvc1
- DAHDI nethdlc config
- enable CRC4 checking
- set ccs framing (needed for E1)
- set hdb3 coding (needed for E1)
- use channels 1-31 (all available channels in a E1 line)
- load the required kernel modules
- dahdi_cfg creates and initializes the hdlc0 interface
- set hdlc0 interface to use
- use frame-relay encapsulation
- use LMI (Local Management Interface) type ANSI
- be the DTE (Data Terminal Equipment) side of the FR-network
- bring up up all the interfaces
- setup p-t-p ip addresses
Frame Relay (DTE side) osmocom icE1usb¶
#thinkpad
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe icE1usb modprobe dahdi modprobe hdlc_fr dahdi_cfg -vv sethdlc hdlc0 fr lmi ansi sethdlc hdlc0 create 101 sethdlc hdlc0 create 102 ip link set hdlc0 up ip link set pvc0 up ip link set pvc1 up ip address add 172.16.101.2 peer 172.16.101.1 dev pvc0 ip address add 172.16.102.2 peer 172.16.102.1 dev pvc1
# dmesg: ------------------------------------ hdlc0: Carrier detected hdlc0: Link reliable hdlc0: DLCI 101 [] new inactive hdlc0: DLCI 102 [] new inactive hdlc0: DLCI 101 [pvc0] active hdlc0: DLCI 102 [pvc1] active ------------------------------------ # sethdlc hdlc0 hdlc0: protocol fr lmi ansi t391 10 t392 15 n391 6 n392 3 n393 4 # sethdlc pvc0 pvc0: Frame-Relay PVC: DLCI 101, master device hdlc0 # sethdlc pvc1 pvc1: Frame-Relay PVC: DLCI 102, master device hdlc0 # ip address show 8: hdlc0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 50 link/frad 15: pvc0: <POINTOPOINT,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/dlci 00:65 peer 18:51 inet 172.16.101.2 peer 172.16.101.1/32 scope global pvc0 valid_lft forever preferred_lft forever 16: pvc1: <POINTOPOINT,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/dlci 00:66 peer 18:61 inet 172.16.102.2 peer 172.16.102.1/32 scope global pvc1 valid_lft forever preferred_lft forever
- ip address show shows the DLCI (in hex) for the pvcX interfaces
- pvc0: link/dlci 00:65 (DLCI 101)
- pvc1: link/dlci 00:66 (DLCI 102)
Debugging
sethdlc hdlc0 sethdlc pvc0 tcpdump -ihdlc0 -n tcpdump -ipvc0 -n ip monitor all
Cleanup
ip link set pvc0 down ip link set pvc1 down sethdlc hdlc0 delete 101 sethdlc hdlc0 delete 102 ip link set hdlc0 down rmmod wcte11xp icE1usb dahdi hdlc_fr
HDLC Cisco back to back: Cisco IOS to DAHDI nethdlc¶
R1 hammer +----------------------+ +----------------------+ | Cisco 1841 .1| Serial0/0/0:1 hdlc0 |.2 Linux | | VWIC-2MFT-E1= | <------------------> | DAHDI with nethdlc | | | HDLC Cisco | Digium TE110P T1/E1 | +----------------------+ +----------------------+ cisco: 10.0.0.1/32 hammer: 10.0.0.2/32
HDLC Cisco sideA - Cisco 1841 with VWIC-2MFT-E1=¶
#R1
R1# conf t R1(config)# controller E1 0/0/0 R1(config-controller)# clock source internal R1(config-controller)# channel-group 1 timeslots 1-31 speed 64 R1(config-controller)# exit R1(config)# exit R1# conf t R1(config)# interface Serial0/0/0:1 R1(config-if)# ip address 10.0.0.1 255.255.255.0 R1(config-if)# no shutdown R1(config-if)# exit R1(config)# exit
- configure E1 controller interface "controller E1 0/0/0"
- clock source internal specifies that the interface will clock its transmitted data from its internal clock.
- build channel-group 1 (span) by using timeslots "1-31"; this creates a new serial interface: "Serial0/0/0:<channel-group>"
- configure serial interface "Serial 0/0/0:1"
- Cisco uses "Cisco HDLC" encapsulation by default on all serial p-t-p interfaces
- setup ip address
R1# show logging ... cable plugged *Jan 4 17:00:13.548: %CONTROLLER-5-UPDOWN: Controller E1 0/0/0, changed state to up *Jan 4 17:00:15.548: %LINK-3-UPDOWN: Interface Serial0/0/0:1, changed state to up ... cable unplugged *Jan 4 20:47:24.047: %CONTROLLER-5-UPDOWN: Controller E1 0/0/0, changed state to down (LOS detected) *Jan 4 20:47:26.047: %LINK-3-UPDOWN: Interface Serial0/0/0:1, changed state to down *Jan 4 20:47:27.047: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0:1, changed state to down R1# show controllers E1 0/0/0 brief E1 0/0/0 is up. Applique type is Channelized E1 - balanced No alarms detected. alarm-trigger is not set Version info Firmware: 20090113, FPGA: 20, spm_count = 0 Framing is CRC4, Line Code is HDB3, Clock Source is Internal. Data in current interval (365 seconds elapsed): 0 Line Code Violations, 0 Path Code Violations 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs Total Data (last 24 hours) 3454 Line Code Violations, 6259 Path Code Violations, 2 Slip Secs, 2 Fr Loss Secs, 3 Line Err Secs, 0 Degraded Mins, 1 Errored Secs, 0 Bursty Err Secs, 4 Severely Err Secs, 66931 Unavail Secs R1# show interfaces Serial0/0/0:1 Serial0/0/0:1 is up, line protocol is up Hardware is GT96K Serial Internet address is 10.0.0.1/30 MTU 1500 bytes, BW 1984 Kbit/sec, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation HDLC, loopback not set Keepalive set (10 sec) CRC checking enabled Last input 00:00:04, output 00:00:03, output hang never Last clearing of "show interface" counters 03:55:15 Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: weighted fair Output queue: 0/1000/64/0 (size/max total/threshold/drops) Conversations 0/1/256 (active/max active/max total) Reserved Conversations 0/0 (allocated/max allocated) Available Bandwidth 1488 kilobits/sec 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 1312 packets input, 28996 bytes, 0 no buffer Received 1310 broadcasts, 0 runts, 1 giants, 0 throttles 40 input errors, 4 CRC, 1 frame, 1 overrun, 0 ignored, 33 abort 1640 packets output, 108646 bytes, 0 underruns 0 output errors, 0 collisions, 6 interface resets 0 unknown protocol drops 0 output buffer failures, 0 output buffers swapped out 2 carrier transitions Timeslot(s) Used:1-31, SCC: 0, Transmitter delay is 0 flags R1# debug serial interface Serial network interface debugging is on *Jan 4 20:43:32.695: Serial0/0/0:1: HDLC myseq 1339, mineseen 1338, yourseen 1308, line up *Jan 4 20:43:42.695: Serial0/0/0:1: HDLC myseq 1340, mineseen 1340*, yourseen 1309, line up *Jan 4 20:43:52.695: Serial0/0/0:1: HDLC myseq 1341, mineseen 1341*, yourseen 1310, line up
Debug
R1# show controllers E1 0/0/0 R1# show controllers E1 0/0/0 brief R1# show interfaces Serial0/0/0:1 R1# show interfaces Serial0/0/0:1 summary R1# show ip interface brief ! R2# debug serial interface R2# debug ip packet R2# debug arp R2# show debug R2# terminal monitor R2# no debug all
HDLC Cisco sideB osmocom icE1usb¶
#hammer
/etc/dahdi/system.conf --------------------------- span = 1,1,0,ccs,hdb3,crc4 nethdlc = 1-31 --------------------------- modprobe icE1usb modprobe dahdi modprobe hdlc modprobe hdlc_cisco dahdi_cfg -vv sethdlc hdlc0 cisco ip link set hdlc0 up ip address add 10.0.0.2 peer 10.0.0.1 dev hdlc0
# dmesg: ---------------------------------------- hdlc0: Carrier detected hdlc0: Link up (peer uptime 1d2h54m42s) ---------------------------------------- # sethdlc hdlc0 hdlc0: protocol cisco interval 10 timeout 25 # ip address show 18: hdlc0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 50 link/hdlc inet 10.0.0.2 peer 10.0.0.1/32 scope global hdlc0 valid_lft forever preferred_lft forever # tcpdump -ihdlc0 -e -n tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on hdlc0, link-type C_HDLC (Cisco HDLC), capture size 262144 bytes 21:29:12.168888 bcast, ethertype Reverse ARP (0x8035), length 24: SLARP (length: 20), keepalive: mineseen=0x00000041, yourseen=0x0000003f, reliability=0xffff, link uptime=9d15h23m8s 21:29:13.021980 bcast, ethertype Reverse ARP (0x8035), length 22: SLARP (length: 18), keepalive: mineseen=0x00000040, yourseen=0x00000041, reliability=0xffff, link uptime=1d5h5m22s 21:29:19.656778 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 14, seq 1, length 64 21:29:19.660809 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 14, seq 1, length 64 21:29:20.658004 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 14, seq 2, length 64 21:29:20.661663 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 14, seq 2, length 64 21:29:21.659821 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.2 > 10.0.0.1: ICMP echo request, id 14, seq 3, length 64 21:29:21.663519 unicast, ethertype IPv4 (0x0800), length 88: 10.0.0.1 > 10.0.0.2: ICMP echo reply, id 14, seq 3, length 64 21:29:22.167445 bcast, ethertype Reverse ARP (0x8035), length 24: SLARP (length: 20), keepalive: mineseen=0x00000042, yourseen=0x00000040, reliability=0xffff, link uptime=9d15h23m18s 21:29:23.261982 bcast, ethertype Reverse ARP (0x8035), length 22: SLARP (length: 18), keepalive: mineseen=0x00000041, yourseen=0x00000042, reliability=0xffff, link uptime=1d5h5m32s ^C 10 packets captured 10 packets received by filter 0 packets dropped by kernel
Cleanup
ip link set hdlc0 down rmmod wcte11xp icE1usb dahdi hdlc_cisco hdlc
Updated by roox about 3 years ago · 1 revisions