Tuesday, September 11, 2007

COMMAND-MANUAL

Network command manual
1. Configure network
2. telnet - user interface to the TELNET protocol
3. ftp - ARPANET file transfer program
4. rdate - get the date and time via the network
ifconfig
Add a new ip address to existing interface
ifconfig eth0:0 202.144.157.211 \
broadcast 202.144.157.223 \
netmask 255.255.255.240
route add -host 202.144.157.211 dev eth0:0

Configure network
Sample Network
IP Address
1 192.168.1.0 Network Address
2 192.168.1.2 Red Hat Linux Server DNS, E-Mail, etc
3 192.168.1.3 Windows Assign from DHCP
...........
• /etc/sysconfig/network
NETWORKING=yes
FORWARD_IPV4=false
HOSTNAME=ns
DOMAINNAME=rim
GATEWAY=
GATEWAYDEV=
NISDOMAIN=""
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes
/etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.1.2 ns ns.grape-info.com
/etc/resolv.conf
search grape-info.com
/etc/resolv.conf
search grape-info.com
nameserver 192.168.1.2
nameserver 202.144.129.34
nameserver 202.144.128.200
Notice
DNS Server's IP Address
1 nameserver 192.168.1.2 DNS Server
2 nameserver 202.144.129.34 ISP DNS Server
3 nameserver 202.144.128.200 ISP DNS Server
telnet - user interface to the TELNET protocol
The telnet command is used for interactive communication with another host using the TELNET protocol.
telnet [host] [port]
host Specifies a host to contact over the network.
port Specifies a port number or service name to contact. If not specified, the telnet port (23) is used.
• Connect to another host
[root@myhost /]# telnet hostname
Trying xxx.xxx.xxx.xxx...
Connected to localhost.
Escape character is '^]'.

Red Hat Linux release 5.2(J) (crimson)
Kernel 2.0.36 on an i586
login: hoge
Password:
Last login: Sun Aug 29 22:22:55 from hoge
[hoge@hostname hoge]$
• Connect to news server
[root@myhost /root]# telnet localhost nntp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
200 myhost.grape-info.com InterNetNews server INN 1.7.2 08-Dec-1997 ready
LIST
215
control 0000000000 0000000001 y
junk 0000000000 0000000001 y
test 0000000000 0000000001 y
to 0000000000 0000000001 y
.
QUIT
205 .
Connection closed by foreign host.
ftp - ARPANET file transfer program
Ftp is the user interface to the ARPANET standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site.
• ftp [host]
[root@myhost /root]# ftp hostname
Connected to hostname.
220 hostname.grape-info.com FTP server (Version wu-2.5.0(1) Tue Jun 8 11:19:44 EDT 1999) ready.
Name (hostname:username): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 6
drwxr-xr-x 6 root root 1024 Aug 28 01:08 .
drwxr-xr-x 6 root root 1024 Aug 28 01:08 ..
d--x--x--x 2 root root 1024 Aug 28 01:08 bin
d--x--x--x 2 root root 1024 Aug 28 01:08 etc
drwxr-xr-x 2 root root 1024 Aug 28 01:08 lib
dr-xr-sr-x 2 root ftp 1024 Sep 11 1998 pub
226 Transfer complete.
! [command [args]] Invoke an interactive shell on the local machine. If there are arguments, the first is taken to be a command to execute directly, with the rest of the arguments as its arguments.
account [passwd] Supply a supplemental password required by a remote system for access to resources once a login has been successfully completed. If no argument is included, the user will be prompted for an account password in a non-echoing input mode.
ascii Set the file transfer type to network ASCII. This is the default type.
binary Set the file transfer type to support binary image transfer.
bye Terminate the FTP session with the remote server and exit ftp. An end of file will also terminate the session and exit.
cd remote-directory Change the working directory on the remote machine to remote directory.
get remote-file [local-file] Retrieve the remote-file and store it on the local machine. If the local file name is not specified, it is given the same name it has on the remote machine, subject to alteration by the current case, ntrans, and nmap settings. The current settings for type, form, mode, and structure are used while transferring the file.
hash Toggle hash-sign (``#'') printing for each data block transferred. The size of a data block is 1024 bytes.
ls [remote-directory] [local-file] Print a listing of the contents of a directory on the remote machine. The listing includes any system-dependent information that the server chooses to include; for example, most UNIX systems will produce output from the command `ls -l'. (See also nlist.) If remote-directory is left unspecified, the current working directory is used. If interactive prompting is on, ftp will prompt the user to verify that the last argument is indeed the target local file for receiving ls output. If no local file is specified, or if local-file is `-', the output is sent to the terminal.
open host [port] Establish a connection to the specified host FTP server. An optional port number may be supplied, in which case, ftp will attempt to contact an FTP server at that port. If the autologin option is on (default), ftp will also attempt to automatically log the user in to the FTP server (see below).
put local-file [remote-file] Store a local file on the remote machine. If remote-file is left unspecified, the local file name is used after processing according to any ntrans or nmap settings in naming the remote file. File transfer uses the current settings for type, format, mode, and structure.
pwd Print the name of the current working directory on the remote machine.
quit A synonym for bye.
user user-name [password] [account] Identify yourself to the remote FTP server. If the password is not specified and the server requires it, ftp will prompt the user for it (after disabling local echo). If an account field is not specified, and the FTP server requires it, the user will be prompted for it. If an account field is specified, an account command will be relayed to the remote server after the login sequence is completed if the remote server did not require it for logging in. Unless ftp is invoked with ``auto-login'' disabled, this process is done automatically on initial connection to the FTP server.
rdate - get the date and time via the network
• SYNOPSIS
rdate [-p] [-s] [host...]
• DESCRIPTION
Rdate uses TCP to retrieve the current time of another machine using using the protocol described in RFC 868. The time for each system is returned in ctime(3) format. The following is an example:
% rdate uci mc
[uci] Sun Mar 24 20:35:41 1985
[mc] Sun Mar 24 20:36:19 1985
• OPTIONS
-p Print the time retrieved from the remote machines. This is the default mode.
-s Set the local system time from the time retrieved from the remote machine. This, quite naturally, is only effective for root.

No comments: