0

I have set up a yaml file in folder '/etc/netplan' following the template:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: false
      addresses:
        - my public ip from 'curl ipinfo.io/ip'
      gateway4: my gateway ip from 'ip route | grep default', e.g. it is 192.168.1.1 for log "default via 192.168.1.1 dev eth0"
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4

Also, I have set my nginx as

server {
    listen 80;
server_name my_public_ip;

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

I am sure my FastAPI server (hosted with Gunicorn and Nginx) works when I change the "my_public_ip" to the private IP address ('192.168.50.136') shown in VM summary page of the Proxmox UI.

I am still not able to send a request to my running server "my_public_ip_addr:80" ;_;

This is the summary of my Ubuntu 24.04 Server Virtual Machine

Proxmox Setting Image The first IP is my public ip from 'curl ipinfo.io/ip'.

Do I need to create another Network -> Linux Bridge? e.g. another CIDR, Gateway etc...

I am new to this, can anyone please help? Thank you!

I didnt setup ufw firwall

sudo ufw status
Status: inactive

1 Answers1

0

I am assuming you have the public IP and the internal IP on the same interface.

If this is the case, make sure you setup up your firewall rules, to keep your system safe. I would recommend only opening ports you need and even then restrict access to the ports to be from ip addresses you know.

Do a search for iptables and you find a wealth of knowledge online.

You will need to enable ip forwarding and localnet route.

sysctl net.ipv4.conf.all.route_localnet=1 sysctl net.ipv4.conf.all.forwarding=1

You may need to setup nat routing, for any vm's that are running on the host, if proxmox has not already done so.

Luke Attard
  • 1,065