Chinaunix首页 | 论坛 | 博客
  • 博客访问: 735606
  • 博文数量: 803
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 5015
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 10:29
文章分类

全部博文(803)

文章存档

2011年(1)

2008年(802)

我的朋友

分类:

2008-10-29 11:49:14


  在这个地址:,可以找到最新版的各种
  以太网卡的驱动程序的版,这些驱动程序一般也包括在了标准的Linux内核源码包里:
  cd /usr/src/linux
  make menuconfig
  一开始有一个提示性的问题:“Prompt for development and/or incomplete code/drivers”
  _________________________
  /
  图1:内核编译时的菜单界面
  \_________________________/
  回答“Y”就可以了,当然如果你不需要这些版的驱动程序最好。
  
  下面讲一下如何在一台机子上配双网卡。
  首先在内核编译的时候,把网卡驱动程序编译成模块。PCI卡可以自动被检测到,ISA卡就要手
  工设一下端口和中断:要手工编辑/etc/conf.modules。比方说你有两块NE2000兼容网卡:
  ___________________________
  /
  /etc/conf.modules
  ...
  alias eth0 ne
  alias eth1 ne
  options ne io=0x240, 0x300
  ...
  \___________________________/
  
  这个顺序就是按照eth0,eth1下来的。
  还有一个方法就是把网卡驱动程序编译进内核。那么为了让Linux识别两块网卡,就要在LILO上
  做手术:
  ________________________________________________
  /
  /etc/lilo.conf
  ...
  append="ether=5,0x300,eth0 ether=15,0x280,eth1"
  ...
  \________________________________________________/
  ____________________________________
  /
  图2:dmesg显示的和以太网卡相关的内容
  \____________________________________/
  
  =>设置域名
  
  对于拨号用户来说,需要的是缓存域名服务。
  先来配置/etc/named.conf,这是named启动的时候要用到的:
  ________________________________________________________________________
  /
  // Config file for caching only name server
  
  options {
  directory "/var/named"; // 这是named的缺省工作目录
  
  // Uncommenting this might help if you have to go through a
  // firewall and things are not working out:
  
  // query-source port 53;
  };
  
  zone "." {
  type hint;
  file "root.hints";
  };
  
  zone "0.0.127.in-addr.arpa" {
  type master;
  file "pz/127.0.0";
  };
  \________________________________________________________________________/
  
  接下来是/var/named/root.hints,这其实就是世界各地的根域名:
  _____________________________________________________________
  /
  . 6D IN NS G.ROOT-SERVERS.NET.
  . 6D IN NS J.ROOT-SERVERS.NET.
  . 6D IN NS K.ROOT-SERVERS.NET.
  . 6D IN NS L.ROOT-SERVERS.NET.
  . 6D IN NS M.ROOT-SERVERS.NET.
  . 6D IN NS A.ROOT-SERVERS.NET.
  . 6D IN NS H.ROOT-SERVERS.NET.
  . 6D IN NS B.ROOT-SERVERS.NET.
  . 6D IN NS C.ROOT-SERVERS.NET.
  . 6D IN NS D.ROOT-SERVERS.NET.
  . 6D IN NS E.ROOT-SERVERS.NET.
  . 6D IN NS I.ROOT-SERVERS.NET.
  . 6D IN NS F.ROOT-SERVERS.NET.
  
  G.ROOT-SERVERS.NET. 5w6d16h IN A 192.112.36.4
  J.ROOT-SERVERS.NET. 5w6d16h IN A 198.41.0.10
  K.ROOT-SERVERS.NET. 5w6d16h IN A 193.0.14.129
  L.ROOT-SERVERS.NET. 5w6d16h IN A 198.32.64.12
  M.ROOT-SERVERS.NET. 5w6d16h IN A 202.12.27.33
  A.ROOT-SERVERS.NET. 5w6d16h IN A 198.41.0.4
  H.ROOT-SERVERS.NET. 5w6d16h IN A 128.63.2.53
  B.ROOT-SERVERS.NET. 5w6d16h IN A 128.9.0.107
  C.ROOT-SERVERS.NET. 5w6d16h IN A 192.33.4.12
  D.ROOT-SERVERS.NET. 5w6d16h IN A 128.8.10.90
  E.ROOT-SERVERS.NET. 5w6d16h IN A 192.203.230.10
  I.ROOT-SERVERS.NET. 5w6d16h IN A 192.36.148.17
  F.ROOT-SERVERS.NET. 5w6d16h IN A 192.5.5.241
  \_____________________________________________________________/
  
  然后是/var/named/pz/127.0.0,我们先给出一个例子:
  __________________________________________________________________________
  /
  @ IN SOA ns.linux.bogus. hostmaster.linux.bogus. (
  1 ; Serial
  8H ; Refresh
  2H ; Retry
  1W ; Expire
  1D) ; Minimum TTL
  NS ns.linux.bogus.
  1 PTR localhost.
  \__________________________________________________________________________/
  
  这就是一个zone file,这里包括有3种“Resource Records”:
  SOA,Start Of Authority RR
  NS,Name Server RR
  PTR。
  第一行上的“@”,就是指named.conf中这个zone file所对应的本地zone:0.0.127.in-addr.arpa。
  NS RR前面有一个缺省的“@”没有写出来,NS这行就是说linux.bogus域的域名服务器就是ns.linux.bogus。
  PTR RR这行说明这个zone file所对应的本地zone的127.0.0.1这台机子是localhost。
  SOA RR说明这个zone file所在的机子叫做ns.linux.bogus,负责人是hostmaster@linux.bogus,
  该zone file的版本号是“1 ; Serial”。
  
  最后是/etc/resolv.conf:
  ________________________________________________
  /
  search subdomain.your-domain.edu your-domain.edu
  nameserver 127.0.0.1
  \________________________________________________/
  
  search这行的意思就是,如果你寻找moifa,那么实际上就是moifa.your-domain.edu。
  nameserver就是指定你的域名服务器啦,如果你有其他的域名服务器,可以多加几个nameserver行。
  
  下面我们启动named,然后用nslookup来检查一下,是否named已经正常工作了。
  _______________
  /
  演示:nslookup
  \_______________/
  
  接下来我们建立一个公司内部网上的真域名服务。
  先在named.conf里加上一个新的zone:
  _____________________________
  /
  zone "linux.bogus" {
  notify no;
  type master;
  file "pz/linux.bogus";
  };
  \_____________________________/
  
  下面我们来编辑我们真域名的zone file:
  _______________________________________________________________________________
  /
  @ IN SOA ns.linux.bogus. hostmaster.linux.bogus. (
  199802151 ; serial, todays date + todays serial #
  8H ; refresh, seconds
  2H ; retry, seconds
  1W ; expire, seconds
  1D ) ; minimum, seconds;
  NS ns ; Inet Address of name server
  MX 10 mail.linux.bogus. ; Primary Mail Exchanger
  MX 20 mail.friend.bogus. ; Secondary Mail Exchanger;
  localhost A 127.0.0.1
  ns A 192.168.196.2
  www A ns
  mail A 192.168.196.4
  \_______________________________________________________________________________/
  
  最后我们再来看一下reverse zone。所谓zone,就是把域名转化为ip地址;所谓reverse zone就是
  把ip地址转化为域名。
  __________________________________
  /
  zone "196.168.192.in-addr.arpa" {
  notify no;
  type master;
  file "pz/192.168.196";
  };
  \__________________________________/
  ________________________________________________________________________
  /
  @ IN SOA ns.linux.bogus. hostmaster.linux.bogus. (
  199802151 ; Serial, todays date + todays serial
  8H ; Refresh
  2H ; Retry
  1W ; Expire
  1D) ; Minimum TTL
  NS ns.linux.bogus.
  
  1 PTR gw.linux.bogus.
  2 PTR ns.linux.bogus.
  3 PTR donald.linux.bogus.
  4 PTR mail.linux.bogus.
  5 PTR ftp.linux.bogus.
  \________________________________________________________________________/
  
  =>
  
  第一步,编译内核,在内核中加入ip masquerade的支持。
  再安装上ipfwadm这个软件包就可以了。下面就开始动手配置。
  ______________________________________________________________________________________________
  /
  #!/bin/sh
  #
  # /etc/rc.d/rc.firewall, define the firewall configuration, invoked from
  # rc.local.
  #
  
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
  
  ipfwadm -I -f
  ipfwadm -I -p deny
  ipfwadm -I -a accept -V 192.168.255.1 -S 192.168.0.0/16 -D 0.0.0.0/0
  ipfwadm -I -a deny
【责编:admin】

--------------------next---------------------

阅读(372) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~