We have a setup of two computers. S is the server with internet access and C is the client that is connected to the server via the 192.168.0.0/24 network. This works just fine, but a third computer, C2, should be connected to C.
The problem is that C and C2 must connect via 192.168.0.0/24 and C2 must not see S. Thus, we want to add a virtual network between S and C that uses 192.168.1.0/24.
I.e., we have:
S <-- 192.168.0.0/24 -- C <---- X ---- C2
And we want:
S <-- 192.168.1.0/24 -- C <-- 192.168.0.0/24 -- C2
We add the following to /etc/network/interfaces in S (previously connected to C via eth0), and executes "ifup eth0.1":
auto eth0.1 iface eth0.1 inet static address 192.168.1.254 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255
And in C, after "ifdown eth0", remove the old if and type:
auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254
Then, "ifup eth0".
And it doesn't work! Ping just says:
$ ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. From 192.168.1.254 icmp_seq=1 Destination Host Unreachable From 192.168.1.254 icmp_seq=2 Destination Host Unreachable
When we change back everything works and we can even ping eth0.1 from the client. How do you change network from the client side?