NS8 +SAMBA on VPS - Add virtual interface

I am currently installing NS8 under Debian 12 on a vhost. When setting up SAMBA inclussive shares it asks for an IP address. Since I only have the WAN address, I need an additional internal one.
How do I do this? There is no dialogue in the GUI and I would have to do this on the command line.

ip addr shows me

root@mdol-ns8:~# ip addr show
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 noprefixroute
       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 76:37:e1:f2:75:d0 brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    altname ens3
    inet 88.57.42.223/22 brd 88.57.42.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a03:4000:66:134:7437:e1ff:fef2:75d0/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::7437:e1ff:fef2:75d0/64 scope link
       valid_lft forever preferred_lft forever
3: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.5.4.1/32 scope global wg0
       valid_lft forever preferred_lft forever

cat /etc/network/interfaces shows me

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens3

Is it right to do:

nano /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 88.57.42.223
    netmask 255.255.252.0
    gateway 88.56.41.1

iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0

and finally:
systemctl restart networking

or better:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens3
iface ens3 inet dhcp

# Additional internal IP address
auto ens3:0
iface ens3:0 inet static
    address 192.168.1.10
    netmask 255.255.255.0

I think the best way is to add a virtual dummy interface as we did in NS7.

Debian instructions

To add the dummy interface either create the file /etc/network/interfaces.d/dummy or just use the file /etc/network/interfaces to add the following:

auto dummy0
iface dummy0 inet static
address 192.168.1.10
netmask 255.255.255.0
pre-up ip link add dummy0 type dummy
post-down ip link delete dummy0

To setiü loading the dummy module at boot, execute following command:

echo dummy > /etc/modules-load.d/dummy.conf

To load the module now:

modprobe dummy

To restart the network:

systemctl restart networking

Check interfaces:

ip a

The new dummy interface should be there.

RHEL instructions

Instructions for RHEL Distros like Rocky and Alma about the creation of the virtual interface are in the old wiki.

EDIT:

I corrected the instructions and added

post-down ip link delete dummy0

to the dummy interface to correctly remove dummy0, else restarting the network won’t work.

2 Likes

thank you, it works perfectly.

2 Likes