Sunday, April 13, 2008

Linux Box Terminal via Serial Cable Console

Here example how to make linux box access login / terminal via serial console cable. Without monitor / keyboard cable. Use PC / Notebook with hyper terminal, minicom or Zterm via serial cable. This example use linux box with fedora core 4, minimal installation.

Step by step to configure linux box via serial console

1. check system serial support

# dmesg | grep tty
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

# setserial -g /dev/ttyS[01]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3


2. configure inittab to support serial console login, add (copy/paste)

# Run agetty on COM1/ttyS0 and COM2/ttyS1
s0:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS0 vt100
s1:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS1 vt100


Here Example /etc/inittab file

# vi /etc/inittab

id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Run agetty on COM1/ttyS0 and COM2/ttyS1
s0:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS0 vt100
s1:2345:respawn:/sbin/agetty -L -f /etc/issueserial 9600 ttyS1 vt100
#s1:2345:respawn:/sbin/agetty -L -i 38400 ttyS1 vt100

# Run xdm in runlevel 5
x:5:once:/etc/X11/prefdm -nodaemon


3. welcome banner, create file /etc/issueserial

# vi /etc/issueserial

Welcome
Connected on \l at \b bps
\U


4. activate the new init file, force the init to re-read the config file

# init q


5. permit to login via serial console as the root user, edit /etc/securetty and add ttys0/1

console
ttyS0
ttyS1
vc/1


6. Test



7. verify process

# ps -ef | grep agetty
root 25519 1 0 15:22 ttyS1 00:00:00 /sbin/agetty -L -f /etc/issueserial 9600 ttyS1 vt100

Saturday, April 12, 2008

Cisco Back to Back Line AUX Ports

This is example back to back through line AUX ports on Cisco router.

# config

ROUTER-A#
interface Async1
description Connected to ROUTER-B
ip address 172.16.4.1 255.255.255.0
encapsulation ppp
async dynamic routing
async mode dedicated
!
line aux 0
modem InOut
transport input all
flowcontrol hardware


ROUTER-B#
interface Async65
description Connected to ROUTER-A
ip address 172.16.4.3 255.255.255.0
encapsulation ppp
async dynamic routing
async mode dedicated
!
line aux 0
modem InOut
transport input all
flowcontrol hardware


# verify

ROUTER-A#
show async status 
Async protocol statistics:

Int Local Remote Qd InPack OutPac Inerr Drops MTU
* 1 172.16.4.1 172.16.4.3 0 6189 6389 0 0 1500


Rcvd: 6189 packets, 316489 bytes
0 format errors, 0 checksum errors, 0 overrun
Sent: 6389 packets, 325431 bytes, 0 dropped


How to determine interface async value 1, 65 or other, look at this

ROUTER-A
show line 
Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
* 0 CTY - - - - - 0 0 4/121606218 -
A 1 AUX 9600/9600 - inout - - - 1 2501 0/0 -
2 VTY - - - - - 0 0 0/0 -
3 VTY - - - - - 0 0 0/0 -
4 VTY - - - - - 0 0 0/0 -
5 VTY - - - - - 0 0 0/0 -
6 VTY - - - - - 0 0 0/0 -


ROUTER-B
show line 
Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
* 0 CTY - - - - - 0 33 2/40237371 -
A 65 AUX 9600/9600 - inout - - - 22 0 0/35770 -
66 VTY - - - - - 0 0 0/0 -
67 VTY - - - - - 0 0 0/0 -
68 VTY - - - - - 0 0 0/0 -
69 VTY - - - - - 0 0 0/0 -
70 VTY - - - - - 0 0 0/0 -