Skip to content

Commit c537d64

Browse files
committed
UE NAT setup to support dynamic UPF scaling
Signed-off-by: hxngillani <[email protected]>
1 parent 86f290f commit c537d64

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

roles/router/tasks/install.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
when: inventory_hostname in groups['master_nodes']
6969
become: true
7070

71+
- name: Disable GRO flag on the {{ core.data_iface }} interface
72+
shell: ethtool -K {{ core.data_iface }} gro off
73+
when: inventory_hostname in groups['master_nodes']
74+
become: true
75+
7176
- name: find {{ core.data_iface }}'s netplan network directory
7277
shell: basename $(find /*/systemd/network -maxdepth 1 -not -type d -name '*{{ core.data_iface }}.network' -print)
7378
register: result

roles/router/templates/systemd/20-aether-core.network

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ Name=core
88
IPForward=yes
99
Address={{ core.upf.core_subnet }}
1010

11-
# Default UPF Route
1211
[Route]
1312
Gateway={{ core.upf.default_upf.ip.core }}
1413
Destination={{ core.upf.default_upf.ue_ip_pool }}
15-
16-
# Additional UPFs - Dynamically Generated Routes
17-
{% if core.upf.additional_upfs is defined and core.upf.additional_upfs %}
18-
{% for upf in core.upf.additional_upfs.values() %}
19-
[Route]
20-
Gateway={{ upf.ip.core }}
21-
Destination={{ upf.ue_ip_pool }}
22-
{% endfor %}
23-
{% endif %}

roles/router/templates/systemd/aether-ue-nat.service.j2

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ Type=oneshot
1010
ExecStart=/bin/bash -c "\
1111
sudo iptables -t nat -C POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
1212
sudo iptables -t nat -A POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
13-
{% if '1' in core.upf.additional_upfs %} \
14-
sudo iptables -t nat -C POSTROUTING -s {{ core.upf.additional_upfs['1'].ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
15-
sudo iptables -t nat -A POSTROUTING -s {{ core.upf.additional_upfs['1'].ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
16-
{% endif %} \
17-
{% if '2' in core.upf.additional_upfs %} \
18-
sudo iptables -t nat -C POSTROUTING -s {{ core.upf.additional_upfs['2'].ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
19-
sudo iptables -t nat -A POSTROUTING -s {{ core.upf.additional_upfs['2'].ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
20-
{% endif %} \
13+
{% for upf_key, upf_data in core.upf.additional_upfs.items() %} \
14+
sudo iptables -t nat -C POSTROUTING -s {{ upf_data.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
15+
sudo iptables -t nat -A POSTROUTING -s {{ upf_data.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
16+
{% endfor %} \
2117
"
2218

2319
[Install]
24-
WantedBy=multi-user.target
20+
WantedBy=sys-subsystem-net-devices-core.device

roles/upf/tasks/install.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@
5959
when: inventory_hostname in groups['master_nodes']
6060
with_dict: "{{ core.upf.additional_upfs}}"
6161
become: true
62-
63-
# ignore_errors: yes
62+
63+

0 commit comments

Comments
 (0)