eth0 or eth1 is the logical name given to your network card by Linux (I dont know exactly which component handles the naming but i guess its the kernel). you can only use eth0 or eth1 if its the logical name given to your card and not otherwise.
Coming to your original problem i.e using different hardware address at different locations, this is doable by defining logical name mapping in /etc/network/interfaces
file but you will have to connect manually to network using ifup
command eachtime.
To do this open your /etc/network/interfaces
file and replace its contents with following
auto lo
iface lo inet loopback
mapping eth0
script /home/<username>/net.sh
map eth0 eth0-home
map eth0 eth0-work
iface eth0-home inet static
address #ip address for home
netmask #subnet mask for home
hwaddress ether #MAC address for home
iface eth0-work inet static
address #ipaddress for work
netmask #netmask for work
hwaddress ether #MAC address for work
set the ip address, netmask and hwaddress for eth0-home and eth0-work to your liking. Also replace the <username> in fourth line of the script with your user name. Now save and close the interfaces file.
Now create a file /home/<username>/net.sh with the following contents
#!/bin/sh
echo eth0
save and close the net.sh file.
You are all set now. You can use command sudo ifup eth0=eth0-home
to start network with eth0-home settings and sudo ifup eth0=eth0-work
to start with eth0-work settings.
Also please note that the mapping section in interfaces file and the script file that we created in your users home directory are actually needed when the interface is configured to connect automatically. But we need to provide them for things to work. So the contents of the script file and the contents of mapping section are just sort of place holders. If you are interested in connecting automatically you will need to modify these two. For further discussion of the two you can see man page for interfaces(5) or visit the following link http://addisu.taddese.com/blog/mapping-in-linux-network-interfaces/
interfaces
file iseth0
, why is iteth1
in the file?