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.