Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19733332
  • 博文数量: 679
  • 博客积分: 10495
  • 博客等级: 上将
  • 技术积分: 9308
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-18 10:51
文章分类

全部博文(679)

文章存档

2012年(5)

2011年(38)

2010年(86)

2009年(145)

2008年(170)

2007年(165)

2006年(89)

分类: LINUX

2008-03-26 15:41:03

§13  网络

 
详细的可以参考。Linux Network Administrator's Guide (O'Reilly),Linux Documentation Project提供。
 

§13.1     使用  TCP/IP 互连

一些参考:

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/networkSUSE 使用/etc/init.d/networkYaST2SUSEDebian的暂略。
        这里我们使用/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
阅读(6388) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-03-26 15:42:30

本章的多数内容和其他书籍重迭,只做一个提要。深入的内容请参考其他书籍。本节不需要再阅读原书。