1

I'm trying to configure a virtual network in VirtualBox with a central node as gateway & DHCP & DNS server (I'm using the dnsmasq).

Central node has two interfaces:

  • enp03 which faces the host network. It configured by host network DHCP and has a dynamic IP address.
  • enp08 which faces the virtual network. dnsmasq is listening this interfase.

Now I want to set some static configuration for enp08.

Is it possible to do something like that in /etc/network/interfaces:

auto enp03
iface enp03 inet dhcp

auto enp08
iface enp08 inet static
 address 10.0.5.1
 netmask 255.255.255.0
 gateway enp03
xhienne
  • 17,793
  • 2
  • 53
  • 69
Silk0vsky
  • 213
  • 1
    @Christopher I don't think the OP wants to add a second route. IMO, they want to duplicate the default one. – xhienne Jan 13 '17 at 00:46

1 Answers1

2

If I understand correctly, you want to define a gateway for the enp08 interface, and tell the kernel that this gateway is the same than the one used on enp03, right?

Then just remove/comment that gateway line. It defines a default gateway and the default is already set (by DHCP on enp03), no need to add a duplicate.

xhienne
  • 17,793
  • 2
  • 53
  • 69
  • Thus, if we don't configure the gateway for some network interface (enp08) then it would be searched on other configured interfaces (enp03, ...) for all incomming enp08 packets? Is it exsists some priority for that searh for configured interfaces (enp03, ...)? – Silk0vsky Jan 13 '17 at 07:31
  • 1
    Yes. You need only one default gateway, not one per interface. Actually, the problems start when you have multiple default gateways, not when you have one. Then it depends on your system: certain alternate between the two (round-robin), others use only the last. The best then is to put a priority (metrics) on each gateway. The lower the better. – xhienne Jan 13 '17 at 09:02