0

I'm running ubuntu server 20.04 LTS in raspi 4 model B.

I want to set a static IP in one raspi and run API over that ip and that must me accessible over the the network to which I'm connected to. I have wlan0 and wlan1 in both devices.

For example i want to connect wlan0 (with static ip) of device1 to a router and device2 will also be connected to the same router and I must be able to access the static ip of the device1 in device2

Is this possible i tried few configurations but i was not able to connect to the IP remotely

Edit : Content of yaml file is as below

network:
  ethernets:
    eth0:
      dhcp4: true
      optional: true
  version: 2
  wifis:
    wlan0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.200/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]
      access-points:
        "SSID":
          password: *********
    wlan1:
      access-points:
        "SSID":
          password: *********
      dhcp4: true
      optional: true
Eldho K K
  • 21
  • 7
  • 1
    The easiest way may be to reserve the IP address assigned by the router via the router set up. You will need to know the MAC address associated with the Raspberry Pi's wlan0 interface. Each router is different and this is beyond the scope of this site. – user68186 Nov 30 '22 at 17:38
  • No i can't do this because this will be a production device, i can't get access to their routers – Eldho K K Nov 30 '22 at 17:49
  • You will need to know which IP address will be available in the production environment for static allocation and assign an IP address from that pool. – user68186 Nov 30 '22 at 17:51
  • You may find [Ubuntu 17.10 Server static IP netplan - how to set netmask](https://askubuntu.com/questions/972955/ubuntu-17-10-server-static-ip-netplan-how-to-set-netmask) useful. Please post the content of the file `/etc/netplan/01-netcfg.yaml` in [your question](https://askubuntu.com/posts/1443294/edit). – user68186 Nov 30 '22 at 18:00
  • I think i tried the same thing but it didn't work and also stopped blocked internet connection – Eldho K K Nov 30 '22 at 19:40
  • Make sure the IP address you want to use as static, `192.168.0.200`, is not within the range the router uses to dynamically assign IP addresses. Look in the "DHCP Server" section of your router. My router reserves the range `192.168.0.100` to `192.168.0.249` for dynamic assignment. If you assign a static IP address within this range, there may be a conflict as the router may assign the same IP to another device. – user68186 Nov 30 '22 at 20:12
  • What do you get when you use the command `sudo netplan try`? What is the output of `ip a`? – user68186 Nov 30 '22 at 20:27

0 Answers0