INET 网络自动配置学习

Configuring IPv4 Networks

IPv4网络包括节点(hosts, routers, switches, hubs, Ethernet buses, or wireless access points),节点具有一个IPv4网络层(hosts,routers),必须在仿真开始阶段配置。multicast forwarding则需要配置multicast routing tables。
配置可以是人工完成,也可以是自动的。
Ipv4NetworkConfigurator(INET1.99.4之后支持)可以支持人工/自动混合配置。Ipv4NetworkConfigurator可以为每个接口配置IP地址,可以通过合并路由表项优化生成路由表。

configurator工作步骤
  1. 建立网络拓扑图,图包括顶点(@node property)包括hosts, routers, and L2 devices like switches, access points, Ethernet hubs, etc,同时为每个边设置权重,利用最短路径算法建立路由。*##–权重–##*如果IP转发功能被设置为disabled,权重为infinite,所有其他的节点(routers and and L2 devices)为0。边权重和 链路的比特速率成反比。在configurator内部有一个表包括 all “links”(the link data structure consists of the set of network interfaces that are on the same point-to-point link or LAN)。
  2. 人工配置provided in the XML format,可以添加静态路由。
    (原文:Assigns IP addresses to all interfaces of all nodes. The assignment process takes into consideration the addresses and netmasks already present on the interfaces (possibly set in earlier initialize stages), and the configuration provided in the XML format (described below). The configuration can specify “templates” for the address and netmask, with parts that are fixed and parts that can be chosen by the configurator (e.g. “10.0.x.x”). In the most general case, the configurator is allowed to choose any address and netmask for all interfaces (which results in automatic address assignment). In the most constrained case, the configurator is forced to use the requested addresses and netmasks for all interfaces (which translates to manual address assignment). There are many possible configuration options between these two extremums. The configurator assigns addresses in a way that maximizes the number of nodes per subnet. Once it figures out the nodes that belong to a single subnet it, will optimize for allocating the longest possible netmask. The configurator might fail to assign netmasks and addresses according to the given configuration parameters; if that happens, the assignment process stops and an error is signalled.
    3 Adds the manual routes that are specified in the configuration.
    4 Adds static routes to all routing tables in the network. The configurator uses Dijkstra’s weighted shortest path algorithm to find the desired routes between all possible node pairs. Then it will populate the routing tables with entries to allow accessing all destination Interfaces in the network. The configurator can be safely instructed to add default routes where applicable, significantly reducing the size of the host routing tables. It can also add subnet routes instead of interface routes further reducing the size of routing tables. Turning on this option requires careful design to avoid having IP addresses from the same subnet on different links. CAVEAT: Using manual routes and static route generation together may have unwanted side effects, because route generation ignores manual routes.
    5 Then it optimizes the routing tables for size. This optimization allows configuring larger networks with smaller memory footprint and makes the routing table lookup faster. The resulting routing table might be different in that it will route packets that the original routing table did not. Nevertheless the following invariant holds: any packet routed by the original routing table (has matching route) will still be routed the same way by the optimized routing table.
    6 Finally it dumps the requested results of the configuration. It can dump network topology, assigned IP addresses, routing tables and its own configuration format.)
网络拓扑图

An IP node is a node that contains an InterfaceTable and a Ipv4RoutingTable
router是一个IP节点,有多个网络接口,可以进行IP转发,在多播路由器中forwardMulticast parameter is also set to true.

