Files

77 lines
2.3 KiB
Markdown

# `add_v4_net` Command
## Name
`add_v4_net`
## Synopsis
```
add_v4_net ${card} ${vlan} ${group}
```
## 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 IPv4.
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` for its subnet
computations in IPv4. 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.
Internally, this will call [`add_vlan`](add_vlan.md), passing it `${card}` and
`${vlan}`.
## 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)|Example IPv4 |
|---:|---------------:|--------------:|
| 0| 0 |192.168.0.0/24 |
| 7| 7 |192.168.7.0/24 |
| 101|11 |192.168.11.0/24|
| 205|25 |192.168.25.0/24|
| 900|90 |192.168.90.0/24|
## Options
- `isp=${NAME}` - Attach this network to a specified ISP's configuration
- `no_isp` - This network should not be associated with any ISP (future expansion).
## Examples
#### Basic home LAN
`add_v4_net abc2 100 main`
#### Guest network with no ULA
`add_v4_net xy2 102 guest`
#### IoT network with no ISP association
`add_v4_net xy2 103 iot no_isp`
#### Management network on a different ISP
`add_v4_net xy2 402 mgmt isp=fios_1`
## See Also
- [`add_net`](add_net.md)
- [`add_v6_net`](add_v6_net.md)
- [`add_vlan`](add_vlan.md)