2019-10-27 08:41:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SYSTEM=`uname`;
|
|
|
|
|
|
|
|
if [ "$SYSTEM" = "Linux" ]; then
|
|
|
|
if ! grep "ogstun" /proc/net/dev > /dev/null; then
|
|
|
|
ip tuntap add name ogstun mode tun
|
|
|
|
fi
|
2022-09-02 14:38:39 +00:00
|
|
|
if test "x`sysctl -n net.ipv6.conf.ogstun.disable_ipv6`" = x1; then
|
|
|
|
echo "net.ipv6.conf.ogstun.disable_ipv6=0" > /etc/sysctl.d/30-open5gs.conf
|
|
|
|
sysctl -p /etc/sysctl.d/30-open5gs.conf
|
|
|
|
fi
|
2020-02-17 01:41:16 +00:00
|
|
|
ip addr del 10.45.0.1/16 dev ogstun 2> /dev/null
|
|
|
|
ip addr add 10.45.0.1/16 dev ogstun
|
2022-01-14 02:50:27 +00:00
|
|
|
ip addr del 2001:db8:cafe::1/48 dev ogstun 2> /dev/null
|
|
|
|
ip addr add 2001:db8:cafe::1/48 dev ogstun
|
2019-10-27 08:41:14 +00:00
|
|
|
ip link set ogstun up
|
|
|
|
else
|
|
|
|
sysctl -w net.inet.ip.forwarding=1
|
2021-02-06 05:13:48 +00:00
|
|
|
sysctl -w net.inet6.ip6.forwarding=1
|
2019-10-27 08:41:14 +00:00
|
|
|
ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
|
2020-06-04 18:12:05 +00:00
|
|
|
ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255
|
2020-08-22 03:33:45 +00:00
|
|
|
ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
|
|
|
|
ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
|
2022-07-16 04:27:18 +00:00
|
|
|
ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
|
2019-10-27 08:41:14 +00:00
|
|
|
if [ "$SYSTEM" = "Darwin" ]; then
|
|
|
|
if ! test -f /etc/pf.anchors/org.open5gs; then
|
2020-02-17 01:41:16 +00:00
|
|
|
sudo sh -c "echo 'nat on {en0} from 10.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
|
2022-01-14 02:50:27 +00:00
|
|
|
sudo sh -c "echo 'nat on {en0} from 2001:db8:cafe::1/48 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
|
2019-10-27 08:41:14 +00:00
|
|
|
fi
|
|
|
|
pfctl -e -f /etc/pf.anchors/org.open5gs
|
|
|
|
fi
|
|
|
|
fi
|