Score:1

How to set a static ip address with a /22 subnet?

gp flag

I am trying to set a static ip address on an ubuntu server 22. It is a fresh install.

The issue I am having is I cannot access the server from a different subnet. I have tried everything I can think of. I normally am not this silly with basic networking but I am not use to the new style of netplan.

Here is my config.

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      addresses: 
      - 192.168.1.80/22 
      nameservers: 
        addresses: 
        - 192.168.1.1 
        search:
        - internal.     .co
      routes:
      - to: default
        via: 192.168.1.1
  version: 2

My DHCP scope is 192.168.3.0/24. My servers live on 192.168.1.0/24.

My subnet is /22.

When I ping from 192.168.3.100 I get no response and cannot SSH.

When I ping from 192.168.1.10 I get a response.

My ubuntu server 192.168.1.80 can ping google.

What am I missing?

Thank you

Edit: I have included the screenshot of ifconfig ens18 ifconfig

My desktop is on IP 192.168.3.113. My physical host is on IP 192.168.1.10 My windows server is on IP 192.168.1.20 This Ubuntu Server is on IP 192.168.1.80

My desktop can ping the physical server and windows server but not the ubuntu server.

My physical server can ping the windows server, my desktop, and the ubuntu server.

The ubuntu server can ping google, the physical server but not my desktop.

Artur Meinild avatar
vn flag
Are you sure the static IP is not set? The config looks correct (maybe apart from the search domain), could it be a setting in you network equipment? What does `ifconfig ens18` report?
Mark Bingenheimer avatar
gp flag
The static ip is set. I can ping to it on the same subnet. I just can't see it from 192.168.3.x
Artur Meinild avatar
vn flag
Then I don't think this relates to Ubuntu, but to your network setup in general? Also, it should be the same subnet since /22 is the range 192.168.0.1-192.168.3.254.
Mark Bingenheimer avatar
gp flag
Sorry I was not on my computer before but now I am. See original post for edits with the information you asked for.
Artur Meinild avatar
vn flag
If you're using a router/firewall/DHCP server, then this should also be configured to use subnet /22.
Mark Bingenheimer avatar
gp flag
See above, I was able to get the screenshot as requested.
st flag
It looks like the Ubuntu configuration is perfectly fine. The problem is with your network setup, which has nothing to do with Ubuntu and is thus off-topic here.
Mark Bingenheimer avatar
gp flag
I just solved it a little bit ago and was coming to share. I had to add on-link: true below the route via line and it worked perfectly without any updates to my network.
Mark Bingenheimer avatar
gp flag
Credit to this post. https://askubuntu.com/questions/1246528/different-gateway-subnet-on-ubuntu-makes-network-unreachable
Score:0
gp flag

The solution was to add

On-link: true

I used this link to solve my problem.

different gateway subnet on ubuntu makes network unreachable

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.