Skip to content

Commit

Permalink
Fix: add subnet to env (#1126)
Browse files Browse the repository at this point in the history
* fix: add subnet as env variable

* chore: update changelog
  • Loading branch information
ajasnosz authored Nov 12, 2024
1 parent 3ec29a5 commit 567726a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changed
- add IF-MIB.ifOperStatus to baseIF profile
- allow to set subnets for docker network configuration from .env file

### Fixed

Expand Down
8 changes: 7 additions & 1 deletion docker_compose/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH=
TRAPS_CONFIG_FILE_ABSOLUTE_PATH=
INVENTORY_FILE_ABSOLUTE_PATH=
COREFILE_ABS_PATH=
SC4SNMP_VERSION="1.12.1-beta.4"

# Network configuration
COREDNS_ADDRESS=172.28.0.255
COREDNS_ADDRESS_IPv6=fd02:0:0:0:7fff:ffff:ffff:ffff
SC4SNMP_VERSION="1.12.1-beta.4"
IPv6_ENABLED=false
IPAM_SUBNET=172.28.0.0/16
IPAM_GATEWAY=172.28.0.1
IPAM_SUBNET_IPv6=fd02::/64
IPAM_GATEWAY_IPv6=fd02::1

# Dependencies images
COREDNS_IMAGE=coredns/coredns
Expand Down
8 changes: 4 additions & 4 deletions docker_compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ networks:
enable_ipv6: ${IPv6_ENABLED:-false}
ipam:
config:
- subnet: 172.28.0.0/16
gateway: 172.28.0.1
- subnet: fd02::/64
gateway: fd02::1
- subnet: ${IPAM_SUBNET:-172.28.0.0/16}
gateway: ${IPAM_GATEWAY:-172.28.0.1}
- subnet: ${IPAM_SUBNET_IPv6:-fd02::/64}
gateway: ${IPAM_GATEWAY_IPv6:-fd02::1}

services:
coredns:
Expand Down
4 changes: 2 additions & 2 deletions docs/dockercompose/10-enable-ipv6.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Older versions of Docker do not support IPv6 or have know issues with IPv6 confi
To avoid any problem with configuring the network, it is recommended to use the latest version of Docker.

To enable IPv6 for SC4SNMP, set `IPv6_ENABLED` variable to `true` in `.env` file.
The default subnet used for SC4SNMP network in docker is `fd02::/64`, this and other network configuration can be
changed in the `docker-compose.yaml` file in `networks` section.
The default subnet used for SC4SNMP network in docker is `fd02::/64`, this configuration can be changed in `.env` file under `Network configuration` section.
In case of configuring more than one IPv4 and IPv6 subnet in IPAM, `networks` section of `docker-compose.yaml` should be edited.

Default trap port for notifications for IPv6 is `2163`. You can change it to any other port if needed with `IPv6_TRAPS_PORT` parameter in `.env` file.
The IPv6 port and IPv4 port cannot be the same.
Expand Down
18 changes: 15 additions & 3 deletions docs/dockercompose/6-env-file-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ Inside the directory with the docker compose files, there is a `.env`. Variables
| `TRAPS_CONFIG_FILE_ABSOLUTE_PATH` | Absolute path to [traps-config.yaml](./5-traps-configuration.md) file |
| `INVENTORY_FILE_ABSOLUTE_PATH` | Absolute path to [inventory.csv](./3-inventory-configuration.md) file |
| `COREFILE_ABS_PATH` | Absolute path to Corefile used by coreDNS. Default Corefile can be found inside the `docker_compose` |
| `COREDNS_ADDRESS` | IP address of the coredns inside docker network. Should not be changed |
| `COREDNS_ADDRESS_IPv6` | IPv6 address of the coredns inside docker network. Should not be changed |
| `SC4SNMP_VERSION` | Version of SC4SNMP |
| `IPv6_ENABLED` | Enable receiving traps and polling from IPv6 devices |


## Network configuration

| Variable | Description |
|------------------------|--------------------------------------------------------------------------|
| `COREDNS_ADDRESS` | IP address of the coredns inside docker network. Should not be changed |
| `COREDNS_ADDRESS_IPv6` | IPv6 address of the coredns inside docker network. Should not be changed |
| `IPv6_ENABLED` | Enable receiving traps and polling from IPv6 devices |
| `IPAM_SUBNET` | Subnet in CIDR format that represents a network segment |
| `IPAM_GATEWAY` | IPv4 gateway for the master subnet |
| `IPAM_SUBNET_IPv6` | Subnet in CIDR format that represents a network segment for IPv6 |
| `IPAM_GATEWAY_IPv6` | IPv6 gateway for the master subnet |

!!! info
In case of configuring more than one IPv4 and IPv6 subnet in IPAM, docker compose file should be edited.

## Images of dependencies

| Variable | Description |
Expand Down

0 comments on commit 567726a

Please sign in to comment.