3

I'm running TVheadend on my Pi 2 with Raspbian 8 Jessie. I would like to use an Sat over IP receiver with Tvheadend and to be able to receive all 4 streams of the receiver I need 4 (virtual) IP's on my Pi. This project is related to this tutorial.

What I already did was configuring /etc/interfaces/ and /etc/dhcpd.conf. But ifconfig still shows only one IP Adress.

This is my /etc/network/interfaces/

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.24
netmask 255.255.255.0
gateway 192.168.0.1

auto eth0:1
iface eth0:1 inet manual
vlan-raw-device eth0

auto eth0:2
iface eth0:2 inet manual
vlan-raw-device eth0


auto eth0:3
iface eth0:3 inet manual
vlan-raw-device eth0

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

And this is my /etc/dhcpd.conf

nohook lookup-hostname
interface eth0
  static ip_address=192.168.0.24/24
  static routers=192.168.0.1
  static domain_name_servers=192.168.0.1

interface eth0:1
  static ip_address=192.168.0.71/24
  static routers=192.168.0.1
  static domain_name_servers=192.168.0.1

interface eth0:2
  static ip_address=192.168.0.72/24
  static routers=192.168.0.1
  static domain_name_servers=192.168.0.1

interface eth0:3
  static ip_address=192.168.0.73/24
  static routers=192.168.0.1
  static domain_name_servers=192.168.0.1

Does anybody know what could be the problem?

8
  • Both interfaces eth0:2 and eth0:3 have been assigned with the same IP Address of 192.168.0.72 and that could probably cause some problems.
    – user91822
    Oct 13, 2018 at 16:27
  • @user91822 I corrected this mistake, but still I only get one IP Adress working.
    – apfelcast
    Oct 13, 2018 at 16:52
  • If you are able to SSH into your device using each of the IP Addresses, then I would say your configuration would be OK.
    – user91822
    Oct 13, 2018 at 19:48
  • @user91822 I tried to login via SSH using one of these IP Adresses, but none worked.
    – apfelcast
    Oct 13, 2018 at 19:54
  • Which IP address is the one that is working? Oct 13, 2018 at 20:05

1 Answer 1

3

The following works for me

First, remove the interface eth0:? stuff in /etc/dhcpcd.conf - but keep the entries for interface eth0

second, create a file in /etc/network/interfaces.d - call it whatever eth0-subs or something, name doesn't matter

The content of that file:

auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
    vlan-raw-device eth0
    address 192.168.0.71
    netmask 255.255.255.0
    gateway 192.168.0.1

auto eth0:2
allow-hotplug eth0:2
iface eth0:2 inet static
    vlan-raw-device eth0
    address 192.168.0.72
    netmask 255.255.255.0
    gateway 192.168.0.1


auto eth0:3
allow-hotplug eth0:3
iface eth0:3 inet static
    vlan-raw-device eth0
    address 192.168.0.73
    netmask 255.255.255.0
    gateway 192.168.0.1

I'm not 100% sure the allow-hotplug is actually needed, but I had issues when I was trying to get this working


NOTE: I've enabled predictable interface names and I found it is impossible to create such "sub-interfaces" at all

i.e. even ifconfig enxXXXXXXXXXXXX:0 192.168.1.3 just changes the IP address of enxXXXXXXXXXXXX and does not "create" a sub-interface

OK - for those who use "predictable interface names"

auto enxb827ebXXXXXX
allow-hotplug enxb827ebXXXXXX

iface enxb827ebXXXXXX inet static
  address 192.168.0.71
  netmask 255.255.255.0

iface enxb827ebXXXXXX inet static
  address 192.168.0.72
  netmask 255.255.255.0

iface enxb827ebXXXXXX inet static
  address 192.168.0.73
  netmask 255.255.255.0

ifconfig in this case will probably show 192.168.0.71 as the primary for enxb827ebXXXXXX - but ip address show will show all four addresses, with 0.24 as the last secondary - if this is an issue, then remove the eth0 entry in /etc/dhcpcd.conf, and add

iface enxb827ebXXXXXX inet static
  address 192.168.0.71
  netmask 255.255.255.0
  gateway 192.168.0.1

just below allow-hotplug

6
  • Thank you! Now I got the 4 addresses working. But I need the 0.24 as my primary address. I think you tried to explain that in your post but I did not really understand what to do, because in dhcpcd.conf the only eth0 entry is the one with 0.24.
    – apfelcast
    Oct 14, 2018 at 7:59
  • remove eth0 settings from dhcpcd.conf and add it as auto eth0 etc in the file you created above - I know everything you read is saying /etc/networks/interfaces is "deprecated" or similar, but it seems that this is the only way to get sub-interfaces working Oct 14, 2018 at 8:01
  • hang on ... that primary/secondary problem is with predictable interface names (I thought) Oct 14, 2018 at 8:03
  • I'm not using predictable interface names but it seems I do have the same issue.
    – apfelcast
    Oct 14, 2018 at 8:04
  • hmmm, that's weird - does it being secondary according to ip address show matter? You could always remove the eth0 stuff from dhcpcd.conf and add the entries for eth0 in the file you created for the answer I guess Oct 14, 2018 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.