Chinaunix首页 | 论坛 | 博客
  • 博客访问: 631702
  • 博文数量: 197
  • 博客积分: 4858
  • 博客等级: 上校
  • 技术积分: 2162
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-06 22:46
文章分类

全部博文(197)

文章存档

2011年(30)

2010年(21)

2009年(25)

2008年(80)

2007年(41)

分类: BSD

2008-11-17 13:49:13

freebsd 单一网卡配置多个IP
如果一块网卡以前的IP是192.168.30.3,现在在添加多个IP,可以rc.conf 中作如下设置,lnc0是设备名
代码:
ifconfig_lnc0="inet 192.168.30.3 netmask 255.255.255.0" 
ifconfig_lnc0_alias0="inet 192.168.30.1 netmask 255.255.255.255" 
ifconfig_lnc0_alias1="inet 192.168.30.2 netmask 255.255.255.255"
指定的IP地址和你在一个子网,别名后面的netmask应是255.255.255.255,
如果指定IP位于不同子网,用相应子网的netmask.

代码:
man ifconfig //有如下说明 

alias      Establish an additional network address for this interface.     This 
                is sometimes useful when changing network numbers, and one wishes 
                to accept packets addressed to the old interface.     If the address 
                is on the same subnet as the first network address for this 
                interface, a non-conflicting netmask must be given.     Usually 
                0xffffffff is most appropriate.
阅读(626) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~