分类: LINUX
2008-03-26 15:41:03
详细的可以参考。Linux Network Administrator's Guide (O'Reilly),由Linux Documentation Project提供。
一些参考:
TCP/IP Network Administration (O'Reilly).讲述了在UNIX上面的使用和配置TCP/IP。
DNS and BIND (O'Reilly).
* TCP/IP的概念
可以参考书籍:the first volume of Douglas Comer's Internetworking with TCP/IP (Prentice Hall) and the first volume of W. Richard Stevens' TCP/IP Illustrated (Addison Wesley).
Netstat的说明:
The Flags column of the routing table gives information on the destination address for this entry; U specifies that the route is "up," N that the destination is a network, and so on. The MSS field shows how many bytes are transferred at a time over the respective connection, Window indicates how many frames may be sent ahead before a confirmation must be made, irtt gives statistics on the use of this route, and Iface lists the network device used for the route. On Linux systems, Ethernet interfaces are named eth0, eth1, and so on. lo is the loopback device, which we'll discuss shortly.
Redhat 网络配置脚本/etc/rc.d/init.d/network,SUSE 使用/etc/init.d/network和YaST2。 SUSE和Debian的暂略。
这里我们使用/etc/init.d/rc.inet1来配置硬件和基本连网。使用/etc/init.d/rc.inet2来配置网络服务。然后在/etc/inittab种添加如下使之自动运行:
n1:34:wait:/etc/init.d/rc.inet1
n2:34:wait:/etc/init.d/rc.inet2
#!/bin/sh
# This is /etc/init.d/rc.inet1 - Configure the TCP/IP interfaces
# First, configure the loopback device
HOSTNAME=`hostname`
/sbin/ifconfig lo 127.0.0.1 # uses default netmask 255.0.0.0
/sbin/route add 127.0.0.1 # a route to point to the loopback device
# Next, configure the Ethernet device. If you're only using loopback or
# SLIP, comment out the rest of these lines.
# Edit for your setup.
IPADDR="128.17.75.20" # REPLACE with your IP address
NETMASK="255.255.255.0" # REPLACE with your subnet mask
NETWORK="128.17.75.0" # REPLACE with your network address
BROADCAST="128.17.75.255" # REPLACE with your broadcast address
GATEWAY="128.17.75.98" # REPLACE with your default gateway address
# Configure the eth0 device to use information above.
/sbin/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
# Add a route for our own network.
/sbin/route add ${NETWORK}
# Add a route to the default gateway.
/sbin/route add default gw ${GATEWAY} metric 1
# End of Ethernet Configuration
route add default gw 128.17.75.98
#! /bin/sh
# Sample /etc/init.d/rc.inet2
# Start syslogd
if [ -f /usr/sbin/syslogd ]
then
/usr/sbin/syslogd
fi
# Start inetd
if [ -f /usr/sbin/inetd ]
then
/usr/sbin/inetd
fi
# Start routed
if [ -f /usr/sbin/routed ]
then
/usr/sbin/routed -q
Fi
/etc/networks 使用网络别名。
/etc/host.conf用于设定域名解释查询的顺序。比如:
order hosts,bind
multi on
使用glibc2的系统多数已经用/etc/nsswitch.conf代替了。
网卡状态在/var/log/messages一般有记录。
找不到网卡一般是在LILO (or Grub, or whichever bootloader you are using) boot prompt中没有合适的IRQ和端口地址。
比如:lilo: linux ether=9,0x300,0,1,eth0