Single IP network config

M4r5.

New Member
Apr 12, 2022
1
0
1
Hello, guys!
Here is the situation:
I have rented VDS with one IP. I have tried all the manual, that I find - It's wont working.

in /etc/network/interfaces
Code:
auto lo
iface lo inet loopback

iface lo inet6 loopback

# The primary network interface with IP

allow-hotplug enp5s0
auto enp5s0
iface enp5s0 inet static
        address 12.12.12.65/32
        netmask 255.255.255.224
        gateway 12.12.12.1
       dns-nameservers 1.1.1.1

# Bridge with NAT forwarding from a private subnet
auto vmbr0
iface vmbr0 inet static
    address 192.168.175.1
    netmask 255.255.255.0
    bridge-ports none
    bridge-stp off
    bridge-fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '192.168.175.0/24' -o enp5s0 -j MASQUERADE
    post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
    post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
    post-down iptables -t nat -D POSTROUTING -s '192.168.175.0/24' -o enp5s0 -j MASQUERADE
I google google google for two days already about 18 hours a day, and best of all i have got playing with it - it's that ping to 12.12.12.65 start works, but no more, the dns wont working.. I a like a maniac, almost falling asleep but cant sleep before i fix it. Where should i look?
I found an article the man make a proxy on one vm, but it doesn't looks like good solution..
 
Hi,
The vmbr0 section of the config looks okay to me, but there are issues with enp5s0.
In short, I guess that it should look like:
Code:
allow-hotplug enp5s0
auto enp5s0
iface enp5s0 inet static
        address 12.12.12.65/25
        gateway 12.12.12.1

Changes to enp5s0:
  • Specify netmask '/25' which is in the same subnet as the default gateway (covers addresses from 12.12.12.1 to 12.12.12.127)
  • Remove 'netmask' line, which conflicted with the subnet given in the address line (see CIDR notation [1]), so that only a single subnet mask is specified.
  • Remove 'dns-nameservers' line. DNS servers should be specified in the file '/etc/resolv.conf', not in '/etc/network/interfaces'

If you have the package ifupdown2 [2] installed (default with Promxox VE 7.x), please make this change, then run the command: ifreload -a
If you have not installed ifupdown2, please reboot the server for the change to take effect.

[1] https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
[2] https://cumulusnetworks.github.io/ifupdown2/ifupdown2/index.html