在solaris 2.x 上建立 virtual host

所谓 virtual host 就是在一台 host 的一张网路卡上
建立一个以上的 ip 位址,每一个 ip 位址 assign 一个
host name . 看起来就好像一部机器有多张网路卡似的 .
主要的应用在 Web Server 的 virtual host 上面,有支援
virtual host 的 Web Server 有 Apache , Netscape ..等.

在 Solaris 2.x 上建立 virtual host 是很容易的一件
事.只须要三个步骤.

1) 在 /etc/hosts 内加上一个 ip 和其 hostname 位址
2) 在 /etc 下加一个档案叫 hostname.nei0:1,其内容为
加在 /etc/hosts 内的 hostname

: nei0 是 solaris x86 的网卡 device 名称
le0 则是 solaris sparc 的网卡名称
3) touch /reconfigure & reboot

这样在同一张网卡上就可以同时跑两个以上的 ip

for example ...

# ifconfig -a
lo0: flags=849 mtu 8232
inet 127.0.0.1 netmask ff000000
nei0: flags=863 mtu 1500
inet 140.96.161.22 netmask ffffff00 broadcast 140.96.161.255

# vi /etc/hosts
127.0.0.1 localhost
140.96.161.22 p2ksol1 loGhost
140.96.161.10 p2ksol2 loghost <== 新增的
:wq

# vi /etc/hostname.nei0:1
p2ksol2
:wq

# touch /reconfigure;sync;sync;sync;reboot
....

# ifconfig -a
lo0: flags=849 mtu 8232
inet 127.0.0.1 netmask ff000000
nei0: flags=863 mtu 1500
inet 140.96.161.22 netmask ffffff00 broadcast 140.96.161.255
nei0:1: flags=863 mtu 1500
inet 140.96.161.10 netmask ffffff00 broadcast 140.96.161.255

OK . 你等於有两张网路卡了

    推荐阅读