-1

I'm on Ubuntu Server 14.04 on an embedded Linux box, eth0 is the internal ethernet port which is configured with a static IP and is used only for "service" purposes. The final user should be allowed to plug a USB-Ethernet adapter that should be configured as eth1 and get its configuration from the DHCP.

Now, considering that eth0 is configured on a 192.168.0.0/24 class and there can be only one gateway in a system, how can I have both ports living together?

My /etc/network/interfaces file looks pretty much like this:

auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 8.8.8.8 8.8.4.4

allow-hotplug eth1
iface eth1 inet dhcp

When the system is booted with the USB adapter already plugged in, the eth1 is immediately configured, but I can't get any connection though it unless I also connect a wire to internal eth0. Of course, my aim is to leave eth0 alone (which will be unaccessible to the final user) and let eth1 work indipendently. But I also want to access eth0 occasionally, in case I need to service the machine. The SSHd responds only to the IP assigned to eth0, so it's important to me that eth0 remains active and functioning.

Mark Miles
  • 99
  • 1
  • What does the other interface look like? `ip addr; ip route` output while both are up would help. – John Mahowald Mar 13 '16 at 01:30
  • What 'other' interface? I think my question was clear enough, the system has only two interfaces, one is eth0, it's hardwired on the PC board and is configured with a static IP (look at my `interfaces` file), while eth1 can be plugged via USB and should be auto-configured by an external DHCP server (it is supposed that the user is connecting the device to a network with at least one DHCP server). There's no other interface. – Mark Miles Mar 13 '16 at 10:46
  • What is the DHCP range that eth1 can get and what is an example reservation from it? – John Mahowald Mar 13 '16 at 13:27
  • In my home environment, i.e. where I'm testing this connection, I have the DHCP set on my router with range 192.168.0.10 ~ 192.168.0.199, but the end user might have a different configuration. – Mark Miles Mar 13 '16 at 14:35

1 Answers1

0

Depends on how you structure this network, but sounds like you are attempting to set up two interfaces with the same gateway so they are independent of each other. This will complicate things for you.

Often a management network is on a different subnet and gateway, which you can both route as you see fit. It could be a different VLAN or physical switch for better isolation.

Depending on hardware capabilities it could also be an out of band lights out management like IPMI or Intel AMT. That gains you remote power control in addition to a remote console independent of the OS.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34