Discrepancy in own IP address routes and in NetworkManager

I set my IP manually in NetworkManager to 192.168.1.150.
ip addr shows 192.168.1.150
netstat -nar shows my ip address, however, as 192.168.1.149

Is this normal?

ip route shows: 192.168.1.149/31 blah blah src 192.168.1.150

Why the 149 address?? Is that because I chose 255.255.255.254 (/31) subnet?

This is due to the subnet chosen. Routing table shows the lowest subnet address, which in this case of subnet 255.255.255.254 (/31) is 1 lower than 150 resulting in 149.

It is not normal to use a subnet with only 2 addresses. One is the net address and one is the broadcast address for that subnet, neither is really usable.

Most home routers use a subnet mask of /24 (255.255.255.0) to allow up to 254 usable IPs. With a subnet of /31 there will be no additional IPs that can be reached properly.

Check one of the netmask tables on the internet to see what you really should be using for your LAN. The PC needs to be able to reach the router and should use a netmask that is the same as the router uses.

But with that /31 subnet I was reaching the router 192.168.1.1 totally fine.

And I’m reaching the router now after I constricted my subnet to 255.255.255.255 even.

Right, but sometimes it may work and sometimes not. If the LAN is idle and the arp cache has expired then problems where the cause is obscure may appear. Mismatched subnet masks are very hard to troubleshoot at times. Having a host netmask (/32) is less troublesome than a mismatched subnet mask in many cases due to the automatic searching that occurs in that case.

1 Like

The correct netmask is likely to be 255.255.255.0 depending on your routers configuration.
The biggest netmask allowed with 192.168.0.0/16 is 255.255.0.0.

If you are using DHCP then the address and netmask should be set correctly for you with out the need to manual configure.

DHCP disabled, all manual. DHCP is a bit of a security issue, as are any servers, especially on routers without SELinux.

Ok then find out what the router is configure for and match your netmask to the router value.