1

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?

0

the problem is that you used a VLAN 802.1q interface, it's not an alias interface, so you have 2 different VLAN,and you need a typical router-on-sitck configuration to do this or you need to create a dummy interface with dummy module (may be it's more easy) in this way:

#! /bin/bash
modprobe dummy
ip link set name ethvirt dev dummy0
ifconfig ethvirt hw ether 00:22:22:03:02:74
ifconfig ethvirt 192.168.1.254 netmask 255.255.255.0 up

Hope it helps!

  • Thank you! Should I write this on the client (C) side? – Skaarjasaurus Nov 13 '15 at 11:05
  • No this configuration it's ok if you have one server with just one interface, I suppose that's the problem. Otherwise you need to perform a VLAN configuration on your switch or remove eth0.1 in eth0 – Francesco P Nov 13 '15 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.