I have a simple Arduino HTTP Server and I want to browse this server from my Ubuntu.
If I assign to Arduino an IP 192.168.0.9 and I connect the Arduino HTTP Server to my router (to any of the 4 ethernet ports), all works fine and I can browse from my Ubuntu
Ubuntu => wlan0 => router => Arduino HTTP Server
I assume all is ok because I assigned a static IP to Arduino, and so it sits in the same subnet 192.168.0.0/24.
In my notebook there is also an eth0. It is much easier for me to connect Arduino to this eth0 than to the router.
From ifconfig
, I have wlan 192.168.0.22
and eth0 10.42.0.1
My goal is to have:
Ubuntu => wlan0 => router => Internet
Ubuntu => eth0 => Arduino HTTP Server
To connect Ubuntu to Arduino I have:
- assigned Arduino HTTP servier an IP in the same subnet of the eth0: 10.42.0.9
- added route all request to 10.42.0.9 via eth0
- left route all other request via wlan
But at the moment it is not working.
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
10.42.0.0 * 255.255.255.0 U 1 0 0 eth0
192.168.0.0 * 255.255.255.0 U 9 0 0 wlan0
I didn't add the 10.42.0.0... Ubuntu decided this address for the eth0
Can you explain the correct way to use both eth0 and wlan?
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1a:4b:8c:38:8e
inet addr:10.42.0.1 Bcast:10.42.0.255 Mask:255.255.255.0
inet6 addr: fe80::21a:4bff:fe8c:388e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:13231 (13.2 KB)
Interrupt:22 Memory:e4600000-e4620000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2968 errors:0 dropped:0 overruns:0 frame:0
TX packets:2968 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:386864 (386.8 KB) TX bytes:386864 (386.8 KB)
wlan0 Link encap:Ethernet HWaddr 00:1a:73:e5:74:72
inet addr:192.168.0.22 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: 2a02:678:1be:1900:4947:bdbb:4d8b:4c2a/64 Scope:Global
inet6 addr: 2a02:678:1be:1900:21a:73ff:fee5:7472/64 Scope:Global
inet6 addr: fe80::21a:73ff:fee5:7472/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42689 errors:0 dropped:0 overruns:0 frame:0
TX packets:20397 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22666151 (22.6 MB) TX bytes:3533575 (3.5 MB)