原始文件:Linux IP Alias mini HOWTO 翻译日期:1997/10/23 翻译维护:cwhuang@phys.ntu.edu.tw ----------------------------------------------------------------------------------------------
本文最後修改日期: January 13th 1997.
如何在 Linux 机器上设定 IP 别名(aliasing)
GNU Copyleft 1996/1997 Harish Pillay (h.pillay@ieee.org)
#setting up IP alias interfaces echo "Setting 172.16.3.1, 172.16.3.10, 172.16.3.100 IP Aliases ..." /sbin/ifconfig lo 127.0.0.1 /sbin/ifconfig eth0 up /sbin/ifconfig eth0 172.16.3.1 /sbin/ifconfig eth0:0 172.16.3.10 /sbin/ifconfig eth0:1 172.16.3.100 #setting up the routes echo "Setting IP routes ..." /sbin/route add -net 127.0.0.0 /sbin/route add -net 172.16.3.0 dev eth0 /sbin/route add -host 172.16.3.1 eth0 /sbin/route add -host 172.16.3.10 eth0:0 /sbin/route add -host 172.16.3.100 eth0:1 /sbin/route add default gw 172.16.3.200 #
问: 我如何在具 IP 别名的机器上在不同的 IP 别名号码上接收电子邮件(在一部用 sendmail 的机器上)? 答: * 建立(如果还没有的话)一个档案,例如叫 /etc/mynames.cw.不需要真的是这个 名字,也不一定要放在 /etc 目录下.
* 在那个档案中,放上别名 IP 号码的完整领域名称.如果别名的 IP 没有领域名 称,你可以用这个 IP 本身.
/etc/mynames.cw: ---------------- # /etc/mynames.cw - include all aliases for your machine here; # is a comment. domain.one.net domain.two.com domain.three.org 4.5.6.7
* 在你的 sendmail.cf 档中,在它定义档案类别巨集 Fw 的地方,加上:
. . . ################## # local info # ################## . . # file containing names of hosts for which we receive email Fw/etc/mynames.cw . . .