无线链路(Wireless links are identified by the ssid or accessPointAddress parameter of the 802.11 management module. Wireless interfaces whose node does not contain a management module are supposed to be on the same wireless link. Wireless links can also be configured in the configuration file of Ipv4NetworkConfigurator:

<config>
  <wireless hosts="area1.*" interfaces="wlan*">
</config>

分配地址

(不明确的部分用x代替)Unspecified fields are given as an “x” character in the dotted notation of the address.

<config>
  <interface hosts="area11.lan1.*" address="10.11.1.x" netmask="255.255.255.x"/>
  <interface hosts="area11.lan2.*" address="10.11.2.x" netmask="255.255.255.x"/>
  <interface hosts="area12.lan1.*" address="10.12.1.x" netmask="255.255.255.x"/>
  <interface hosts="area12.lan2.*" address="10.12.2.x" netmask="255.255.255.x"/>
  <interface hosts="area*.router*" address="10.x.x.x" netmask="x.x.x.x"/>
  <interface hosts="*" address="10.x.x.x" netmask="255.x.x.0"/>
</config>
  • hosts (optional)主机名称host name patterns,只有接口名会受该属性影响,The default value is “” that matches all hosts. e.g. “subnet.client” or “host* router[0…3]” or “area*.*.host[0]”
  • names (optional)接口名,The default value is “” that matches all interfaces. e.g. “eth ppp0” or “*”
  • towards(optional)指向host name patterns,只有连接hosts的接口受影响。 The default value is “”. e.g. “ap” or “server” or “client
  • among(optional)指明host name,在这些host之间的接口受影响。The ’among=”X Y Z”’ is same as ’hosts=”X Y Z” towards=”X Y Z”’.
  • address(optional)限制可分配地址的范围,Wildcards are allowed with using ’x’ as part of the address in place of a byte. Unspecified parts will be filled automatically by the configurator. The default value “” means that the address will not be configured. Unconfigured interfaces still have allocated addresses in their subnets allowing them to become configured later very easily. e.g. “192.168.1.1” or “10.0.x.x”
  • netmask(optional)限制可分配子网的范围,Unspecified parts will be filled automatically be the configurator. The default value “” means that any netmask can be configured. e.g. “255.255.255.0” or “255.255.x.x” or “255.255.x.0”
  • mtu(optional)number Optional parameter attribute to set the MTU parameter in the interface. When unspecified the interface parameter is left unchanged.
  • metric(optional)set the Metric parameter in the interface. When unspecified the interface parameter is left unchanged.
多播

属于多播组的接口可以自动加入group,adds all Ethernet interfaces of nodes whose name starts with “router” to the 224.0.0.5 multicast group:

<config>
  <multicast-group hosts="router*" interfaces="eth*" address="224.0.0.5"/>
</config>
  • hosts:a list of host name patterns
  • interface:a list of interface name patterns
  • towards:规定一组host
  • among:规定一组host
  • address:规定a list of multicast group addresses to be assigned, Values must be selected from the valid range of multicast addresses. e.g. “224.0.0.1 224.0.1.33”
人工路由配置
  • hosts Optional selector attribute that specifies a list of host name patterns. Only routing tables in the specified hosts are affected. The default value “” means all hosts will be affected. e.g. “host* router[0…3]”

  • destination Optional parameter attribute that specifies the destination address in the route (L3AddressResolver syntax). The default value is “”. e.g. “192.168.1.1” or “subnet.client[3]” or “subnet.server(ipv4)” or “

  • netmask Optional parameter attribute that specifies the netmask in the route. The default value is “”. e.g. “255.255.255.0” or “/29” or “

  • gateway Optional parameter attribute that specifies the gateway (next-hop) address in the route (L3AddressResolver syntax). When unspecified the interface parameter must be specified. The default value is “”. e.g. “192.168.1.254” or “subnet.router” or “

  • interface Optional parameter attribute that specifies the output interface name in the route. When unspecified the gateway parameter must be specified. This parameter has no default value. e.g. “eth0”

  • metric Optional parameter attribute that specifies the metric in the route. The default value is 0.

多播人工配置地址

The following example adds an entry to the multicast routing table of router1, that intsructs the routing algorithm to forward multicast datagrams whose source is in the 10.0.1.0 network and whose destinatation address is 225.0.0.1 to send on the eth1 and eth2 interfaces assuming it arrived on the eth0 interface:

<multicast-route hosts="router1" source="10.0.1.0" netmask="255.255.255.0"
                 groups="225.0.0.1" metric="10"
                 parent="eth0" children="eth1 eth2"/>
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值