V-change-web-domain-ip problem

How do I solve this problem?
v-change-web-domain-ip user domain-com 1.2.3.4
grep: /usr/local/hestia/data/ips/1.2.3.4: No such file or directory
grep: /usr/local/hestia/data/ips/1.2.3.4: No such file or directory
Error: Parsing error

  • ‘[’ 12 -eq 0 ‘]’

Looks like the IP 1.2.3.4 is not added to Hestia. You must add it before you can assign the IP to a domain.

You can list the IPs using this command:

v-list-sys-ips
1 Like

The problem is actually that I added the following ip address 192.168.2.x/32 on the server, but hestia automatically added it to the panel in a way that was NAT’ted to the external ip, then when I moved, every site received this ip address. I changed the websites assigned to this ip address to the other ip address I use, but I encountered too many errors. I cannot define it as Default IP. When I try to add a new webdomain, the other ip I added later is automatically selected, how can I overcome this problem?

I need more info, The other ip, the new ip, etc. doesn’t makes sense to me. What errors?

ip a
ls -l /usr/local/hestia/data/ips/
v-list-sys-ips json

Also, show the conf for one of those web domains:

 v-list-web-domain YourUser YourDomain json
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 1.2.3.5/29 brd 77.92.146.151 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::e888:f9ff:fef2:9e6c/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.147/24 brd 192.168.2.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::4035:78ff:fef4:6d87/64 scope link 
       valid_lft forever preferred_lft forever
total 8
-rw-rw---- 1 root root 177 Jan 16 03:32 192.168.2.147
-rw-rw---- 1 root root 193 Jan 16 07:05 1.2.3.5
{
    "192.168.2.147": {
        "OWNER": "admin",
        "STATUS": "shared",
        "NAME": "",
        "U_SYS_USERS": "deneme-user",
        "U_WEB_DOMAINS": "1",
        "INTERFACE": "eth1",
        "NETMASK": "255.255.255.0",
        "NAT": "1.2.3.4",
        "TIME": "14:10:22",
        "DATE": "2025-01-13"
        },
    "1.2.3.5": {
        "OWNER": "admin",
        "STATUS": "shared",
        "NAME": "",
        "U_SYS_USERS": "test,deneme-user",
        "U_WEB_DOMAINS": "643",
        "INTERFACE": "eth0",
        "NETMASK": "255.255.255.248",
        "NAT": "",
        "TIME": "23:36:40",
        "DATE": "2024-03-14"
        }
}

I masked the data.
default ip adresss: 1.2.3.5
1.2.3.4 second ip adress = NAT private 192.168.2.147

You forgot this command:

 v-list-web-domain YourUser YourDomain json

Ok, now please explain what you need, what you tried, how you tried it, and what errors you encountered.

When a new web domain is added, the ip address of the website is assigned as 1.2.3.4 (192.168.2.147).
But I use the public ip address 1.2.3.5. This ip address was there when I set up the server.

(192.168.2.147) is the ip address I added as eth1 via netplan.

How can I set this configuration as the default IP address.

1.2.3.5 ip address should be selected by default when adding a new web domain or when I add it via cli, it should automatically create records with this ip address.

Hestia doesn’t allow setting a default shared IP address directly. While you could modify the script /usr/local/hestia/bin/v-list-user-ips and the function /usr/local/hestia/func/ip.sh to make Hestia always use 1.2.3.5 as the default IP for your domains, this approach is not recommended. Any changes you make will be overwritten during the next update.

Anyway, if you want to test it:

In /usr/local/hestia/bin/v-list-user-ips replace this:

ips="$(echo -e "$user_ips\n$owner_ips" | sort -u | sed "/^$/d")"

by this

ips="$(echo -e "$user_ips\n$owner_ips" | sort -ru | sed "/^$/d")"

In /usr/local/hestia/func/ip.sh inside function get_user_ip replace this:

ip=$(get_user_ips | head -n1)

by this

ip=$(get_user_ips | tail -n1)

Again, you shouldn’t modify any of those files. Instead, select the correct IP when adding a web domain or specify it as a parameter when adding the domain from the command line.

1 Like