在solaris 2.x 上建立 virtual host
2024-07-26 00:29:53
供稿:網友
所謂 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 . 你等於有兩張網路卡了