一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

Improving server management with Minicom and conserver

 昵稱7585456 2011-08-30

Improving server management with Minicom and conserver

By Paul Virijevich on September 06, 2006 (8:00:00 AM)

 Share     Print     Comments   

With all of the redundancy in today's servers, its easy to think that you will never need serial port access to your shiny new server. But what do you do when you're at home and your server is at the data center, and your trusty friend SSH fails you? Go back to where remote access started -- a console server.

Trust me, there will be a time when the network goes down, or maybe you'll need to get into a server's BIOS to change a setting, or boot it in single-user mode. Without physical access, or an expensive remote management card, none of this is possible. However, with a little open source software and some cheap hardware, you can set up a remote console server for multiple machines. We'll take a look at two programs that can help: Minicom, for when networking is down and to view BIOS and boot screens, and conserver, for day-to-day console access.

You'll also need some hardware. First, scrape up an older machine to use as a console server. It need not be very powerful; just about anything that runs Linux will work. It probably will have two on-board serial ports. You can buy an additional four-port serial card for around $40. Six-foot null modem cables to connect servers to the console server should cost you about $3. If you throw in a modem, you will be able to get into the console server even if the local LAN is down.

Get started by enabling terminal logins to the servers. Once you've connected the null modem cables from the servers to your new console server, check the servers' /etc/inittab files and make sure you have a line like this on them all (but not on the console server):

S0:12345:respawn:/sbin/agetty -L 57600 ttyS0 vt102 

This tells init to spawn a console on the serial line ttyS0 (think of it like COM1 in Windows) at the speed of 57600bps. This example assumes you have agetty installed. If not, use your distribution's package manager to install it first, or if your distribution installs mgetty instead, feel free to use it.

To enable root logins on the servers, edit the file /etc/securetty and add the line:

ttyS0

Now for a quick test of serial connectivity. On the console server, issue the command:

cat </dev/ttyS0 

This listens on the serial port and prints anything it receives to standard output. On the server, issue the command:

echo console server test >/dev/ttyS0 

This echoes the phrase "console server test" to the serial port. If you see this phrase appear on the console server, you know serial communication is working, and you can do something useful with it.

To start, try Minicom, which is included with just about every distribution. Minicom is useful for viewing BIOS and startup messages. Run Minicom from the command line on the console server. By default, Minicom points to the serial line linked to /dev/modem. Change this by bringing up Minicom in setup mode with:

minicom -s 

This brings up a pretty self-explanatory GUI for altering Minicom's settings. We are concerned with Serial port setup. Change the serial device to the serial line corresponding to the server you want to connect to. For instance, imagine you have two servers hooked up to your console server -- servers A and B. Server A is attached via null modem cable to /dev/ttyS0 and server B is attached to /dev/ttyS1. If you want to view server B's console, change this setting to /dev/ttyS1. You can also go in and change the speed of the line, but the default of 9600bps will work for our purposes.

Now, from a command line, enter:

minicom -o 

This starts Minicom without any modem initialization strings. In a matter of seconds you should see a console login prompt for server you are attaching to. At this point you have a rudimentary console server; now let's take a little further.

One of the main benefits of a console server is the ability to get into the BIOS and view system initialization. To view BIOS output, the server's motherboard needs to support redirecting output to a serial port. This feature is standard on just about every server motherboard. If you are using a "white box PC" for a server, your mileage may vary. Viewing the system's startup messages is a sure thing either way. For GRUB's /boot/grub/menu.lst add:

console=ttyS0,9600 

and for LILO's /etc/lilo.conf add:

serial=0,9600n8 

to the options for the kernel you want to boot. This needs to be changed on each server.

At this point, you've got everything you need to log in to remote servers and change BIOS settings. However, Minicom can be cumbersome when it comes to viewing multiple consoles. It also lacks some of the useful features found in conserver.

To use conserver, each server you want to monitor needs to run the conserver server. The console server that you log into to check on your servers will run the conserver client. Installing both server and client is simple, and can be accomplished with the usual ./configure;make;make install. If you have the OpenSSL libraries installed, use./configure --with-openssl to enable encrypted communication. The servers will run /usr/local/sbin/conserver and the console server will attach to them with the client /usr/local/bin/console.

