21

I'm new to Ubuntu Core. On first login I selected the option: Will use DHCP for IPv4

Now I'd like to change my machine to use a static IP to be easier to log in remotely.

I ran sudo console-conf on the machine (over ssh, if relevant). This gives me the option to select Use a static IPv4 configuration, which I do.

This gives me the fields subnet, address, gateway,name servers, andsearch domains`. What should I set for these fields? I would like my IP address to be 192.168.1.101. It is currently 192.168.1.13 from DHCP. My chosen IP address is pretty arbitrary, but I'm going to have a group of computers that I'd like to have the IP addresses 192.168.1.1XX.

I'm used to setting my subnet to 255.255.255.0, but I get the error message: should be in CIDR form (xx.xx.xx.xx/yy). I'm not sure what this means or how to fix it. When I try adding /24 at the end of the subnet, the error message goes away and I get a new error message: '192.168.1.101' is not contained in '255.255.255.0/24'.

Update: Here is a screenshot of the error messages

tsteiner
  • 676
  • 1
  • 5
  • 8
  • 3
    Welcome to AskUbuntu! `CIDR` notation is used for the IP address, not the netmask, have you tried `192.168.1.101/24`? – Daniele Santi Sep 08 '18 at 06:34
  • Thanks @MrShunz. I tried adding the CIDR to the IP address but it won't let me type in the `/` character. I attached a screenshot of the error message, in case it helps anyone. – tsteiner Sep 08 '18 at 13:40
  • 3
    For the subnet, please try: `192.168.1.0/24` Reference: https://askubuntu.com/questions/1015632/ubuntu-core-wifi-configuration-issue – chili555 Sep 08 '18 at 15:27
  • I advice to configure dhcp on router so it give preferred ip based on mac, if that possible in router settings – LeonidMew Apr 27 '20 at 10:00
  • Just to clarify the solution that was given. The mistake is that subnet 192.168.x.x/x is being confused with the subnet mask (usually 255.255.255.0). A quick explanation is that the ip4 address including the cidr (the number after /) tells us what the mask should be and so can be omitted. So for the point of completeness, a bit of light reading can be found at https://en.wikipedia.org/wiki/Subnetwork if you want a deeper dive into IPv4 subnetting. – Andrew Apr 24 '20 at 15:14

2 Answers2

32

Thanks to @MrShunz and @chili555 in the comments. These are the settings that worked for me: Subnet: 192.168.1.0/24 Address: 192.168.1.101 Gateway: 192.168.1.1 Name servers: 8.8.8.8

Screenshot

tsteiner
  • 676
  • 1
  • 5
  • 8
1

If your router gateway is 192.168.0.1 you can use the following that worked for me:

subnet: 192.168.0.0 address: 192.168.0.101 gateway: 192.168.0.1 name servers: 1.1.1.1

Kevin Zhan
  • 11
  • 1