使用兩個 ip Addess 不需要使用兩張 Network Card

作者:Andrew Choi (蔡健發)

Since : 20 Jun 2001

Last Update : 5 Jun 2006


聲明:任何形式的摘抄必須保留上述作者和http地址

新的 ip = 192.168.0.1 ( 自行決定 )
Netmask = 255.255.255.0 ( 自行決定 )
新的 Host Name = myhost2 ( 自行決定 )

# ifconfig -a

lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1inet 127.0.0.1 netmask ff000000
elxl0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 152.104.4.57 netmask ffffff00 broadcast 152.104.4.255 ether 0:60:8:66:d1:56

Network Card 名稱為 elxl0

# ifconfig elxl0:1 plumb
# ifconfig elxl0:1 192.168.0.1 netmask 255.255.255.0 up
# echo myhost2 > /etc/hostname.elxl0:1

加入 192.168.0.1 myhost2 在 /etc/hosts
127.0.0.1 localhost
152.104.4.57 ns2
192.168.0.1 myhost2

加入 192.168.0.1 255.255.255.0 /etc/netmasks

152.104.4.0 255.255.255.0
192.168.0.0 255.255.255.0

 



E-mail : andrew@tophk.net