Attivare dhcpd3-server su un'interfaccia dummy

From RVM Wiki
Jump to navigation Jump to search

Normalmente no è possibile, e si otterrebbe l'errore:

 No subnet declaration for dummy0 (0.0.0.0).
 ** Ignoring requests on dummy0.  If this is not what
    you want, please write a subnet declaration
    in your dhcpd.conf file for the network segment
    to which interface dummy0 is attached. **

Si può però cambiare il nome all'interfaccia dummy0.

  • Attivare dummy0
sudo modprobe dummy
  • Attivarla:
sudo ifconfig dummy0 0.0.0.0
  • Verificare i dettagli udev:
udevadm info -a -p /sys/class/net/dummy0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/net/dummy0':
    KERNEL=="dummy0"
    SUBSYSTEM=="net"
    DRIVER==""
    ATTR{addr_len}=="6"
    ATTR{dev_id}=="0x0"
    ATTR{ifalias}==""
    ATTR{iflink}=="30"
    ATTR{ifindex}=="30"
    ATTR{features}=="0x0"
    ATTR{type}=="1"
    ATTR{link_mode}=="0"
    ATTR{address}=="fa:d6:c8:a2:d9:f1"
    ATTR{broadcast}=="ff:ff:ff:ff:ff:ff"
    ATTR{carrier}=="1"
    ATTR{dormant}=="0"
    ATTR{operstate}=="unknown"
    ATTR{mtu}=="1500"
    ATTR{flags}=="0x83"
    ATTR{tx_queue_len}=="0"
  • Disabilitarla
sudo rmmod dummy
  • Impostare il nuovo nome tramite udev:
sudoedit /etc/udev/rules.d/70-persistent-net.rules
...
# dummy interface for dhcpd3-server
SUBSYSTEM=="net", KERNEL=="dummy0", NAME="vif0"
...
  • Attivare la regola:
udevadm trigger
  • Definire l'interfaccia nella configurazione:
sudoedit /etc/network/interfaces
...
auto vif0
iface vif0 inet static
       address 10.11.12.253
       netmask 255.255.255.0
       pre-up /sbin/modprobe dummy
       post-down /sbin/rmmod dummy
...
  • Attivarla
sudo ifup vif0
  • Verificarla:
ifconfig vif0
vif0      Link encap:Ethernet  HWaddr 1a:5a:59:1d:47:39  
         inet addr:10.11.12.253  Bcast:10.11.12.255  Mask:255.255.255.0
         inet6 addr: fe80::185a:59ff:fe1d:4739/64 Scope:Link
         UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0 
         RX bytes:0 (0.0 B)  TX bytes:210 (210.0 B)
  • Definire l'interfaccia di ascolto di dhcpd3 su vif0:
sudoedit /etc/default/dhcp3-server 
...
INTERFACES="vif0"
...
  • Avviare dhcpd3-server
sudo invoke-rc.d dhcpd3-server restart

ATTENZIONE: QUESTA INTERFACCIA EQUIVALE AD UNA HOST ONLY PER VIRTUALBOX, E NON È UTILIZZABILE PER NATTARE. INFATTI LE VM SI PINGANO E VEDONO TRA LORO, MA NON È POSSIBILE PINGARE LA vif0 dalle vm

Riferimenti