Chinaunix首页 | 论坛 | 博客
  • 博客访问: 122051
  • 博文数量: 90
  • 博客积分: 1370
  • 博客等级: 中尉
  • 技术积分: 1005
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-20 20:37
文章分类

全部博文(90)

文章存档

2012年(90)

分类: IT业界

2012-01-08 14:01:45

一块网卡两个ip

方法一:
编辑/etc/hostname.iprb0:1
编辑/etc/hosts

方法二:
把下列内容加到/etc/rc2里
ifconfig iprb0:1 192.168.2.57.netmask 255.255.255.0


一块网卡帮定三个ip,并且子网掩码不同

作者:zico

搞定!如下:
/etc/hosts
127.0.0.1 localhost
210.xxx.xx1.xx dbs loghost
192.168.9.15 mytestip
192.168.9.65 mytestip2

/etc/netmasks
210.xx.xx.0 255.255.255.0
192.168.9.0 255.255.255.192
192.168.9.64 255.255.255.252

/etc/hme0
dbs
/etc/hme0:1
mytestip
/etc/hme0:2
mytestip2

#init 6

...

#ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
inet 210.xxx0.2xx.xx netmask ffffff00 broadcast 210.82.31.255
hme0:1: flags=1000843 mtu 1500 index 2
inet 192.168.9.15 netmask ffffffc0 broadcast 192.168.9.63
hme0:2: flags=1000843 mtu 1500 index 2
inet 192.168.9.65 netmask fffffffc broadcast 192.168.9.67




sun官方网站


1. How can I bind multiple (virtual) IP addresses to a single network interface card ?

The following steps demonstrate how to configure the ethernet (elx0) device to support more than one IP address.

Create a text file in the /etc directory called hostname.elx0:1 and add this entry to file:
virtual

Add this IP address and hostname in the /etc/hosts file:
10.0.0.1 virtual

Create a new script file in the /etc/rc2.d directory called S70virtual, and add these entries in this file (for permanent change):
ifconfig elx0:1 10.0.0.1 up netmask 255.255.255.0

Reboot the system.
To delete a logical interface, use the unplumb command . For example,

example% ifconfig elx0:1 down unplumb will delete the logical interface elx0:1.
阅读(557) | 评论(0) | 转发(0) |
0

上一篇:X86下CPU状态查看

下一篇:SSH 安装

给主人留下些什么吧!~~