Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:dpi:dpi_options:router:start [2021/05/31 14:40] – edrudichgmailcom | en:dpi:dpi_options:router:start [2022/03/29 13:29] (current) – removed edrudichgmailcom | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 20 Router ====== | ||
- | {{indexmenu_n> | ||
- | <note warning> | ||
- | <note important> | ||
- | |||
- | < | ||
- | | ||
- | ===== General Description ===== | ||
- | SSG itself does not build the routing table. It delegates this work to proven specialised tools. The example uses the BIRD root daemon. The router daemon processes the required routing protocols (BGP, OSPF, etc.) and uses them to build a common routing table which it loads into the kernel. SSG performs routing of packets using this table. | ||
- | {{ : | ||
- | <note tip> | ||
- | Instead of BIRD, any other daemon that builds a routing table in the Linux kernel can be used, such as [[https:// | ||
- | In future versions, in order to save memory, it is possible to introduce optional specialized APIs for communication with a particular daemon to bypass kernel route table construction and communicate with the daemon directly.</ | ||
- | |||
- | Since BIRD builds the routing table in the OS kernel, to avoid application of these rules by the Linux server itself, the BIRD root daemon runs in a separate net namespace (in the diagram it is '' | ||
- | |||
- | ==== The Internal Router Architecture ==== | ||
- | Data from the kernel route table is read (rtnetlink) in the router' | ||
- | |||
- | The worker threads use FIB. This structure is designed for multi-threaded search (LPM - longest prefix match), but is not designed for modifications (deletion/ | ||
- | |||
- | ===== System Requirements ===== | ||
- | Router mode in SSG requires quite a lot of memory, especially with BGP full view. Plus, memory is required for the BIRD daemon that builds the routing table via BGP, OSPF, etc. Router mode (especially BGP full view) requires at least 4-8G additional memory. | ||
- | |||
- | ===== Setting veth-nterface Names ===== | ||
- | The fastdpi.conf describes all TAP-interfaces associated with the devices: | ||
- | < | ||
- | # Description of one router interface | ||
- | # WARNING! ' | ||
- | router_device { | ||
- | # Device name from in_dev/ | ||
- | device= | ||
- | # TAP interface name for the device (default=' | ||
- | #tap= | ||
- | # Name of the paired TAP interface in netns for the device (default=' | ||
- | #peer= | ||
- | # WARNING! ' | ||
- | } | ||
- | </ | ||
- | |||
- | For example, for this configuration | ||
- | < | ||
- | in_dev=41-00.0 | ||
- | out_dev=41-00.1 | ||
- | </ | ||
- | where only '' | ||
- | < | ||
- | in_dev=41-00.0 | ||
- | out_dev=41-00.1 | ||
- | |||
- | router_device { | ||
- | # Device name from in_dev/ | ||
- | device=41-00.1 | ||
- | # TAP interface name for the device (default=' | ||
- | tap=tap41 | ||
- | # Name of the paired TAP interface in netns for the device (default=' | ||
- | peer=bgp41 | ||
- | } | ||
- | </ | ||
- | |||
- | It is possible not to specify the names of the '' | ||
- | < | ||
- | in_dev=41-00.0 | ||
- | out_dev=41-00.1 | ||
- | |||
- | # TAP for out_dev: | ||
- | router_device { | ||
- | device=41-00.1 | ||
- | } | ||
- | |||
- | # TAP for in_dev | ||
- | router_device { | ||
- | device=41-00.0 | ||
- | } | ||
- | </ | ||
- | In this case the TAP interface names are assumed to be as follows: | ||
- | * for '' | ||
- | * for '' | ||
- | |||
- | ===== TAP Subnets Configuration ===== | ||
- | For each '' | ||
- | |||
- | Subnets are defined by the '' | ||
- | For example, the following configuration | ||
- | < | ||
- | router_device { | ||
- | # Device name from in_dev/ | ||
- | device=41-00.1 | ||
- | # TAP interface name for the device (default=' | ||
- | tap=tap41 | ||
- | # Name of the paired TAP interface in netns for the device (default=' | ||
- | peer=bgp41 | ||
- | |||
- | # Which IPv4 subnets to allocate to TAP | ||
- | subnet=10.0.2.0/ | ||
- | subnet=8.8.8.0/ | ||
- | |||
- | # Which IPv6 subnets to allocate to TAP | ||
- | subnet6=2001:: | ||
- | # link-local the address of the interface with which bird communicates | ||
- | subnet6=fe80:: | ||
- | } | ||
- | </ | ||
- | specifies two IPv4 subnets for device '' | ||
- | |||
- | <note important> | ||
- | |||
- | OSPF uses the multicast addresses 224.0.0.5 and 224.0.0.6, so if the '' | ||
- | < | ||
- | router_device { | ||
- | device=41-00.1 | ||
- | tap=tap41 | ||
- | peer=bgp41 | ||
- | |||
- | # OSPF multicast | ||
- | subnet=224.0.0.5/ | ||
- | subnet=224.0.0.6/ | ||
- | } | ||
- | </ | ||
- | |||
- | <note warning> | ||
- | |||
- | ===== Creating veth interfaces ===== | ||
- | <note important> | ||
- | |||
- | Suppose we have the following devices specified in fastdpi.conf: | ||
- | < | ||
- | in_dev=41-00.0 | ||
- | out_dev=41-00.1 | ||
- | </ | ||
- | Suppose we need to configure the BGP protocol for uplink in BIRD, i.e. on the '' | ||
- | <note tip> | ||
- | To redirect BGP traffic from '' | ||
- | |||
- | Create '' | ||
- | < | ||
- | ip netns add bird | ||
- | </ | ||
- | |||
- | Create the veth pair: | ||
- | < | ||
- | ip link add dpi41-00.1 type veth peer name rib41-00.1 netns bird | ||
- | </ | ||
- | |||
- | The rib interface must have an IP address (and IPv6 if IPv6 is supported). This address will be the BGP peer address for the BGP neighbour. | ||
- | < | ||
- | ip netns exec bird ip address add 10.0.0.4/24 broadcast 10.0.0.255 dev rib41-00.1 | ||
- | ip netns exec bird ip address add 2098::4/124 dev rib41-00.1 | ||
- | # enable ARP on the interface | ||
- | ip netns exec bird ip link set dev rib41-00.1 arp on | ||
- | |||
- | # set tx checksum offload off - turn off checksum calculation on the interface | ||
- | # noticed that the CRC calculation on the interface may not be correct (at least on some CentOS-8 kernel builds) | ||
- | ip netns exec bird ethtool -K rib41-00.1 tx off | ||
- | </ | ||
- | <note warning> | ||
- | |||
- | The dpi interface **should have neither IPv4 nor IPv6 addresses**, | ||
- | < | ||
- | ip link set dev dpi41-00.1 arp off | ||
- | # Disable IPv6 on dpiXXX interfaces (so that there is not even a link-local address) | ||
- | echo 1>/ | ||
- | </ | ||
- | |||
- | Finally, bring up all created interfaces: | ||
- | < | ||
- | ip link set dpi41-00.1 up | ||
- | ip netns exec bird ip link set lo up | ||
- | ip netns exec bird ip link set rib41-00.1 up | ||
- | </ | ||
- | |||
- | Do not forget the firewall: | ||
- | < | ||
- | firewall-cmd --zone=internal --add-source=10.0.0.1/ | ||
- | firewall-cmd --zone=internal --add-rich-rule=' | ||
- | </ | ||
- | |||
- | Remember that BIRD must be run in '' | ||
- | < | ||
- | ip netns exec bird / | ||
- | </ | ||
- | |||
- | <note important> | ||
- | |||
- | < | ||
- | SSG sends packets to the rib interfaces "as is" without any conversion. It means that if you have a VLAN, you have to use Linux to create vlan interfaces on the rib interface and bind the bird to those vlan interfaces.\\ | ||
- | In fastdpi.conf vlan interfaces created on a rib interface must not be listed anywhere - you must specify the two ends of the veth pair as '' | ||
- | |||
- | < | ||
- | SSG **does not set** the MTU on the veth interfaces. When configuring the veth interfaces, the MTU must be set using the standard Linux tools. | ||
- | </ | ||
- | |||
- | ===== LAG Support ===== | ||
- | SSG 10.1 adds support for link aggregation in the router. | ||
- | |||
- | For aggregated channels, packets that need to be diverted to a TAP interface can go to any device that is part of a LAG. To avoid creating the same TAP interface for each device in a LAG, the router takes into account which devices are included in the LAG and for all such devices does a diversion of traffic of the specified subnets to the TAP (to the BIRD daemon). | ||
- | |||
- | Each LAG is defined by a separate section in fastdpi.conf which lists all the devices included in the LAG: | ||
- | < | ||
- | # In/out devices, combined in a LAG | ||
- | in_dev=01-00.0: | ||
- | out_dev=01-00.1: | ||
- | |||
- | # Describing the LAG towards the inet | ||
- | lag { | ||
- | # Optional LAG name, used only for log output | ||
- | name=inet | ||
- | # Each device included in a LAG is described by a separate device parameter | ||
- | device=01-00.1 | ||
- | device=02-00.1 | ||
- | } | ||
- | |||
- | # Description of one router interface | ||
- | router_device { | ||
- | # Device name from out_dev. Only for this device create a veth pair of TAP interfaces | ||
- | device=01-00.1 | ||
- | # TAP interface name for the device (default=' | ||
- | tap=tap0 | ||
- | # Name of the paired TAP interface in netns for the device (default=' | ||
- | peer=peer0 | ||
- | # Subnets diverted from total traffic to the TAP device (example) | ||
- | subnet=10.0.10.0/ | ||
- | #...other subnets... | ||
- | } | ||
- | </ | ||
- | With this description, | ||
- | |||
- | The '' | ||
- | If the router works both inet and subs direction (e.g. BGP on the inet side and OSPF inside the network, subs side), two '' | ||
- | < | ||
- | # LAG towards inet | ||
- | lag { | ||
- | name=inet | ||
- | device=01-00.1 | ||
- | device=02-00.1 | ||
- | } | ||
- | |||
- | # LAG towards subs | ||
- | lag { | ||
- | name=subs | ||
- | device=01-00.0 | ||
- | device=02-00.0 | ||
- | } | ||
- | </ | ||
- | and a separate '' | ||
- | |||
- | A maximum of 10 different lag sections can be configured in total. | ||
- | |||
- | <note tip>The '' |