Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4250428
  • 博文数量: 601
  • 博客积分: 15410
  • 博客等级: 上将
  • 技术积分: 6884
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-16 08:11
个人简介

独学而无友,则孤陋而寡闻!

文章分类

全部博文(601)

文章存档

2020年(1)

2018年(4)

2017年(7)

2016年(42)

2015年(25)

2014年(15)

2013年(36)

2012年(46)

2011年(117)

2010年(148)

2009年(82)

2008年(37)

2007年(41)

分类: BSD

2010-12-12 17:38:01

[20090105] The Release Notes for 7.1-RELEASE should have mentioned that FreeBSD now supports multiple routing tables. To enable this, the following steps are needed:

Add the following kernel configuration option and rebuild the kernel. The 2 is the number of FIB (Forward Information Base, synonym for a routing table here). The maximum value is 16.
options    ROUTETABLES=2

The procedure for rebuilding the FreeBSD kernel is described in the FreeBSD Handbook.

This number can be modified on boot time. To do so, add the following to /boot/loader.conf and reboot the system:
net.fibs=6

Set a loader tunable net.my_fibnum if needed. This means the default number of routing tables. If not specified, 0 will be used.

Set a loader tunable net.add_addr_allfibs if needed. This enables to add routes to all FIBs for new interfaces by default. When this is set to 0, it will only allocate routes on interface changes for the FIB of the caller when adding a new set of addresses to an interface. Note that this tunable is set to 1 by default.

To select one of the FIBs, the new setfib(1) utility can be used. This set an associated FIB with the process. For example:
# setfib -3 ping target.example.com

The FIB #3 will be used for the ping(8) command.

The FIB which the packet will be associated with will be determined in the following rules:

All packets which have a FIB associated with them will use the FIB. If not, FIB #0 will be used.

A packet received on an interface for forwarding uses FIB #0.

A TCP listen socket associated with an FIB will generate accept sockets which are associated with the same FIB.

A packet generated in response to other packet uses the FIB associated with the packet being responded to.

A packet generated on tunnel interfaces such as gif(4) and tun(4) will be encapsulated using the FIB of the process which set up the tunnel.

Routing messages will be associated with the process's FIB.

Also, the ipfw(8) now supports an action rule setfib. The following action:
setfib fibnum

will make the matched packet use the FIB specified in fibnum. The rule processing continues at the next rule.
阅读(7473) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~