Skip to content

Commit 3805698

Browse files
authored
Merge pull request #1 from cruse1977/dq-localaccess
Add ability to run locally on discovery-quickstart
2 parents 2bbec5f + 07a0ff6 commit 3805698

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

netbox-discovery-quickstart/1_set_envvars.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ if [ -f "$ENV_FILE" ]; then
1717
else
1818
echo "Environment file not found. Generating new variables."
1919

20-
# Attempt to fetch the external IPv4 address
21-
EXTERNAL_IP=$(curl -4 -s ifconfig.me) # Use -4 to ensure IPv4 is returned
22-
23-
# Check if the IP was retrieved successfully
24-
if [ -z "$EXTERNAL_IP" ]; then
25-
echo "Error: Unable to determine external IPv4 address."
26-
exit 1
20+
if [[ -z "${MY_EXTERNAL_IP}" ]]; then
21+
# Attempt to fetch the external IPv4 address
22+
EXTERNAL_IP=$(curl -4 -s ifconfig.me) # Use -4 to ensure IPv4 is returned
23+
# Check if the IP was retrieved successfully
24+
if [ -z "$EXTERNAL_IP" ]; then
25+
echo "Error: Unable to determine external IPv4 address."
26+
exit 1
27+
fi
28+
else
29+
EXTERNAL_IP=${MY_EXTERNAL_IP}
2730
fi
2831

2932
# Generate new variables

netbox-discovery-quickstart/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ You will be able to run simple scripts to use both features of NetBox Discovery:
2121

2222
> [!TIP]
2323
>
24-
> The workshop assumes it is running on an internet accessible machine and it relies on the public IP for a lot of functionality
25-
> This means that **it will not work on your local machine**, but we aim to add that possibility at a later stage. Please use a cloud VM for now.
26-
27-
> [!TIP]
28-
>
24+
> - The workshop can be ran on a server or virtual machine with a public or private ip. Please see the additional step for the latter option
2925
> - We recommend using a machine with at least 4GB of RAM and 2 cores. If you're using a discount cloud or are going to run Cisco IOS images, we recommend at least 8GB of RAM and 4 cores.
3026
> - The workshop has only been tested on Ubuntu 22.04. It _should_ work on other Linux distros but if you hit any problems please create an [issue](https://github.com/netboxlabs/netbox-learning/issues) in GitHub
3127
> - Unfortunately MacOS is not supported. The workshop relies heavily on ContainerLab which does not have native support for MacOS
@@ -57,6 +53,14 @@ su - quickstart
5753

5854
### Generate and export the necessary environment variables for the quickstart
5955

56+
Optionally set a private IP. If this machine does not have a public ipv4 address assigned on a local interface, this option should be used.
57+
58+
Replace <my ip address> with an ip address assigned to the local machine - eg: 10.1.1.1
59+
60+
```
61+
export MY_EXTERNAL_IP=<ip address>
62+
```
63+
6064
> [!TIP]
6165
>
6266
> `1_set_envvars.sh` writes the variables it generates to a file in the root directory called `environment`

0 commit comments

Comments
 (0)