Link to NAT IP from views where shown #5781

Closed
opened 2025-12-29 19:32:36 +01:00 by adam · 2 comments
Owner

Originally created by @hagbarddenstore on GitHub (Dec 15, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.1

Feature type

Change to existing functionality

Proposed functionality

When a NAT IP is shown, link to the IP Address object it represents.

Use case

User experience improvement, it allows a user to get to the NAT IP without having to go via the NAT:ed IP.

So, instead of doing VM -> Primary IP -> NAT IP you can do VM -> NAT IP directly.

Database changes

None

External dependencies

None

Originally created by @hagbarddenstore on GitHub (Dec 15, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.1 ### Feature type Change to existing functionality ### Proposed functionality When a NAT IP is shown, link to the IP Address object it represents. ### Use case User experience improvement, it allows a user to get to the NAT IP without having to go via the NAT:ed IP. So, instead of doing VM -> Primary IP -> NAT IP you can do VM -> NAT IP directly. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 19:32:36 +01:00
adam closed this issue 2025-12-29 19:32:36 +01:00
Author
Owner

@hagbarddenstore commented on GitHub (Dec 15, 2021):

Basically, on the virtual machine view, change:

<td>
    {% if object.primary_ip4 %}
        <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
        {% if object.primary_ip4.nat_inside %}
            <span>(NAT for {{ object.primary_ip4.nat_inside.address.ip }})</span>
        {% elif object.primary_ip4.nat_outside %}
            <span>(NAT: {{ object.primary_ip4.nat_outside.address.ip }})</span>
        {% endif %}
    {% else %}
        <span class="text-muted">&mdash;</span>
    {% endif %}
</td>

to

<td>
    {% if object.primary_ip4 %}
        <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a>
        {% if object.primary_ip4.nat_inside %}
            <span>(NAT for <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.nat_inside.address.pk %}">{{ object.primary_ip4.nat_inside.address.ip }}</a>)</span>
        {% elif object.primary_ip4.nat_outside %}
            <span>(NAT: <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.nat_outside.address.pk %}">{{ object.primary_ip4.nat_outside.address.ip }}</a>)</span>
        {% endif %}
    {% else %}
        <span class="text-muted">&mdash;</span>
    {% endif %}
</td>
@hagbarddenstore commented on GitHub (Dec 15, 2021): Basically, on the virtual machine view, change: ``` <td> {% if object.primary_ip4 %} <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a> {% if object.primary_ip4.nat_inside %} <span>(NAT for {{ object.primary_ip4.nat_inside.address.ip }})</span> {% elif object.primary_ip4.nat_outside %} <span>(NAT: {{ object.primary_ip4.nat_outside.address.ip }})</span> {% endif %} {% else %} <span class="text-muted">&mdash;</span> {% endif %} </td> ``` to ``` <td> {% if object.primary_ip4 %} <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.pk %}">{{ object.primary_ip4.address.ip }}</a> {% if object.primary_ip4.nat_inside %} <span>(NAT for <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.nat_inside.address.pk %}">{{ object.primary_ip4.nat_inside.address.ip }}</a>)</span> {% elif object.primary_ip4.nat_outside %} <span>(NAT: <a href="{% url 'ipam:ipaddress' pk=object.primary_ip4.nat_outside.address.pk %}">{{ object.primary_ip4.nat_outside.address.ip }}</a>)</span> {% endif %} {% else %} <span class="text-muted">&mdash;</span> {% endif %} </td> ```
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2021):

Same for devices, too.

@jeremystretch commented on GitHub (Dec 15, 2021): Same for devices, too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5781