How to setup login prompt and grub via serial console

In my Office, I use a relatively small computer devices. I setup those boxes as router, located in network panel room together with switch and cable closet. There’s no monitor or keyboard there. So when there’s any error, I need an quick solutions to see what happened while boot.

I tried this with Ubuntu 10.04. This tutorial is not compatible with Ubuntu below 10.04.

First we set the getty, so we can log-in through serial console.

$ sudo vi /etc/init/ttyS0.conf
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 38400 ttyS0 vt102

Then we setup the grub loader so it can show on serial ports too. Just adjust your grub configuration with this configuration.

$sudo vi /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

After editing grub configuration, we update our grub with this command:

$sudo update-grub

Before we test the grub loader with serial, we should test the getty program. Now, on client computer, we install minicom program. I’m using USB2Serial that detected on port /dev/ttyUSB0. I use 38400 baud speed. Just adjust the 38400 with other speed if you like.

Let’s install the minicom program with this command:

$sudo apt-get install minicom

After that, launch the minicom program. Set the configuration like this. Press ^ao on the minicom screen.

+-----[configuration]------+
| Filenames and paths      |
| File transfer protocols  |
| Serial port setup        |
| Modem and dialing        |
| Screen and keyboard      |
| Save setup as dfl        |
| Save setup as..          |
| Exit                     |
+--------------------------+

Choose “Serial port setup”

+-----------------------------------------------------------------------+
| A -    Serial Device      : /dev/ttyUSB0                              |
| B - Lockfile Location     : /var/lock                                 |
| C -   Callin Program      :                                           |
| D -  Callout Program      :                                           |
| E -    Bps/Par/Bits       : 38400 8N1                                 |
| F - Hardware Flow Control : No                                        |
| G - Software Flow Control : No                                        |
|                                                                       |
|    Change which setting?                                              |
+-----------------------------------------------------------------------+

After done configurating, Save it as default by choosing “Save setup as dfl”. Then Let’s try to initialized the serial by pressing ^am . If success then we have a login prompt.

Ubuntu 10.04 LTS ro-bb-fa-fb-fe ttyS0                                           

ro-bb-fa-fb-fe login:

On the login screen we know that we use serial console by “ttyS0” It’s mean we use serial 0.

Reference:
[1]https://help.ubuntu.com/community/SerialConsoleHowto
[2]http://www.vanemery.com/Linux/Serial/serial-console.html

Buy Sabrent SBT-USC6M USB 2.0 to Serial (9-pin) DB-9 RS-232 (BLUE) at Amazon and get discounted price.

ubuntu 10 04 serial console, grub ttyusb0, GRUB_CMDLINE_LINUX_DEFAULT serial console, set up console ubuntu 10 04 ttys0, Ubuntu grub serial console, grub serial, grub serial console, grub cfg serial console, ubuntu 10 serial console, grub_cmdline_linux_default console

How to find AS Number from an IP

Yesterday there was a slight problem on the office network. IP blocks for upstream B was passed from upstream A. Once the problem is finished, it’s fun to see record ASN from the internet provider company here: http://bgp.he.net/AS7713 (7713 is the U.S. from Telkom)

I’m curios who’s Google peering with? Finally a little Googling found this link, from IP to ASN http://www.team-cymru.org/Services/ip-to-asn.html Finding ASN from IP Address, turned out quite easily.

First we search first one ip from Google. We use the command ‘host www.google.com’ It would appear many ip, I Choose 72.14.213.147, then we use whois command:

whois -h -v whois.cymru.com 72.14.213.103

The result is as below

Warning: RIPE flags Used with a traditional server.
AS   |IP            | BGP Prefix     | CC   | Registry | Allocated  | U.S. Name
15169|72.14.213.103 | 72.14.212.0/23 | U.S. | ARIN     | 2004-11-10 | GOOGLE - Google Inc..

Left column is Google’s ASN. We enter into his looking glass HE.net so it looks like: http://bgp.he.net/AS15169

Please see BGP peering and statistics from Google.

find AS number, as number lookup, google autonomous system number, how to find AS number, find as number for ip, how to check as number, find as from ip, how to find as number for an ip address, as number IP, AS from IP