Score:0

L2TP VPN connection does not use manually set IP address

pt flag

EDIT (2022/01/03):

As per Douglas Kosovic's answer, updating to version 1.20.08 does indeed fix this issue.

For completeness, I manually added the repository for good measure beforehand.

sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
sudo apt update

Ubuntu Version 22.04 LTS

Problem:

I am trying to setup an L2TP VPN connection with manual IP address, netmask, gateway and DNS. However, the manual IP address and netmask are not used when I connect to the VPN.

Expected outcome

The IP address should be of the form XXX.XX.XX.124 and the netmask should be XXX.XXX.XXX.224.

Actual outcome

The IP address is of the form XXX.XX.XX.100 and the netmask is of the form XXX.XXX.XXX.255.

Other information

I'm doing this via GUI having installed network-manager-l2tp-gnome, with the manual settings shown in the screenshot. Screenshot of manual settings

I have setup the same VPN connection successfully from my Macbook in the past so I don't believe any further manual changes are needed (e.g. routing).

Below is the output from ifconfig ppp0 (with censoring of the IP address and netmask done by me):

ifconfig ppp0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1400
        inet XXX.XX.31.100  netmask XXX.XXX.XXX.255  destination 1.0.0.1
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 6  bytes 1094 (1.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 132  bytes 14714 (14.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I'm not knowledgeable on networking issues so apologies if I've been over cautious in my redacting of bits of information and there's more information needed, do let me know if that's the case. (Equally if I've shared too much then please also let me know!)

Thanks!

Douglas Kosovic avatar
cn flag
I'm not sure why the **IPv4 Method** section isn't greyed out. The default **Automatic (DHCP)** isn't even used (nor are the others) as the PPP Internet Protocol Control Protocol (IPCP) is used to obtain the IP address. The IPCP address is supplied to NetworkManager in the following line of code; https://github.com/nm-l2tp/NetworkManager-l2tp/blob/1.2.20/src/nm-l2tp-pppd-plugin.c#L182
Score:0
cn flag

NetworkManager-l2tp sets some PPP configuration options.

I believe what you are trying to do requires modifying the NetworkManager-l2tp source code and setting the following PPP configuration options. Extract from the PPP configuration options page https://ppp.samba.org/pppd.html

<local_IP_address>:<remote_IP_address>
Set the local and/or remote interface IP addresses. Either one may be omitted. The IP addresses can be specified with a host name or in decimal dot notation (e.g. 150.234.56.78). The default local address is the (first) IP address of the system (unless the noipdefault option is given). The remote address will be obtained from the peer if not specified in any option. Thus, in simple cases, this option is not required. If a local and/or remote IP address is specified with this option, pppd will not accept a different value from the peer in the IPCP negotiation, unless the ipcp-accept-local and/or ipcp-accept-remote options are given, respectively.

The previous ppp.samba.org link and the Linux pppd(8) man page don't list the netmask PPP configuration option, but the OpenBSD pppd(8) man page does https://man.openbsd.org/pppd.8 . Extract:

netmask n
Set the interface netmask to n, a 32-bit netmask in “decimal dot” notation (e.g. 255.255.255.0). If this option is given, the value specified is ORed with the default netmask. The default netmask is chosen based on the negotiated remote IP address; it is the appropriate network mask for the class of the remote IP address, ORed with the netmasks for any non point-to-point network interfaces in the system which are on the same network. (Note: on some platforms, pppd will always use 255.255.255.255 for the netmask, if that is the only appropriate value for a point-to-point interface.)

EDIT: NetworkManager-l2tp source code has been updated to provide support for the Manual IPv4 configuration options; Address, Netmask and Gateway using the pppd <local_IP_address>:<remote_IP_address>, netmask, ipcp-accept-local and ipcp-accept-remote configuration options with the following commit :

https://github.com/nm-l2tp/NetworkManager-l2tp/commit/bdd75014d5bd0212210c0a8c8b0d84376a6488fd

That commit is based on code from NetworkManager-sstp the author of which is also a current maintainer of pppd.

Douglas Kosovic avatar
cn flag
I'll incorporated the IPv4 configuration options code from fellow PPP based VPN NetworkManager-sstp into the next release of NetworkManager-l2tp. The section of code is https://gitlab.gnome.org/GNOME/network-manager-sstp/-/blob/release-1.3.1/src/nm-sstp-service.c#L581
HigherOrderConfusion avatar
pt flag
Thanks for the response and investigation! Just to clarify are you recommending that I make changes to the `NetworkManager-l2tp` source code for myself or that I should wait until the next release?
Douglas Kosovic avatar
cn flag
I've edited my answer, more details there about the recent NetworkManager-l2tp source code commit that should do what you need. The Manual IPv4 configuration options; Address, Netmask and Gateway are more like suggestions to pppd. You can build the NetworkManager-l2tp source code now if you wish. But I'll probably be releasing a new version of NetworkManager-l2tp in the next couple of weeks or so and then put up new PPA packages on https://launchpad.net/~nm-l2tp/+archive/ubuntu/network-manager-l2tp
Douglas Kosovic avatar
cn flag
Backport of network-manager-l2tp-1.20.8 from Debian Sid which contains the aforementioned commit along with a subsequent fix now up on the PPA : https://launchpad.net/~nm-l2tp/+archive/ubuntu/network-manager-l2tp
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.