diff --git a/config/upf-iptables.sh b/config/upf-iptables.sh new file mode 100755 index 0000000..305200b --- /dev/null +++ b/config/upf-iptables.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# +# Configure iptables in UPF +# +iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE +iptables -I FORWARD 1 -j ACCEPT + diff --git a/config/upfcfg.yaml b/config/upfcfg.yaml index b3dc3c6..1295b51 100644 --- a/config/upfcfg.yaml +++ b/config/upfcfg.yaml @@ -10,7 +10,7 @@ configuration: - addr: upf.free5gc.org gtpu: - - addr: 0.0.0.0 + - addr: upf.free5gc.org # [optional] gtpu.name # - name: upf.5gc.nctu.me # [optional] gtpu.ifname diff --git a/docker-compose.yaml b/docker-compose.yaml index 99f1ce4..45be852 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,9 +7,10 @@ services: context: ./nf_upf args: DEBUG_TOOLS: "false" - command: ./free5gc-upfd -f ../config/upfcfg.yaml + command: bash -c "./upf-iptables.sh && ./free5gc-upfd -f ../config/upfcfg.yaml" volumes: - - "./config/upfcfg.yaml:/free5gc/config/upfcfg.yaml" + - ./config/upfcfg.yaml:/free5gc/config/upfcfg.yaml + - ./config/upf-iptables.sh:/free5gc/free5gc-upfd/upf-iptables.sh cap_add: - NET_ADMIN networks: