-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd: network: Avoid assigning IP addr from UE IP pool to ogstun interface #2975
Conversation
By default, open5gs assigns IPs to UEs except for 10.45.0.1. Do I still need to add the routing table when restarting UPF in this case? Also, another issue is that if I modify systemd like that, the test code in open5gs doesn't work: all the codes that test GTP-U using ping packets don't seem to work. ./tests/registration/registration simple-test gets stuck where it is sending to and from GTP-U. If I'm misunderstanding something, please let me know again. Thanks a lot! |
Hi @acetcom ,
I am not understanding you here. Can you rephrase or extend your question?
And the first time I send a GTPv2C CreateSessionReq, I get IP address 10.45.0.1 assigned. But you seem to say in your question that open5gs should not be assigning this IP address to UE. So according to what you say, you'd expect the first address in the pool to be reserved for PGW used and never assigned to UEs? Then maybe there's a bug in open5gs-smfd and we should get open5gs-smfd fixed so that it avoid assigning the first IP address to UEs.
Are the open5gs tests under ./tests/ using systemd? I was unaware of that. |
Now that I know what happened, let me try to explain it again. Open5GS defaults to the following settings.
I'm using 10.45.0.1/16 instead of 10.45.0.0/16. I'm assuming that 10.45.0.1 is the IP set in the TUN, and I'm making sure that 10.45.0.1 is not set when setting the IP in the UE Pool. The relevant code in lib/pfcp/context.c is shown below.
And using this TUN IP, the test program is using Ping (ICMP) to test Data Plane. Open5GS is implemented so that any configuration file or program, including systemd, assumes that the TUN IP is set. Of course, it is possible to implement this without TUN IP as you suggest, but it makes testing very difficult. In addition to the test program of Open5GS, I think the TUN IP is necessary for ease of installation during the actual deployment. It may be a little more vulnerable, but I think TUN IPs are necessary nonetheless, and that's how Open5GS was designed. Please let me know if you have any diffrent idea. Thanks a lot! |
Ok I am also starting to understand the issue. IMHO specifying the subnet as 10.45.0.1/16 is really strange in here, since you'd be breaking the assumption that a subnet is a set of 1 followed by a set of 0 (a prefix). So that field should be fixed and configured by the user as 10.45.0.0/16, like we were doing in our osmo-epdg faulty setup. Now, if you also want to assign an IP address within the subnet to the tundev (which is fine for me too, it has its utility like pinging the end of the tunnel), I see you have 2 ways:
I am fine with any of the 2 above. In osmo-ggsn we use approach number 2, which allows further flexibility (see "ip ifconfig" being used to assign the GGSN IP address within the tunnel):
That's fine, but then we need to fix the subnet stuff I mentioned above. |
@acetcom see how in osmo-ggsn we actually allow allocating the network ip address (.0) and also probably the broadcast address (.255), since those are anyway no really used in the tunnel network created/managed by the GGSN. So I'd propose doing the same here:
|
Basically, I agree with you, using the name I want to add a new
For backwards compatibility, I can set a gateway(or router) information to a subnet for a period of time as below.
And also, subnet will be used without router information.
I don't think we need to support blacklist because we can use
I'll use the Let me know if you have any objections. |
I'd better name it simply "address" or "gateway", I think it will be clearer IMHO.
Not sure what you mean here. You plan to keep the old behavior for a while? You mean that for a while if no "address" is specified you will still implicitly take .1 as "address"?
Oh I didn't know about that "range" support, nice. AFAIU that configures explicitly the available IP addresses within the subnet which are available to be assigned to UEs?
Let me now your thoughts @acetcom . |
If
I don't always implicitly use .1 for backwards compatibility: if we used subnet like this, we would exclude .5.
This means that for the time being, I will allow subnets to contain .x as before, without using Please let me know if you still don't understand my intent. Thanks a lot! |
@acetcom Ah ok, now I think I understand what you mean:
Fine with me. If possible add a warning message if the backward-compatible way is used (the suffix is not all 0), telling the user to move the config to the new format. |
Now you're on the same page as me. Giving warning messages is a good idea. However, I have a lot of other things on my plate, so I don't plan to work on this fix right now. When I have more time, and if someone hasn't already done so, I may attempt to fix this issue at that time. Thank a lot! |
@acetcom I have more urgent topics to work on in order to get osmo-epdg working with open5gs, so I will prioritize those first. |
The way subnet is set up has changed as shown below. ``` <OLD Format> smf: session: - subnet: 10.45.0.1/16 <NEW Format> smf: session: - subnet: 10.45.0.0/16 gateway: 10.45.0.1 ``` For more information, please refer to Pull Request #2975.
The way subnet is set up has changed as shown below. ``` <OLD Format> smf: session: - subnet: 10.45.0.1/16 <NEW Format> smf: session: - subnet: 10.45.0.0/16 gateway: 10.45.0.1 ``` For more information, please refer to Pull Request #2975.
As you suggested, I've changed the way we set up subnets on the main branch as follows.
Please let me know if you have any different idea. Thanks a lot! |
@acetcom I may be wrong, but from looking only at your changes, I think it is still not possible to define a pool of addresses with no address assigned to the tundev? See 3 examples: 1- "subnet: 10.45.0.1/16" 2- "subnet: 10.45.0.0/16 3- "subnet: 10.45.0.0/16" I have the feeling, with your changes, you now support cases "1" and "2", but most probably case "3" is still being handled as case "1" where IP address "10.45.0.0" is assigned to the tundev. Remember the initial point of this ticket was to allow setting up open5gs PGW without need to assign one IP address from the pool to the tundev. Splitting the "subnet" and "gateway" attribute is a first correct step, but that alone is not enough. |
Here are the results of my experiment. Note that Open5GS runs can be traced with the -t option.
The numbers 1 and 2 are TRACE: [0] - 2002d0a:0:0:0:0:0:0, which is assigned a UE IP from 10.45.0.2, number 3 is TRACE: [0] - 1002d0a:0:0:0:0:0, which is assigned a UE IP starting at 10.45.0.1. Please let me know if you have any concerns. Thanks a lot! |
@acetcom Hi, that looks good then, thanks for confirming. I am thinking about submitting a new version of this PR, where we add explicit routing rules, but this time keeping the setting of the IP address which you mentioned you want to have as a default setup. The point of doing so is that if somebody wants to get rid of the allocated IP address for the tundev, one can simply comment out the "Address=" lines in the systemd file. With the current systemd .network file, if one removes the "Address=" lines and does not do more stuff (the lines being added in this PR), then open5gs PGW will not work properly because routing will not be set. Right now it is working because when an IP address is set, the kernel implicitly sets local network routing rules. |
That's a really good idea. Please resubmit the PR with the added routing table settings Thanks a lot! |
…ddresses When running the open5gs package with systemd network config, the 1st IP address of the UE pool configured in open5gs-upfd config file for ogstun is being assigned to the interface through this file. That was discussed as being a desirable default setup. However, in the event a user wants a setup where no IP address is assigned to the tundev, then it's not enough removing the IP address, because then the implicit routing rules regarding the subnet of the IP address added automatically by the kernel are also removed. This patch adds config sections to set up the routing explicitly, with the aim to get the routing still applied if the user decides to comment out the IP address, so that packets are still forwarded properly in that case. Related: https://osmocom.org/issues/6361
When running the open5gs package with systemd network config, the 1st IP address of the UE pool configured in open5gs-upfd config file for ogstun was being assigned to the interface. This causes routing problems when traffic from the UE which was assigned that same IP address is routed to/from the ogstun interface.
As a result, every time that open5gs-upfd systemd service was restarted, the following changed had to be applied:
ip addr del 10.45.0.1/16 dev ogstun
ip route add 10.45.0.0/16 dev ogstun
The IP address was set in order to get the routing entry for free. Instead, it should only add the routing entry.
Related: https://osmocom.org/issues/6361