93 lines
3.7 KiB
Markdown
93 lines
3.7 KiB
Markdown
# `add_net` Command
|
|
|
|
## Name
|
|
|
|
`add_net`
|
|
|
|
## Synopsis
|
|
|
|
```
|
|
add_net ${card} ${vlan} ${group} [{no_ula|isp=abc|no_isp}...]
|
|
```
|
|
|
|
## Description
|
|
|
|
Adds an internal network segment with the specified vlan on the specified
|
|
card. The created vlan-adaptor is put into the specified group. It is setup
|
|
for both IPv4 and (where the ISP provides for it) IPv6.
|
|
|
|
If `${vlan}` is 0, then no tagged VLAN interfaces will be created; however,
|
|
the subnet address computations will still be performed as-if the vlan
|
|
were created. This means that `xy0` will use `0` or `00` for its subnet
|
|
computations in IPv4 and IPv6 respectively. If you don't intend to use
|
|
VLANs for subnets, just use VLAN ID 0 when declaring networks.
|
|
|
|
The IPv4 network will be a `/24` under `${v4_net_xy0}` if `${card}` is
|
|
`xy0`, for example. If `${v4_net_xy0}` is not set, then `${v4_net}` is
|
|
used by default. The 3rd octet will be `$(( ${vlan}/10 + ${vlan}%10 ))`. For
|
|
example, if `${vlan}` is `102` and `${v4_net}` is `172.18`, then the configured
|
|
v4 network will be `172.18.12.0/24` and the router will hold address
|
|
`172.18.12.1`. By default, IPv4 network DHCP configuration is enabled and
|
|
the range `.100` to `.200` will be used as a dynamic allocation pool.
|
|
|
|
The IPv6 network will make `$(( ${vlan}/10 + ${vlan}%10 ))` into hex digits
|
|
to be appended to the ISP's IPv6 prefix. This makes it compatible with the
|
|
most common case of `/56` for most ISPs. If `no_ula` is specified in the
|
|
optional arguments, then a ULA for this network segment will not be created.
|
|
Otherwise, the `${rc_router_network_name}` variable will be hashed and an
|
|
ISP-like prefix of `/48` will be created to which the SLA for the specified
|
|
network will be appended. The `${rc_router_ula_prefix_size}` can be set to
|
|
`56` to specify a ULA prefix length of 56. (No other lengths are supported
|
|
at this time.)
|
|
|
|
The `isp=...` flag can be used to assign the specified subnet to be part
|
|
of the `IA_PD` list for the specified ISP. The `no_isp` flag can be used to
|
|
skip provisioning the specified network with any ISP's DHCPv6 `IA_PD` request.
|
|
|
|
This calls [`add_v4_net`](add_v4_net.md) and [`add_v6_net`](add_v6_net.md) and
|
|
passes all of its arguments.
|
|
|
|
## Subnet Calculation
|
|
|
|
(It is strongly recommended that the 10s digit and 1000s digit of the VLAN ID be
|
|
kept as `0`, as those digits are reserved for future improvements. While this
|
|
limits the system to 100 vlans, it provides 1:1 visual alignment between IPv4,
|
|
IPv6, and VLAN ID. Each can be visually compared to the others.)
|
|
|
|
|VLAN|IPv4 (3rd octet)|IPv6 suffix (hex)|Example IPv4 |Example IPv6 |
|
|
|---:|---------------:|----------------:|--------------:|----------------------:|
|
|
| 0| 0 | 0 |192.168.0.0/24 |2001:db8:abcd:ef00::/64|
|
|
| 7| 7 | 7 |192.168.7.0/24 |2001:db8:abcd:ef07::/64|
|
|
| 101|11 | 11 |192.168.11.0/24|2001:db8:abcd:ef11::/64|
|
|
| 205|25 | 25 |192.168.25.0/24|2001:db8:abcd:ef25::/64|
|
|
| 900|90 | 90 |192.168.90.0/24|2001:db8:abcd:ef90::/64|
|
|
|
|
## Options
|
|
|
|
- `no_ula` - Do not create a Unique Local Address for this network (on the IPv6
|
|
side).
|
|
- `isp=${NAME}` - Attach this network to a specified ISP's configuration
|
|
- `no_isp` - This network should not be associated with any ISP (declines to
|
|
add network to DHCPv6 PD, among other things).
|
|
|
|
## Examples
|
|
|
|
#### Basic home LAN
|
|
`add_net abc2 100 main`
|
|
|
|
#### Guest network with no ULA
|
|
`add_net xy2 102 guest no_ula`
|
|
|
|
#### IoT network with no ULA and no ISP prefix delegation
|
|
`add_net xy2 103 iot no_ula no_isp`
|
|
|
|
#### Management network on a different ISP PD
|
|
`add_net xy2 402 mgmt isp=fios_1`
|
|
|
|
## See Also
|
|
|
|
- [`add_v4_net`](add_v4_net.md)
|
|
- [`add_v6_net`](add_v6_net.md)
|
|
- [`add_vlan`](add_vlan.md)
|
|
- [`add_rtadv`](add_rtadv.md)
|