I would like to have a network for 10+ Pi with a switch (192.168.42.x). This switch is connected to Internet via one port (to an another switch).
I try to have one Pi with the ip (eth0) 192.168.1.127 (which is connected to internet) and a virtual ip like 192.168.42.1 to connect to the other Pi (and they will have Internet via Pi #1)
So far, no luck :)
My dhcpcd.conf :
denyinterfaces eth0
interface eth0.2
static ip_address=192.168.42.1/24
static routers=192.168.42.1
static domain_name_server=1.1.1.1 8.8.8.8
And i add in /etc/network/interfaces
auto eth0.2
iface eth0.2 inet manual
vlan-raw-device eth0
I've installed vlan (apt-get install vlan) et /etc/modules contains 8021q.
The interface eth0.2 is displayed when i do a 'ifconfig' but i cannot ping an another pi on the switch (for example with the ip 192.168.42.3).
My ifconfig :
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.127 netmask 255.255.255.0 broadcast 192.168.1.255
ether b8:27:eb:4d:36:17 txqueuelen 1000 (Ethernet)
RX packets 2201 bytes 162493 (158.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 983 bytes 73130 (71.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0.2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.42.1 netmask 255.255.255.0 broadcast 192.168.42.255
inet6 fe80::55c4:a14b:2dec:f810 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:4d:36:17 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 135 bytes 8414 (8.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Boucle locale)
RX packets 130 bytes 7259 (7.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 130 bytes 7259 (7.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.3.141.1 netmask 255.255.255.0 broadcast 10.3.141.255
inet6 fe80::baf7:cd15:76c2:e46a prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:18:63:42 txqueuelen 1000 (Ethernet)
RX packets 603 bytes 91522 (89.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 147 bytes 24893 (24.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
My routing table is :
default livebox 0.0.0.0 UG 202 0 0 eth0
default 192.168.42.1 0.0.0.0 UG 204 0 0 eth0.2
default 10.3.141.1 0.0.0.0 UG 303 0 0 wlan0
10.3.141.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.42.0 0.0.0.0 255.255.255.0 U 204 0 0 eth0.2
Perhaps, there is too much default route ? What have I missed ?
Thanks in advance ! :)