I have a set-up with three devices, all running Ubuntu 14.04. The set up looks as follows:
What I would like to have is a configuration in which both devices can connect to the internet but can also connect to each other. And ideally, the host PC should have the same IP when connected to from either device. I have tried two possible configurations, but both failed.
1: usb0 and usb1 use the same IP and subnet
host
iface usb0 inet static
address 10.0.1.1
netmask 255.255.255.0
up route add 10.0.1.1 netmask 255.255.255.0
iface usb1 inet static
address 10.0.1.1
netmask 255.255.255.0
up route add 10.0.1.1 netmask 255.255.255.0
device 0
iface usb0 inet static
address 10.0.1.2
netmask 255.255.255.0
route add default gw 10.0.1.1
device 1
auto usb0
iface usb0 inet static
address 10.0.1.3
netmask 255.255.255.0
route add default gw 10.0.1.1
! problem !
Only device 0 gets connected. This one can be pinged, and it can connect to the internet but device 1 is completely out of the game. It therefore also has no internet connection.
2: usb0 and usb1 have a different IP address
host
iface usb0 inet static
address 10.0.1.1
netmask 255.255.255.0
up route add 10.0.1.1 netmask 255.255.255.0
iface usb1 inet static
address 10.0.2.1
netmask 255.255.255.0
up route add 10.0.2.1 netmask 255.255.255.0
device 0
iface usb0 inet static
address 10.0.1.2
netmask 255.255.255.0
route add default gw 10.0.1.1
device 1
auto usb0
iface usb0 inet static
address 10.0.2.2
netmask 255.255.255.0
route add default gw 10.0.2.1
! problem !
I am not able to ping 10.0.1.1 from device number 1.
Question
How do I connect the two usb interfaces so that it forms a bigger local network in which ideally every machine has one IP address, is connected to the internet and is able to access every other machine through SSH?