On your servers, create the directory /usr/local/etc/ if it does not exist, and copy to it the files conserver.cf and conserver.passwd from the conserver.cf subdirectory of the conserver download. The password file is pretty self-explanatory. Any username followed by *passwd* tells conserver to use the system password for that user. Just add in your own username and use that user's system password.

You also need to add the line:

console 782/tcp conserver # console server 

to the file /etc/services on all servers. Conserver uses TCP/IP for its communication between servers. This means conserver will not work if networking is down. In that case, you'd have to go back to Minicom. So why use conserver at all? The answer is logging, and the ability to create a master conserver that can connect to multiple servers. Conserver also allows multiple users to attach to the same console. This can be useful for training purposes. You can also move from console to console within the client.

Let's take a look at a sample conserver configuration. Here is a sample conserver.cf:

### set up global access
default full { rw *; }

### set the defaults for all the consoles
# these get applied before anything else
default * {
# The '&' character is substituted with the console name
logfile /var/consoles/&;
# timestamps every hour with activity and break logging
timestamp 1hab;
# include the 'full' default
include full;
# master server is localhost
master localhost;
}

console shell {
master localhost;
timestamp 5;
type exec;
exec "";
}

console ssh {
type exec;
exec ssh localhost;
}

### define a group of users
group sysadmin {
users youruser;
}

### list of clients we allow
access * {
allowed 192.168.0.0/16;
trusted 127.0.0.1;
}

Overall it is pretty simple. We set up some defaults for use by all consoles, define a couple of consoles (shell and ssh), define a list of users, and then define what networks have access to the server.

From your console server, you can now issue the command:

console -l youruser shell 

This should prompt for the password for the user youruser. Once authenticated, you will see this prompt:

[Enter `^Ec?' for help] 

Entering Ctrl-E c ? displays the conserver help menu. Entering Ctrl-E c a will attach you to the console. Entering Ctrl-E c ; allows you to type in the name of any other consoles in your conserver.cf file and attach to them. In this example, we can also attach to the ssh console.

The console client expects to connect to a server with the name of console, which means you need to add an alias for each server to /etc/hosts or in DNS or you will get an error.

The directory /var/consoles/ now contains a log file for each console (shell and ssh). All console output created while attached is now logged in those files. If you leave one of these consoles running, you can capture error messages on the console that you might otherwise never see.

The combination of Minicom and conserver gives system administrators a cost-effective way to manage servers. With Minicom up and running, you can change BIOS settings and drop into run-level one without traveling to the remote location. If you have conserver, you can disable a user's SSH access to a machine and force the use of conserver (with SSL encryption of course). This technique could be handy for logging those situations where no one seems to know who accidentally deleted an important file. It can also help out when you forget what you did to fix something a week after the fact.

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    亚洲成人久久精品国产| 日本人妻精品有码字幕| 国产一区二区三区丝袜不卡| 色婷婷激情五月天丁香| 东北老熟妇全程露脸被内射| 国产成人人人97超碰熟女| 韩国日本欧美国产三级| 欧美精品久久99九九| 国产欧美日韩精品自拍| 欧美三级不卡在线观线看| 国产精品免费视频久久| 人妻偷人精品一区二区三区不卡| 国产精品大秀视频日韩精品| 欧美成人精品一区二区久久| 大香蕉再在线大香蕉再在线| 丝袜视频日本成人午夜视频| 久一视频这里只有精品| 99视频精品免费视频| 黄片免费播放一区二区| 99视频精品免费视频播放| 国产av一区二区三区久久不卡| 国产永久免费高清在线精品| 国内精品美女福利av在线| 国产精品一区二区三区黄色片| 日本加勒比系列在线播放| 久热在线视频这里只有精品| 男人和女人草逼免费视频| 黄色av尤物白丝在线播放网址 | 好吊妞在线免费观看视频| 日本深夜福利在线播放| 一区二区三区日本高清| 日本在线 一区 二区| 丝袜美女诱惑在线观看| 亚洲日本加勒比在线播放| 免费特黄欧美亚洲黄片| 亚洲视频在线观看免费中文字幕| 91欧美日韩中在线视频| 国产精品不卡免费视频| 亚洲国产成人爱av在线播放下载| 日本一本不卡免费视频| 色婷婷视频国产一区视频|